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();