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, setParent
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
public ClassScope(java.lang.String className)
public ClassScope()
public void addDeclaration(VariableNameDeclaration variableDecl)
Scope
public NameDeclaration addVariableNameOccurrence(NameOccurrence occurrence)
Scope
public java.util.Map<VariableNameDeclaration,java.util.List<NameOccurrence>> getVariableDeclarations()
Scope
public java.util.Map<MethodNameDeclaration,java.util.List<NameOccurrence>> getMethodDeclarations()
public java.util.Map<ClassNameDeclaration,java.util.List<NameOccurrence>> getClassDeclarations()
Scope
getClassDeclarations
in interface Scope
getClassDeclarations
in class AbstractScope
public ClassScope getEnclosingClassScope()
Scope
getEnclosingClassScope
in interface Scope
getEnclosingClassScope
in class AbstractScope
public java.lang.String getClassName()
public void addDeclaration(MethodNameDeclaration decl)
Scope
addDeclaration
in interface Scope
addDeclaration
in class AbstractScope
public void addDeclaration(ClassNameDeclaration decl)
Scope
addDeclaration
in interface Scope
addDeclaration
in class AbstractScope
protected NameDeclaration findVariableHere(NameOccurrence occurrence)
findVariableHere
in class AbstractScope
public java.lang.String toString()
toString
in class java.lang.Object