| Modifier and Type | Class and Description |
|---|---|
| public static class | TypeCheckingContext.EnclosingClosure
Represents the context of an enclosing closure. |
| Modifier and Type | Field and Description |
|---|---|
| protected Set | |
| protected final IdentityHashMap | blockStatements2Types
This field used for type derivation Check IfStatement matched pattern: Object var1; if (!(var1 instanceOf Runnable)){ return } // Here var1 instance of Runnable |
| protected final Map | closureSharedVariablesAssignmentTypes
A map used to store every type used in closure shared variable assignments. |
| protected CompilationUnit | |
| protected Map | |
| protected DelegationMetadata | delegationMetadata
Whenever a method using a closure as argument (typically, "with") is detected, this list is updated with the receiver type of the with method. |
| protected final LinkedList | |
| protected final LinkedList | |
| protected final LinkedList | |
| protected final LinkedList | |
| protected final LinkedList | |
| protected final LinkedList | |
| protected final LinkedList | |
| protected Map | ifElseForWhileAssignmentTracker
This field is used to track assignments in if/else branches, for loops and while loops. |
| protected boolean | |
| protected ClassNode | lastImplicitItType
The type of the last encountered "it" implicit parameter. |
| protected Set | |
| protected final Set | |
| protected final LinkedHashSet | secondPassExpressions
Some expressions need to be visited twice, because type information may be insufficient at some point. |
| protected SourceUnit | |
| protected final LinkedList | |
| protected Stack | temporaryIfBranchTypeInformation
Stores information which is only valid in the "if" branch of an if-then-else statement. |
| protected final StaticTypeCheckingVisitor |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public CompilationUnit | |
| public BinaryExpression | getEnclosingBinaryExpression()
Returns the binary expression which is on the top of the stack, or null if there's no such element. |
| public List | |
| public ClassNode | getEnclosingClassNode()
Returns the class node which is on the top of the stack, or null if there's no such element. |
| public List | |
| public TypeCheckingContext. | getEnclosingClosure()
Returns the closure expression which is on the top of the stack, or null if there's no such element. |
| public List | |
| public MethodNode | getEnclosingMethod()
Returns the method node which is on the top of the stack, or null if there's no such element. |
| public Expression | getEnclosingMethodCall()
Returns the method call which is on the top of the stack, or null if there's no such element. |
| public List | |
| public List | |
| public SwitchStatement | getEnclosingSwitchStatement()
Returns the switch statement which is on the top of the stack, or null if there's no such element. |
| public List | |
| public ErrorCollector | |
| public List | |
| public SourceUnit | |
| public boolean | |
| public BinaryExpression | |
| public ClassNode | |
| public TypeCheckingContext. | |
| public MethodNode | |
| public Expression | |
| public SwitchStatement | |
| public ErrorCollector | |
| public void | |
| public void | pushEnclosingBinaryExpression(final BinaryExpression binaryExpression)
Pushes a binary expression into the binary expression stack. |
| public void | |
| public void | pushEnclosingClosureExpression(final ClosureExpression closureExpression)
Pushes a closure expression into the closure expression stack. |
| public void | |
| public void | pushEnclosingMethodCall(final Expression
the call expression to be pushed, either a call)MethodCallExpression or a StaticMethodCallExpressionPushes a method call into the method call stack. |
| public void | pushEnclosingSwitchStatement(final SwitchStatement switchStatement)
Pushes a switch statement into the switch statement stack. |
| public ErrorCollector | |
| public void | |
| public void | |
| public void |
| alreadyVisitedMethods | back to summary |
|---|---|
| protected Set<MethodNode> alreadyVisitedMethods | |
| blockStatements2Types | back to summary |
|---|---|
| protected final IdentityHashMap<BlockStatement, Map<VariableExpression, List<ClassNode>>> blockStatements2Types This field used for type derivation Check IfStatement matched pattern: Object var1; if (!(var1 instanceOf Runnable)){ return } // Here var1 instance of Runnable | |
| closureSharedVariablesAssignmentTypes | back to summary |
|---|---|
| protected final Map<VariableExpression, List<ClassNode>> closureSharedVariablesAssignmentTypes A map used to store every type used in closure shared variable assignments. In a second pass, we will compute the LUB of each type and check that method calls on those variables are valid. | |
| compilationUnit | back to summary |
|---|---|
| protected CompilationUnit compilationUnit | |
| controlStructureVariables | back to summary |
|---|---|
| protected Map<Parameter, ClassNode> controlStructureVariables | |
| delegationMetadata | back to summary |
|---|---|
| protected DelegationMetadata delegationMetadata Whenever a method using a closure as argument (typically, "with") is detected, this list is updated with the receiver type of the with method. | |
| enclosingBinaryExpressions | back to summary |
|---|---|
| protected final LinkedList<BinaryExpression> enclosingBinaryExpressions | |
| enclosingBlocks | back to summary |
|---|---|
| protected final LinkedList<BlockStatement> enclosingBlocks | |
| enclosingClassNodes | back to summary |
|---|---|
| protected final LinkedList<ClassNode> enclosingClassNodes | |
| enclosingClosures | back to summary |
|---|---|
| protected final LinkedList<TypeCheckingContext. | |
| enclosingMethodCalls | back to summary |
|---|---|
| protected final LinkedList<Expression> enclosingMethodCalls | |
| enclosingMethods | back to summary |
|---|---|
| protected final LinkedList<MethodNode> enclosingMethods | |
| errorCollectors | back to summary |
|---|---|
| protected final LinkedList<ErrorCollector> errorCollectors | |
| ifElseForWhileAssignmentTracker | back to summary |
|---|---|
| protected Map<VariableExpression, List<ClassNode>> ifElseForWhileAssignmentTracker This field is used to track assignments in if/else branches, for loops and
while loops. For example, in the following code: | |
| isInStaticContext | back to summary |
|---|---|
| protected boolean isInStaticContext | |
| lastImplicitItType | back to summary |
|---|---|
| protected ClassNode lastImplicitItType The type of the last encountered "it" implicit parameter. | |
| methodsToBeVisited | back to summary |
|---|---|
| protected Set<MethodNode> methodsToBeVisited | |
| reportedErrors | back to summary |
|---|---|
| protected final Set<Long> reportedErrors | |
| secondPassExpressions | back to summary |
|---|---|
| protected final LinkedHashSet<SecondPassExpression<T>> secondPassExpressions Some expressions need to be visited twice, because type information may be insufficient at some point. For example, for closure shared variables, we need a first pass to collect every type which is assigned to a closure shared variable, then a second pass to ensure that every method call on such a variable is made on a LUB. | |
| source | back to summary |
|---|---|
| protected SourceUnit source | |
| switchStatements | back to summary |
|---|---|
| protected final LinkedList<SwitchStatement> switchStatements | |
| temporaryIfBranchTypeInformation | back to summary |
|---|---|
| protected Stack<Map<Object, List<ClassNode>>> temporaryIfBranchTypeInformation Stores information which is only valid in the "if" branch of an if-then-else statement. This is used when the if condition expression makes use of an instanceof check | |
| visitor | back to summary |
|---|---|
| protected final StaticTypeCheckingVisitor visitor | |
| TypeCheckingContext | back to summary |
|---|---|
| public TypeCheckingContext(final StaticTypeCheckingVisitor visitor) | |
| getCompilationUnit | back to summary |
|---|---|
| public CompilationUnit getCompilationUnit() | |
| getEnclosingBinaryExpression | back to summary |
|---|---|
| public BinaryExpression getEnclosingBinaryExpression() Returns the binary expression which is on the top of the stack, or null if there's no such element. | |
| getEnclosingBinaryExpressionStack | back to summary |
|---|---|
| public List Returns the current stack of enclosing binary expressions. The first element is the top of the stack. | |
| getEnclosingClassNode | back to summary |
|---|---|
| public ClassNode getEnclosingClassNode() Returns the class node which is on the top of the stack, or null if there's no such element. | |
| getEnclosingClassNodes | back to summary |
|---|---|
| public List Returns the current stack of enclosing classes. The first element is the top of the stack, that is to say the currently visited class. | |
| getEnclosingClosure | back to summary |
|---|---|
| public TypeCheckingContext. Returns the closure expression which is on the top of the stack, or null if there's no such element. | |
| getEnclosingClosureStack | back to summary |
|---|---|
| public List Returns the current stack of enclosing closure expressions. The first element is the top of the stack. | |
| getEnclosingMethod | back to summary |
|---|---|
| public MethodNode getEnclosingMethod() Returns the method node which is on the top of the stack, or null if there's no such element. | |
| getEnclosingMethodCall | back to summary |
|---|---|
| public Expression getEnclosingMethodCall() Returns the method call which is on the top of the stack, or null if there's no such element. | |
| getEnclosingMethodCalls | back to summary |
|---|---|
| public List Returns the current stack of enclosing method calls. The first element is the top of the stack, that is to say the currently visited method call. | |
| getEnclosingMethods | back to summary |
|---|---|
| public List Returns the current stack of enclosing methods. The first element is the top of the stack, that is to say the last visited method. | |
| getEnclosingSwitchStatement | back to summary |
|---|---|
| public SwitchStatement getEnclosingSwitchStatement() Returns the switch statement which is on the top of the stack, or null if there's no such element. | |
| getEnclosingSwitchStatements | back to summary |
|---|---|
| public List Returns the current stack of enclosing switch statements. The first element is the top of the stack, that is to say the last visited switch statement. | |
| getErrorCollector | back to summary |
|---|---|
| public ErrorCollector getErrorCollector() | |
| getErrorCollectors | back to summary |
|---|---|
| public List | |
| getSource | back to summary |
|---|---|
| public SourceUnit getSource() | |
| isTargetOfEnclosingAssignment | back to summary |
|---|---|
| public boolean isTargetOfEnclosingAssignment(final Expression expression) | |
| popEnclosingBinaryExpression | back to summary |
|---|---|
| public BinaryExpression popEnclosingBinaryExpression() Pops a binary expression from the binary expression stack. | |
| popEnclosingClassNode | back to summary |
|---|---|
| public ClassNode popEnclosingClassNode() Pops a class from the enclosing classes stack. | |
| popEnclosingClosure | back to summary |
|---|---|
| public TypeCheckingContext. Pops a closure expression from the closure expression stack. | |
| popEnclosingMethod | back to summary |
|---|---|
| public MethodNode popEnclosingMethod() Pops a method from the enclosing methods stack. | |
| popEnclosingMethodCall | back to summary |
|---|---|
| public Expression popEnclosingMethodCall() Pops a method call from the enclosing method call stack. | |
| popEnclosingSwitchStatement | back to summary |
|---|---|
| public SwitchStatement popEnclosingSwitchStatement() Pops a switch statement from the enclosing switch statements stack. | |
| popErrorCollector | back to summary |
|---|---|
| public ErrorCollector popErrorCollector() | |
| popTemporaryTypeInfo | back to summary |
|---|---|
| public void popTemporaryTypeInfo() | |
| pushEnclosingBinaryExpression | back to summary |
|---|---|
| public void pushEnclosingBinaryExpression(final BinaryExpression binaryExpression) Pushes a binary expression into the binary expression stack. | |
| pushEnclosingClassNode | back to summary |
|---|---|
| public void pushEnclosingClassNode(final ClassNode classNode) Pushes a class into the classes stack. | |
| pushEnclosingClosureExpression | back to summary |
|---|---|
| public void pushEnclosingClosureExpression(final ClosureExpression closureExpression) Pushes a closure expression into the closure expression stack. | |
| pushEnclosingMethod | back to summary |
|---|---|
| public void pushEnclosingMethod(final MethodNode methodNode) Pushes a method into the method stack. | |
| pushEnclosingMethodCall | back to summary |
|---|---|
| public void pushEnclosingMethodCall(final Expression call) Pushes a method call into the method call stack.
| |
| pushEnclosingSwitchStatement | back to summary |
|---|---|
| public void pushEnclosingSwitchStatement(final SwitchStatement switchStatement) Pushes a switch statement into the switch statement stack. | |
| pushErrorCollector | back to summary |
|---|---|
| public ErrorCollector pushErrorCollector() | |
| pushErrorCollector | back to summary |
|---|---|
| public void pushErrorCollector(final ErrorCollector collector) | |
| pushTemporaryTypeInfo | back to summary |
|---|---|
| public void pushTemporaryTypeInfo() | |
| setCompilationUnit | back to summary |
|---|---|
| public void setCompilationUnit(final CompilationUnit compilationUnit) | |
| Modifier and Type | Field and Description |
|---|---|
| private final ClosureExpression | |
| private final List |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public ClosureExpression | |
| public List | |
| public String |
| closureExpression | back to summary |
|---|---|
| private final ClosureExpression closureExpression | |
| returnTypes | back to summary |
|---|---|
| private final List<ClassNode> returnTypes | |
| EnclosingClosure | back to summary |
|---|---|
| public EnclosingClosure(final ClosureExpression closureExpression) | |
| addReturnType | back to summary |
|---|---|
| public void addReturnType(final ClassNode type) | |
| getClosureExpression | back to summary |
|---|---|
| public ClosureExpression getClosureExpression() | |
| getReturnTypes | back to summary |
|---|---|
| public List | |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object. | |