public abstract class MethodInvocationTrap extends CodeVisitorSupport
Modifier and Type | Field and Description |
---|---|
protected ReaderSource |
source |
protected SourceUnit |
sourceUnit |
Constructor and Description |
---|
MethodInvocationTrap(ReaderSource source,
SourceUnit sourceUnit) |
Modifier and Type | Method and Description |
---|---|
protected void |
addError(String msg,
ASTNode expr)
Reports an error back to the source unit.
|
protected String |
convertClosureToSource(ClosureExpression expression)
Converts a ClosureExpression into the String source.
|
protected abstract boolean |
handleTargetMethodCallExpression(MethodCallExpression call) |
protected abstract boolean |
isBuildInvocation(MethodCallExpression call) |
void |
visitMethodCallExpression(MethodCallExpression call)
Attempts to find AstBuilder 'from code' invocations.
|
visitArgumentlistExpression, visitArrayExpression, visitAssertStatement, visitAttributeExpression, visitBinaryExpression, visitBitwiseNegationExpression, visitBlockStatement, visitBooleanExpression, visitBreakStatement, visitBytecodeExpression, visitCaseStatement, visitCastExpression, visitCatchStatement, visitClassExpression, visitClosureExpression, visitClosureListExpression, visitConstantExpression, visitConstructorCallExpression, visitContinueStatement, visitDeclarationExpression, visitDoWhileLoop, visitEmptyStatement, visitExpressionStatement, visitFieldExpression, visitForLoop, visitGStringExpression, visitIfElse, visitListExpression, visitListOfExpressions, visitMapEntryExpression, visitMapExpression, visitMethodPointerExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitReturnStatement, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitSwitch, visitSynchronizedStatement, visitTernaryExpression, visitThrowStatement, visitTryCatchFinally, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression, visitWhileLoop
protected final ReaderSource source
protected final SourceUnit sourceUnit
public MethodInvocationTrap(ReaderSource source, SourceUnit sourceUnit)
public void visitMethodCallExpression(MethodCallExpression call)
visitMethodCallExpression
in interface GroovyCodeVisitor
visitMethodCallExpression
in class CodeVisitorSupport
call
- the method call expression that may or may not be an AstBuilder 'from code' invocation.protected void addError(String msg, ASTNode expr)
msg
- the error messageexpr
- the expression that caused the error message.protected String convertClosureToSource(ClosureExpression expression)
expression
- a closureprotected abstract boolean handleTargetMethodCallExpression(MethodCallExpression call)
protected abstract boolean isBuildInvocation(MethodCallExpression call)