|
kiama 0.9.0 API
|
|
object
NameResolution
extends AnyRef| Value Summary | |
val
|
decl
: scala.PartialFunction[Access, Decl]
decl refers to the appropriate declaration of the Access,
or to unknownDecl if the declaration is missing.
syn lazy Decl Access.decl();
eq IdUse.decl() = lookup(getName());
eq Dot.decl() = getIdUse().decl();
|
val
|
declarationOf
: (java.lang.String) => scala.PartialFunction[BlockStmt, Decl]
syn Decl BlockStmt.declarationOf(String name) = null;
eq Decl.declarationOf(String name) {
if (getName().equals(name)) return this;
return null;
}
|
val
|
localLookup
: (java.lang.String) => scala.PartialFunction[Attributable, Decl]
Look through the local declarations in a block.
syn lazy Decl Block.localLookup(String name) {
for (int k = 0; k < getNumBlockStmt(); k++) {
Decl d = getBlockStmt(k).declarationOf(name);
if (d != null) return d;
}
return unknownDecl();
}
syn lazy Decl Program.localLookup(String name) {
for (int k = 0; k < getNumPredefinedType(); k++) {
Decl d = getPredefinedType(k).declarationOf(name);
if (d != null) return d;
}
return unknownDecl();
}
|
val
|
lookup
: (java.lang.String) => scala.PartialFunction[Attributable, Decl]
Lookup a name.
inh Decl IdUse.lookup(String name);
inh Decl Block.lookup(String name);
inh Decl TypeDecl.lookup(String name);
eq Program.getBlock().lookup(String name) = localLookup(name); // lookup predefined types
FIXME: haven't encoded this one, needed?
eq Program.getPredefinedType(int index).lookup(String name) = unknownDecl();
eq Block.getBlockStmt(int index).lookup(String name) {
// First, look in the local declarations
if (!localLookup(name).isUnknown())
return localLookup(name);
// Then, look in surrounding context
return lookup(name);
}
eq ClassDecl.getBody().lookup(String name) {
// First, look in superclass chain
if (superClass() != null && !superClass().remoteLookup(name).isUnknown())
return superClass().remoteLookup(name);
// Then, look in surrounding context
return lookup(name);
}
eq Dot.getIdUse().lookup(String name) =
// Do a remote lookup on the object's type.
getObjectReference().decl().type().remoteLookup(name);
|
val
|
remoteLookup
: (java.lang.String) => scala.PartialFunction[TypeDecl, Decl]
Perform a remote name lookup.
Looks through declarations of this type that are accessible from outside the type
By default, there are no such declarations, so return unknownDecl.
syn Decl TypeDecl.remoteLookup(String name) = unknownDecl();
eq ClassDecl.remoteLookup(String name) {
// First, look in local declarations
if (!getBody().localLookup(name).isUnknown())
return getBody().localLookup(name);
// Then, look in the superclass chain
if (superClass() != null && !superClass().remoteLookup(name).isUnknown())
return superClass().remoteLookup(name);
// Otherwise, return null object unknown
return unknownDecl();
}
|
| Methods inherited from AnyRef | |
| getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
| Methods inherited from Any | |
| ==, !=, isInstanceOf, asInstanceOf |
| Value Details |
val
decl : scala.PartialFunction[Access, Decl]
val
lookup : (java.lang.String) => scala.PartialFunction[Attributable, Decl]
val
localLookup : (java.lang.String) => scala.PartialFunction[Attributable, Decl]
val
remoteLookup : (java.lang.String) => scala.PartialFunction[TypeDecl, Decl]
val
declarationOf : (java.lang.String) => scala.PartialFunction[BlockStmt, Decl]
|
kiama 0.9.0 API
|
|