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