public class MethodScope extends AbstractScope
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<VariableNameDeclaration,java.util.List<NameOccurrence>> |
variableNames |
Constructor and Description |
---|
MethodScope(SimpleNode node) |
Modifier and Type | Method and Description |
---|---|
void |
addDeclaration(VariableNameDeclaration variableDecl)
Add a variable declaration to this scope
|
NameDeclaration |
addVariableNameOccurrence(NameOccurrence occurrence)
Adds a NameOccurrence to this scope - only call this after getting
a true back from contains()
|
NameDeclaration |
findVariableHere(NameOccurrence occurrence) |
MethodScope |
getEnclosingMethodScope()
Goes searching up the tree for this scope's enclosing MethodScope
This is handy if you're buried down in a LocalScope and need to
hop up to the MethodScope to find a method parameter.
|
java.lang.String |
getName() |
java.util.Map<VariableNameDeclaration,java.util.List<NameOccurrence>> |
getVariableDeclarations()
Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that
exist at this scope
|
java.lang.String |
toString() |
addDeclaration, addDeclaration, contains, getClassDeclarations, getEnclosingClassScope, getEnclosingSourceFileScope, getParent, glomNames, setParent
protected java.util.Map<VariableNameDeclaration,java.util.List<NameOccurrence>> variableNames
public MethodScope(SimpleNode node)
public MethodScope getEnclosingMethodScope()
Scope
getEnclosingMethodScope
in interface Scope
getEnclosingMethodScope
in class AbstractScope
public java.util.Map<VariableNameDeclaration,java.util.List<NameOccurrence>> getVariableDeclarations()
Scope
public NameDeclaration addVariableNameOccurrence(NameOccurrence occurrence)
Scope
public void addDeclaration(VariableNameDeclaration variableDecl)
Scope
public NameDeclaration findVariableHere(NameOccurrence occurrence)
findVariableHere
in class AbstractScope
public java.lang.String getName()
public java.lang.String toString()
toString
in class java.lang.Object