@AutoFinal
@CompileStatic
class CheckingVisitor
extends ClassCodeVisitorSupport
Base visitor support for type-checker extensions that need lightweight constant propagation and access to the underlying variable represented by a VariableExpression.
| Modifiers | Name | Description |
|---|---|---|
protected Map<Expression, Expression> |
localConstVars |
Tracks local variables whose values are known constant expressions during the current visit. |
| Constructor and description |
|---|
CheckingVisitor() |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected Expression |
findConstExp(Expression exp, Class type)Resolves a constant expression of the requested type from an expression, following tracked locals and field initializers when possible. |
|
protected Variable |
findTargetVariable(VariableExpression ve)Follows VariableExpression.accessedVariable links until the original variable or field is found. |
|
protected SourceUnit |
getSourceUnit()Returns no backing source unit because subclasses report errors through the enclosing type-checking extension rather than this visitor. |
Tracks local variables whose values are known constant expressions during the current visit.
Resolves a constant expression of the requested type from an expression, following tracked locals and field initializers when possible.
exp - expression to inspecttype - required runtime type for the constant valuenull when none can be resolvedFollows VariableExpression.accessedVariable links until the original variable or field is found.
ve - variable expression to resolveReturns no backing source unit because subclasses report errors through the enclosing type-checking extension rather than this visitor.
Copyright © 2003-2026 The Apache Software Foundation. All rights reserved.