Package anvil.script

Examples of anvil.script.Import


  public void importExternals(ErrorListener listener)
  {
    if (_imports != null) {
      int size = _imports.size();
      for(int i=0; i<size; i++) {
        Import imprt = (Import)_imports.get(i);
        Location location = imprt.getLocation();
        Object source = imprt.getSource();
        Name[] decls = imprt.getDeclarations();
        Type type = imprt.resolve(listener);
        if (type != null) {
          if (imprt.importAll()) {
            if (type instanceof Scope) {
              addExternals(listener, location, source, (Scope)type);
            } else {
              listener.error(location, "Trying to import all contained types from non-scoped entity '"+source+"'");
           
           
          } else if (decls != null) {
         
            if (type instanceof Scope) {
              int n = decls.length;
              for(int j=0; j<n; j++) {
                Name childname = decls[j];
                Type child = follow(type, childname);
                if (child != null) {
                  if (childname.hasStar()) {
                    switch(child.getType()) {
                    case MODULE:
                    case NAMESPACE:
                    case CLASS:
                    case INTERFACE:
                      addExternals(listener, location, source, (Scope)child);
                      break;
                    default:
                      listener.error(location, "Entity '"+child+"' does not contain any entities that may be imported");
                      break;
                    }
                  } else {
                    addExternal(listener, location, source, childname.as(), child);
                  }
                } else {
                  listener.error(location, "Entity '"+childname+"' not found from '"+source+"'");
                }
              }
             
            } else {
              listener.error(location, "Trying to import named entities from non-scoped entity '"+type+"'");
            }
         
          } else {
            addExternal(listener, location, source, imprt.getAs(), type);
          }
        }
      }
    }
    Enumeration e = _types.elements();
View Full Code Here


      Name entity,
      Name[] decls,
      boolean withStar)
  {
    LinkNode link = new LinkNode(this, location, entity);
    Import imprt = new Import(null, location, entity, new TypeRef(link), entity.as(), decls, withStar);
    addImport(imprt);
  }
View Full Code Here

      as = extractNameFromHref(address.getPathinfo());
    }
    if (!Grammar.isValidIdentifier(as)) {
      listener.error(location, "Identifier '" + as + "' is invalid");
    }      
    Import imprt = new Import(address, location, null,
        new ExternalTypeRef(script, address), as, decls, withStar);
    addImport(imprt);
  }
View Full Code Here

TOP

Related Classes of anvil.script.Import

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.