Groovy 1.7.0

org.codehaus.groovy.ast.builder
Class AstBuilderInvocationTrap

java.lang.Object
  org.codehaus.groovy.ast.CodeVisitorSupport
      org.codehaus.groovy.ast.builder.AstBuilderInvocationTrap

class AstBuilderInvocationTrap
extends CodeVisitorSupport

This class traps invocations of AstBuilder.build(CompilePhase, boolean, Closure) and converts the contents of the closure into expressions by reading the source of the Closure and sending that as a String to AstBuilder.build(String, CompilePhase, boolean) at runtime.


Constructor Summary
AstBuilderInvocationTrap(List imports, List importPackages, ReaderSource source, SourceUnit sourceUnit)

Creates the trap and captures all the ways in which a class may be referenced via imports.

 
Method Summary
void visitMethodCallExpression(MethodCallExpression call)

Attempts to find AstBuilder 'from code' invocations.

 
Methods inherited from class CodeVisitorSupport
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, visitMethodCallExpression, visitMethodPointerExpression, visitNotExpression, visitPostfixExpression, visitPrefixExpression, visitPropertyExpression, visitRangeExpression, visitRegexExpression, visitReturnStatement, visitShortTernaryExpression, visitSpreadExpression, visitSpreadMapExpression, visitStaticMethodCallExpression, visitSwitch, visitSynchronizedStatement, visitTernaryExpression, visitThrowStatement, visitTryCatchFinally, visitTupleExpression, visitUnaryMinusExpression, visitUnaryPlusExpression, visitVariableExpression, visitWhileLoop
 
Methods inherited from class Object
wait, wait, wait, hashCode, getClass, equals, toString, notify, notifyAll
 

Constructor Detail

AstBuilderInvocationTrap

public AstBuilderInvocationTrap(List imports, List importPackages, ReaderSource source, SourceUnit sourceUnit)
Creates the trap and captures all the ways in which a class may be referenced via imports.
param:
imports all the imports from the source
param:
importPackages all the imported packages from the source
param:
source the reader source that contains source for the SourceUnit
param:
sourceUnit the source unit being compiled. Used for error messages.


 
Method Detail

visitMethodCallExpression

public void visitMethodCallExpression(MethodCallExpression call)
Attempts to find AstBuilder 'from code' invocations. When found, converts them into calls to the 'from string' approach.
param:
call the method call expression that may or may not be an AstBuilder 'from code' invocation.


 

Copyright © 2003-2009 The Codehaus. All rights reserved.