Package anvil.script

Examples of anvil.script.ClassType


          return null;
        }

      case Type.CLASS:
        {
          ClassType clazz = (ClassType)type;
          if (hasMoreSymbols()) {
            symbol = consumeSymbol();
            type = clazz.lookupDeclaration(symbol);
            break;
          }
          if (!hasArgs()) {
            listener.error(_location, "Syntax error: argument list expected after '"+_name.toString(1)+"'");
            return null;
          }
          CompilableFunction constructor = clazz.getConstructor();
          if (constructor == null) {
            listener.error(_location, "Class '" + clazz + "' does not have constructor");
            return null;
          }
          ClassType context = _statement.getClassStatement();
          checkArguments(listener, constructor);
          Grammar.checkInstanceAccess(listener, _location, _statement, clazz);
          //Grammar.checkInstanceAmbiguity(listener, _location, context, clazz);
          return new NewNode(context, clazz, constructor, consumeArgs());
        }
View Full Code Here


  }


  protected Node doLink(ErrorListener listener)
  {
    ClassType classtype;
    switch(peekKind()) {
    case ParserBaseConstants.SYMBOL:
      {
        String symbol = peekSymbol();
        if (symbol.equals("__FILE__")) {
View Full Code Here

 
  public Type lookupInheritedDeclaration(String name)
  {
    Type type;
    if (_base != null) {
      ClassType classtype = _base.getClassType();
      if (classtype != null) {
        if ((type = classtype.lookupDeclaration(name)) != null) {
          return type;
        }
      }
    }
    if (_interfaces != null) {
View Full Code Here

  public CompilableFunction getBaseClassConstructor()
  {
    ClassRef ref = getBase();
    if (ref != null) {
      ClassType base = ref.getClassType();
      if (base != Any.__class__) {
        return base.getConstructor();
      }
    }
    return null;
  }
View Full Code Here

    clazz.setAccessFlags(Code.ACC_PUBLIC);
    ConstantPool pool = clazz.getPool();
    context.pushClass(clazz);
    Field typefield1 = clazz.createField("_class", "Lanvil/script/compiler/CompiledClassType;", Code.ACC_PUBLIC|Code.ACC_STATIC);
    Field typefield2 = clazz.createField("_type", "Lanvil/core/Any;", Code.ACC_PUBLIC|Code.ACC_STATIC);
    ClassType base = getBaseClass();
    if (base != Any.__class__) {
      clazz.setSuperClassname(base.getDescriptor());
    } else {
      clazz.setSuperClassname("anvil/core/AnyClass");
    }
    clazz.setAccessFlags(Code.ACC_SUPER|Code.ACC_PUBLIC);
View Full Code Here

  public Any execute(Context context, Any[] parameters)
  {
    switch(_typecode) {
    case Type.CLASS:
      {
        ClassType type = (ClassType)_type;
        Function ctor = type.getConstructor();
        if (ctor != null) {
          return ctor.execute(context, parameters);
        }
        throw context.InstantiationError("No constructor for "+type);
      }
View Full Code Here

  {
    if (!(clazz instanceof AnyType)) {
      throw context.BadParameter("Type expected");
    }
    if (_typecode == Type.CLASS) {
      ClassType self = (ClassType)_type;
      Type other = (Type)clazz.toObject();
      return self.isInstanceOf(other) ? TRUE : FALSE;
    }
    return FALSE;
  }
View Full Code Here

  public Any newInstance(Context context, String name, Any[] parameters)
  {
    Type type = (Type)_types.get(name);
    if (type != null) {
      if (type.getType() == CLASS) {
        ClassType clazz = (ClassType)type;
        return clazz.getConstructor().execute(context, parameters);
      }
    }
    throw context.NoSuchClass(_name + '.' + name);
  }
View Full Code Here

TOP

Related Classes of anvil.script.ClassType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.