Package anvil.script

Examples of anvil.script.Type


  }


  public Type resolveReference(ErrorListener listener)
  {
    Type type;
    if (peekKind() == ParserBaseConstants.MODULE) {
      consumeSymbol();
      type = _script;
    } else {
      String symbol = peekSymbol();
      type = _statement.lookupAnyDeclaration(symbol);
      if (type == null) {
        type = LangModule.__module__.lookupDeclaration(symbol);
        if (type == null) {
          consumeSymbol();
          type = lookupLibrary(listener);
        } else {
          type = LangModule.__module__;
          symbol = type.getName();
        }
      } else {
        consumeSymbol();
      }
    }

    while(true) {

      if (type == null) {
        listener.error(_location, "Entity '" + _name + "' is undeclared");
        return null;
      }

      type = followImports(listener, type);
      if (type == null) {
        return null;
      }

      switch(type.getType()) {
      case Type.MODULE:
      case Type.CLASS:
      case Type.INTERFACE:
      case Type.NAMESPACE:
        {
View Full Code Here


  }


  public Type lookupDeclaration(String name)
  {
    Type type = (Type)_types.get(name);
    if (type != null){
      return type;
    }
    type = lookupInheritedDeclaration(name);
    if (type != null){
View Full Code Here


  public Type lookupInheritedDeclaration(String name)
  {
    InterfaceType base;
    Type type;
    int n = _bases.length;
    for(int i=0; i<n; i++) {
      if ((base = _bases[i].getInterfaceType()) != null) {
        if ((type = base.lookupDeclaration(name)) != null) {
          return type;
View Full Code Here

        }
        break;
     
      case Type.MEMBER_VARIABLE:
        {
          Type parent = _type.getParent();
          int field = pool.addFieldRef(parent.getTypeRef(pool), "_class",
            "Lanvil/script/compiler/CompiledClassType;");
          code.getstatic(field);
          code.aload_first();
          code.astring(_type.getName());
          code.invokevirtual(pool.addMethodRef(
View Full Code Here

    if (_interfaces == null) {
      _interfaces = new InterfaceRef[0];
    }
   
    ArrayList list = new ArrayList()
    Type type = _parent;
    while(type != null) {
      if (type.getType() != CLASS) {
        break;
      }
      list.add(0, type);
      type = type.getParent();
    }
    _parents = (ClassType[])list.toArray(new ClassType[list.size()]);

    _descriptor = (_parent.getDescriptor() + "$z_" + _name);
View Full Code Here

  }
 

  public Type lookupDeclaration(String name)
  {
    Type type = (Type)_types.get(name);
    if (type != null) {
      return type;
    }
    type = lookupInheritedDeclaration(name);
    if (type != null) {
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;
View Full Code Here

  }


  protected MethodStatement getMethod(String  name)
  {
    Type type = (Type)_types.get(name);
    if (type != null && type.getType() == METHOD) {
      return (MethodStatement)type;
    }
    return null;
  }
View Full Code Here

    }
    code.putstatic(bases);

    Enumeration e = _types.elements();
    while(e.hasMoreElements()) {
      Type type = (Type)e.nextElement();
      if (type.getType() == CLASS) {
        code.getstatic(pool.addFieldRef(type.getTypeRef(pool),
          "_members", "[Ljava/lang/Object;"));
        code.pop();
      }
    }
View Full Code Here

  }
 
  public Type lookupDeclaration(String name)
  {
    Type type = (Type)_types.get(name);
    if (type != null) {
      return type;
    }
    return super.lookupDeclaration(name);
  }
View Full Code Here

TOP

Related Classes of anvil.script.Type

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.