public class TypeCheckingContext extends Object
Modifier and Type | Class | Description |
---|---|---|
static class |
TypeCheckingContext.EnclosingClosure |
Represents the context of an enclosing closure.
|
Modifier and Type | Field | Description |
---|---|---|
protected Set<MethodNode> |
alreadyVisitedMethods |
|
protected Map<VariableExpression,List<ClassNode>> |
closureSharedVariablesAssignmentTypes |
A map used to store every type used in closure shared variable assignments.
|
protected CompilationUnit |
compilationUnit |
|
protected Map<Parameter,ClassNode> |
controlStructureVariables |
|
protected org.codehaus.groovy.transform.stc.DelegationMetadata |
delegationMetadata |
|
protected LinkedList<BinaryExpression> |
enclosingBinaryExpressions |
|
protected LinkedList<ClassNode> |
enclosingClassNodes |
|
protected LinkedList<TypeCheckingContext.EnclosingClosure> |
enclosingClosures |
|
protected LinkedList<Expression> |
enclosingMethodCalls |
|
protected LinkedList<MethodNode> |
enclosingMethods |
|
protected LinkedList<ErrorCollector> |
errorCollectors |
|
protected Map<VariableExpression,List<ClassNode>> |
ifElseForWhileAssignmentTracker |
This field is used to track assignments in if/else branches, for loops and while loops.
|
protected boolean |
isInStaticContext |
|
protected ClassNode |
lastImplicitItType |
The type of the last encountered "it" implicit parameter
|
protected Set<MethodNode> |
methodsToBeVisited |
|
protected Set<Long> |
reportedErrors |
|
protected LinkedHashSet<org.codehaus.groovy.transform.stc.SecondPassExpression> |
secondPassExpressions |
Some expressions need to be visited twice, because type information may be insufficient at some point.
|
protected SourceUnit |
source |
|
protected Stack<Map<Object,List<ClassNode>>> |
temporaryIfBranchTypeInformation |
Stores information which is only valid in the "if" branch of an if-then-else statement.
|
protected StaticTypeCheckingVisitor |
visitor |
Constructor | Description |
---|---|
TypeCheckingContext(StaticTypeCheckingVisitor staticTypeCheckingVisitor) |
Modifier and Type | Method | Description |
---|---|---|
CompilationUnit |
getCompilationUnit() |
|
BinaryExpression |
getEnclosingBinaryExpression() |
Returns the binary expression which is on the top of the stack, or null
if there's no such element.
|
List<BinaryExpression> |
getEnclosingBinaryExpressionStack() |
Returns the current stack of enclosing binary expressions.
|
ClassNode |
getEnclosingClassNode() |
Returns the class node which is on the top of the stack, or null
if there's no such element.
|
List<ClassNode> |
getEnclosingClassNodes() |
Returns the current stack of enclosing classes.
|
TypeCheckingContext.EnclosingClosure |
getEnclosingClosure() |
Returns the closure expression which is on the top of the stack, or null
if there's no such element.
|
List<TypeCheckingContext.EnclosingClosure> |
getEnclosingClosureStack() |
Returns the current stack of enclosing closure expressions.
|
MethodNode |
getEnclosingMethod() |
Returns the method node which is on the top of the stack, or null
if there's no such element.
|
Expression |
getEnclosingMethodCall() |
Returns the method call which is on the top of the stack, or null
if there's no such element.
|
List<Expression> |
getEnclosingMethodCalls() |
Returns the current stack of enclosing classes.
|
List<MethodNode> |
getEnclosingMethods() |
Returns the current stack of enclosing methods.
|
ErrorCollector |
getErrorCollector() |
|
List<ErrorCollector> |
getErrorCollectors() |
|
SourceUnit |
getSource() |
|
BinaryExpression |
popEnclosingBinaryExpression() |
Pops a binary expression from the binary expression stack.
|
ClassNode |
popEnclosingClassNode() |
Pops a class from the enclosing classes stack.
|
TypeCheckingContext.EnclosingClosure |
popEnclosingClosure() |
Pops a closure expression from the closure expression stack.
|
MethodNode |
popEnclosingMethod() |
Pops a method from the enclosing methods stack.
|
Expression |
popEnclosingMethodCall() |
Pops a method call from the enclosing method call stack.
|
ErrorCollector |
popErrorCollector() |
|
void |
popTemporaryTypeInfo() |
|
void |
pushEnclosingBinaryExpression(BinaryExpression binaryExpression) |
Pushes a binary expression into the binary expression stack.
|
void |
pushEnclosingClassNode(ClassNode classNode) |
Pushes a class into the classes stack.
|
void |
pushEnclosingClosureExpression(ClosureExpression closureExpression) |
Pushes a closure expression into the closure expression stack.
|
void |
pushEnclosingMethod(MethodNode methodNode) |
Pushes a method into the method stack.
|
void |
pushEnclosingMethodCall(Expression call) |
Pushes a method call into the method call stack.
|
ErrorCollector |
pushErrorCollector() |
|
void |
pushErrorCollector(ErrorCollector collector) |
|
void |
pushTemporaryTypeInfo() |
|
void |
setCompilationUnit(CompilationUnit compilationUnit) |
protected SourceUnit source
protected Set<MethodNode> methodsToBeVisited
protected boolean isInStaticContext
protected final LinkedList<ErrorCollector> errorCollectors
protected final LinkedList<ClassNode> enclosingClassNodes
protected final LinkedList<MethodNode> enclosingMethods
protected final LinkedList<Expression> enclosingMethodCalls
protected final LinkedList<TypeCheckingContext.EnclosingClosure> enclosingClosures
protected org.codehaus.groovy.transform.stc.DelegationMetadata delegationMetadata
protected ClassNode lastImplicitItType
protected Map<VariableExpression,List<ClassNode>> ifElseForWhileAssignmentTracker
protected Stack<Map<Object,List<ClassNode>>> temporaryIfBranchTypeInformation
protected Set<MethodNode> alreadyVisitedMethods
protected final LinkedHashSet<org.codehaus.groovy.transform.stc.SecondPassExpression> secondPassExpressions
protected final Map<VariableExpression,List<ClassNode>> closureSharedVariablesAssignmentTypes
protected final LinkedList<BinaryExpression> enclosingBinaryExpressions
protected final StaticTypeCheckingVisitor visitor
protected CompilationUnit compilationUnit
public TypeCheckingContext(StaticTypeCheckingVisitor staticTypeCheckingVisitor)
public void pushEnclosingBinaryExpression(BinaryExpression binaryExpression)
binaryExpression
- the binary expression to be pushedpublic BinaryExpression popEnclosingBinaryExpression()
public BinaryExpression getEnclosingBinaryExpression()
public List<BinaryExpression> getEnclosingBinaryExpressionStack()
public void pushEnclosingClosureExpression(ClosureExpression closureExpression)
closureExpression
- the closure expression to be pushedpublic TypeCheckingContext.EnclosingClosure popEnclosingClosure()
public TypeCheckingContext.EnclosingClosure getEnclosingClosure()
public List<TypeCheckingContext.EnclosingClosure> getEnclosingClosureStack()
public void pushEnclosingMethod(MethodNode methodNode)
methodNode
- the method to be pushedpublic MethodNode popEnclosingMethod()
public MethodNode getEnclosingMethod()
public List<MethodNode> getEnclosingMethods()
public void pushEnclosingClassNode(ClassNode classNode)
classNode
- the class to be pushedpublic ClassNode popEnclosingClassNode()
public ClassNode getEnclosingClassNode()
public List<ClassNode> getEnclosingClassNodes()
public void pushTemporaryTypeInfo()
public void popTemporaryTypeInfo()
public void pushEnclosingMethodCall(Expression call)
call
- the call expression to be pushed, either a MethodCallExpression
or a StaticMethodCallExpression
public Expression popEnclosingMethodCall()
public Expression getEnclosingMethodCall()
public List<Expression> getEnclosingMethodCalls()
public List<ErrorCollector> getErrorCollectors()
public ErrorCollector getErrorCollector()
public void pushErrorCollector(ErrorCollector collector)
public ErrorCollector pushErrorCollector()
public ErrorCollector popErrorCollector()
public CompilationUnit getCompilationUnit()
public void setCompilationUnit(CompilationUnit compilationUnit)
public SourceUnit getSource()