public class ClassScope extends AbstractScope
| Modifier and Type | Field and Description |
|---|---|
protected java.util.Map<ClassNameDeclaration,java.util.List<NameOccurrence>> |
classNames |
protected java.util.Map<MethodNameDeclaration,java.util.List<NameOccurrence>> |
methodNames |
protected java.util.Map<VariableNameDeclaration,java.util.List<NameOccurrence>> |
variableNames |
| Constructor and Description |
|---|
ClassScope()
This is only for anonymous inner classes
FIXME - should have name like Foo$1, not Anonymous$1
to get this working right, the parent scope needs
to be passed in when instantiating a ClassScope
|
ClassScope(java.lang.String className) |
| Modifier and Type | Method and Description |
|---|---|
void |
addDeclaration(ClassNameDeclaration decl)
Add a class declaration to this scope
|
void |
addDeclaration(MethodNameDeclaration decl)
Add a method declaration to this scope
|
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()
|
protected NameDeclaration |
findVariableHere(NameOccurrence occurrence) |
java.util.Map<ClassNameDeclaration,java.util.List<NameOccurrence>> |
getClassDeclarations()
Returns a Map (VariableNameDeclaration->List(NameOccurrence,NameOccurrence)) of declarations that
exist at this scope
|
java.lang.String |
getClassName() |
ClassScope |
getEnclosingClassScope()
Goes searching up the tree for this scope's enclosing ClassScope
This is handy if you're buried down in a LocalScope and need to
hop up to the ClassScope to find a method name.
|
java.util.Map<MethodNameDeclaration,java.util.List<NameOccurrence>> |
getMethodDeclarations() |
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() |
contains, getEnclosingMethodScope, getEnclosingSourceFileScope, getParent, glomNames, setParentprotected java.util.Map<ClassNameDeclaration,java.util.List<NameOccurrence>> classNames
protected java.util.Map<MethodNameDeclaration,java.util.List<NameOccurrence>> methodNames
protected java.util.Map<VariableNameDeclaration,java.util.List<NameOccurrence>> variableNames
public ClassScope(java.lang.String className)
public ClassScope()
public void addDeclaration(VariableNameDeclaration variableDecl)
Scopepublic NameDeclaration addVariableNameOccurrence(NameOccurrence occurrence)
Scopepublic java.util.Map<VariableNameDeclaration,java.util.List<NameOccurrence>> getVariableDeclarations()
Scopepublic java.util.Map<MethodNameDeclaration,java.util.List<NameOccurrence>> getMethodDeclarations()
public java.util.Map<ClassNameDeclaration,java.util.List<NameOccurrence>> getClassDeclarations()
ScopegetClassDeclarations in interface ScopegetClassDeclarations in class AbstractScopepublic ClassScope getEnclosingClassScope()
ScopegetEnclosingClassScope in interface ScopegetEnclosingClassScope in class AbstractScopepublic java.lang.String getClassName()
public void addDeclaration(MethodNameDeclaration decl)
ScopeaddDeclaration in interface ScopeaddDeclaration in class AbstractScopepublic void addDeclaration(ClassNameDeclaration decl)
ScopeaddDeclaration in interface ScopeaddDeclaration in class AbstractScopeprotected NameDeclaration findVariableHere(NameOccurrence occurrence)
findVariableHere in class AbstractScopepublic java.lang.String toString()
toString in class java.lang.Object