}
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:
{