public class StaticVerifier
extends ClassCodeVisitorSupport
Checks for dynamic variables in static contexts.
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected SourceUnit |
getSourceUnit()Returns the source unit currently being verified. |
|
public void |
visitClass(ClassNode node, SourceUnit unit)Starts verification for the supplied class and source unit. |
|
public void |
visitClosureExpression(ClosureExpression ce)Tracks closure nesting while visiting closure expressions. |
|
public void |
visitConstructorCallExpression(ConstructorCallExpression cce)Tracks whether the visitor is inside a special constructor call. |
|
public void |
visitConstructorOrMethod(MethodNode node, boolean isConstructor)Tracks the current method or constructor while verifying static references. |
|
public void |
visitVariableExpression(VariableExpression ve)Reports dynamic variable access that is illegal in static contexts. |
Returns the source unit currently being verified.
Starts verification for the supplied class and source unit.
node - the class to verifyunit - the owning source unitTracks closure nesting while visiting closure expressions.
ce - the closure expression to visitTracks whether the visitor is inside a special constructor call.
cce - the constructor call to visitTracks the current method or constructor while verifying static references.
node - the method or constructor being visitedisConstructor - whether node is a constructorReports dynamic variable access that is illegal in static contexts.
ve - the variable expression to inspect