use of net.jangaroo.jooc.ast.QualifiedIde in project jangaroo-tools by CoreMedia.
the class DeclarationScope method lookupDeclaration.
@Override
public IdeDeclaration lookupDeclaration(Ide ide) {
IdeDeclaration decl = null;
if (ide instanceof QualifiedIde) {
String qname = ide.getQualifiedNameStr();
if (importsByQualifiedName.containsKey(qname)) {
return resolveImport(importsByQualifiedName.get(qname));
}
if (ide.isQualifiedByThis()) {
return getClassDeclaration().resolvePropertyDeclaration(ide.getName());
}
if (ide.isQualifiedBySuper()) {
final IdeDeclaration superTypeDeclaration = getClassDeclaration().getSuperTypeDeclaration();
return superTypeDeclaration == null ? null : superTypeDeclaration.resolvePropertyDeclaration(ide.getName());
}
} else {
final String name = ide.getName();
final List<ImportDirective> importsOfThisIde = importsByName.get(name);
if (importsOfThisIde != null) {
if (importsOfThisIde.size() > 1) {
ambigousImport(ide, importsOfThisIde);
}
return resolveImport(importsOfThisIde.get(0));
}
decl = ides.get(ide.getName());
if (decl == null && getDefiningNode() != null && getClassDeclaration() == getDefiningNode()) {
decl = getClassDeclaration().resolvePropertyDeclaration(ide.getName());
if (decl != null && !isInstanceScope && !decl.isStatic()) {
decl = null;
}
}
}
return decl != null ? decl : super.lookupDeclaration(ide);
}
Aggregations