use of org.eclipse.ceylon.model.typechecker.model.ImportList in project ceylon by eclipse.
the class ImportVisitor method visit.
@Override
public void visit(Tree.Import that) {
Backends scopedBackends = that.getScope().getScopedBackends();
if (!scopedBackends.none() && !scopedBackends.supports(unit.getSupportedBackends())) {
return;
}
Tree.ImportPath path = that.getImportPath();
Package importedPackage = importedPackage(path, unit);
if (importedPackage != null) {
path.setModel(importedPackage);
Tree.ImportMemberOrTypeList imtl = that.getImportMemberOrTypeList();
if (imtl != null) {
ImportList il = imtl.getImportList();
il.setImportedScope(importedPackage);
Set<String> names = new HashSet<String>();
List<Tree.ImportMemberOrType> list = imtl.getImportMemberOrTypes();
for (Tree.ImportMemberOrType member : list) {
names.add(importMember(member, importedPackage, il));
}
if (imtl.getImportWildcard() != null) {
importAllMembers(importedPackage, names, il);
} else if (list.isEmpty()) {
imtl.addError("empty import list", 1020);
}
}
}
}
use of org.eclipse.ceylon.model.typechecker.model.ImportList in project ceylon by eclipse.
the class ImportVisitor method importMembers.
private void importMembers(Tree.ImportMemberOrType member, Declaration d) {
Tree.ImportMemberOrTypeList imtl = member.getImportMemberOrTypeList();
if (imtl != null) {
if (d instanceof Value) {
Value v = (Value) d;
TypeDeclaration td = v.getTypeDeclaration();
if (td.isObjectClass()) {
d = td;
}
}
if (d instanceof TypeDeclaration) {
Set<String> names = new HashSet<String>();
ImportList til = imtl.getImportList();
TypeDeclaration td = (TypeDeclaration) d;
til.setImportedScope(td);
List<Tree.ImportMemberOrType> imts = imtl.getImportMemberOrTypes();
for (Tree.ImportMemberOrType imt : imts) {
names.add(importMember(imt, td, til));
}
if (imtl.getImportWildcard() != null) {
importAllMembers(td, names, til);
} else if (imts.isEmpty()) {
imtl.addError("empty import list", 1020);
}
} else {
imtl.addError("member alias list must follow a type");
}
}
}
use of org.eclipse.ceylon.model.typechecker.model.ImportList in project ceylon by eclipse.
the class DeclarationVisitor method visit.
@Override
public void visit(Tree.ImportMemberOrTypeList that) {
ImportList il = new ImportList();
unit.getImportLists().add(il);
that.setImportList(il);
il.setContainer(scope);
il.setUnit(unit);
Scope o = enterScope(il);
super.visit(that);
exitScope(o);
}
Aggregations