Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.groovy.classgen
Class AsmClassGenerator

    java.lang.Object
      org.codehaus.groovy.ast.CodeVisitorSupport
          org.codehaus.groovy.ast.ClassCodeVisitorSupport
              org.codehaus.groovy.classgen.ClassGenerator
                  org.codehaus.groovy.classgen.AsmClassGenerator

All Implemented Interfaces:
  GroovyClassVisitor, GroovyCodeVisitor, org.objectweb.asm.Opcodes

    public class AsmClassGenerator

extends ClassGenerator

Generates Java class versions of Groovy classes using ASM.

Version:
  $Revision: 13716 $
Author:
  James Strachan, Bing Ran, Jochen Theodorou, Alex Popescu

Field Summary
`static boolean` | `ASM_DEBUG`
`static boolean` | `CREATE_DEBUG_INFO`
`static boolean` | `CREATE_LINE_NUMBER_INFO`

Fields inherited from class org.codehaus.groovy.classgen.ClassGenerator
`asmJDKVersion, classLoader, innerClasses`

Fields inherited from interface org.objectweb.asm.Opcodes
`AALOAD, AASTORE, ACC_ABSTRACT, ACC_ANNOTATION, ACC_BRIDGE, ACC_DEPRECATED, ACC_ENUM, ACC_FINAL, ACC_INTERFACE, ACC_NATIVE, ACC_PRIVATE, ACC_PROTECTED, ACC_PUBLIC, ACC_STATIC, ACC_STRICT, ACC_SUPER, ACC_SYNCHRONIZED, ACC_SYNTHETIC, ACC_TRANSIENT, ACC_VARARGS, ACC_VOLATILE, ACONST_NULL, ALOAD, ANEWARRAY, ARETURN, ARRAYLENGTH, ASTORE, ATHROW, BALOAD, BASTORE, BIPUSH, CALOAD, CASTORE, CHECKCAST, D2F, D2I, D2L, DADD, DALOAD, DASTORE, DCMPG, DCMPL, DCONST_0, DCONST_1, DDIV, DLOAD, DMUL, DNEG, DREM, DRETURN, DSTORE, DSUB, DUP, DUP_X1, DUP_X2, DUP2, DUP2_X1, DUP2_X2, F2D, F2I, F2L, FADD, FALOAD, FASTORE, FCMPG, FCMPL, FCONST_0, FCONST_1, FCONST_2, FDIV, FLOAD, FMUL, FNEG, FREM, FRETURN, FSTORE, FSUB, GETFIELD, GETSTATIC, GOTO, I2B, I2C, I2D, I2F, I2L, I2S, IADD, IALOAD, IAND, IASTORE, ICONST_0, ICONST_1, ICONST_2, ICONST_3, ICONST_4, ICONST_5, ICONST_M1, IDIV, IF_ACMPEQ, IF_ACMPNE, IF_ICMPEQ, IF_ICMPGE, IF_ICMPGT, IF_ICMPLE, IF_ICMPLT, IF_ICMPNE, IFEQ, IFGE, IFGT, IFLE, IFLT, IFNE, IFNONNULL, IFNULL, IINC, ILOAD, IMUL, INEG, INSTANCEOF, INVOKEINTERFACE, INVOKESPECIAL, INVOKESTATIC, INVOKEVIRTUAL, IOR, IREM, IRETURN, ISHL, ISHR, ISTORE, ISUB, IUSHR, IXOR, JSR, L2D, L2F, L2I, LADD, LALOAD, LAND, LASTORE, LCMP, LCONST_0, LCONST_1, LDC, LDIV, LLOAD, LMUL, LNEG, LOOKUPSWITCH, LOR, LREM, LRETURN, LSHL, LSHR, LSTORE, LSUB, LUSHR, LXOR, MONITORENTER, MONITOREXIT, MULTIANEWARRAY, NEW, NEWARRAY, NOP, POP, POP2, PUTFIELD, PUTSTATIC, RET, RETURN, SALOAD, SASTORE, SIPUSH, SWAP, T_BOOLEAN, T_BYTE, T_CHAR, T_DOUBLE, T_FLOAT, T_INT, T_LONG, T_SHORT, TABLESWITCH, V1_1, V1_2, V1_3, V1_4, V1_5, V1_6`

Constructor Summary
`AsmClassGenerator(GeneratorContext context, org.objectweb.asm.ClassVisitor classVisitor, ClassLoader classLoader, String sourceFile)`

Method Summary
`protected boolean` | `addInnerClass(ClassNode innerClass)`
`protected static int` | `argumentSize(Expression arguments)`
`protected boolean` | `argumentsUseStack(Expression arguments)`
`protected static boolean` | `containsSpreadExpression(Expression arguments)`
`protected ClassNode` | `createClosureClass(ClosureExpression expression)`
`protected void` | `createInterfaceSyntheticStaticFields()`
`protected Expression` | `createReturnLHSExpression(Expression expression)` For assignment expressions, return a safe expression for the LHS we can use to return the value
`protected Expression` | `createReusableExpression(Expression expression)`
`protected void` | `createSyntheticStaticFields()`
`protected void` | `doConvertAndCast(ClassNode type)`
`protected void` | `doConvertAndCast(ClassNode type, boolean coerce)`
`protected void` | `doConvertAndCast(ClassNode type, Expression expression, boolean ignoreAutoboxing, boolean forceCast, boolean coerce)` Casts to the given type unless it can be determined that the cast is unnecessary
`protected boolean` | `emptyArguments(Expression arguments)`
`protected void` | `evaluateBinaryExpression(String method, BinaryExpression expression)`
`protected void` | `evaluateBinaryExpressionWithAssignment(String method, BinaryExpression expression)`
`protected void` | `evaluateCompareTo(BinaryExpression expression)`
`protected void` | `evaluateEqual(BinaryExpression expression)`
`protected void` | `evaluateExpression(Expression expression)`
`protected void` | `evaluateInstanceof(BinaryExpression expression)`
`protected void` | `evaluateLogicalAndExpression(BinaryExpression expression)`
`protected void` | `evaluateLogicalOrExpression(BinaryExpression expression)`
`protected void` | `evaluatePostfixMethod(String method, Expression expression)`
`protected void` | `evaluatePrefixMethod(String method, Expression expression)`
`protected int` | `getBytecodeVersion()`
`protected Parameter[]` | `getClosureSharedVariables(ClosureExpression ce)`
`protected CompileUnit` | `getCompileUnit()`
`protected ClassNode` | `getExpressionType(Expression expression)`
`protected ClassNode` | `getLHSType(Expression leftExpression)` Deduces the type name required for some casting
`static String` | `getMopMethodName(MethodNode method, boolean useThis)` creates a MOP method name from a method
`protected ClassNode` | `getOutermostClass()`
`protected SourceUnit` | `getSourceUnit()`
`protected boolean` | `isComparisonExpression(Expression expression)`
`protected boolean` | `isFieldOrVariable(String name)`
`protected boolean` | `isGroovyObject(Expression objectExpression)`
`protected boolean` | `isHolderVariable(Expression expression)`
`protected boolean` | `isInClosure()`
`protected boolean` | `isInClosureConstructor()`
`protected boolean` | `isInScriptBody()`
`static boolean` | `isMopMethod(String methodName)` method to determine if a method is a MOP method.
`protected boolean` | `isNonStaticField(Expression expression)`
`protected boolean` | `isPopRequired(Expression expression)`
`protected boolean` | `isStaticMethod()`
`protected boolean` | `isValidTypeForCast(ClassNode type)`
`void` | `loadInstanceField(FieldExpression fldExp)` RHS instance field. should move most of the code in the BytecodeHelper
`void` | `loadStaticField(FieldExpression fldExp)`
`protected void` | `loadThisOrOwner()` Loads either this object or if we're inside a closure then load the top level owner
`protected void` | `onLineNumber(ASTNode statement, String message)`
`protected void` | `processClassVariable(String name)`
`protected void` | `processFieldAccess(String name, FieldNode field, int steps)`
`protected void` | `processStackVariable(Variable variable)`
`void` | `storeStaticField(FieldExpression expression)`
`void` | `storeThisInstanceField(FieldExpression expression)`
`static boolean` | `usesSuper(MethodCallExpression call)`
`static boolean` | `usesSuper(PropertyExpression pe)`
`protected void` | `visitAndAutoboxBoolean(Expression expression)`
`void` | `visitAnnotations(AnnotatedNode node)` Note: ignore it.
`void` | `visitArgumentlistExpression(ArgumentListExpression ale)`
`void` | `visitArrayExpression(ArrayExpression expression)`
`void` | `visitAssertStatement(AssertStatement statement)`
`void` | `visitAttributeExpression(AttributeExpression expression)`
`void` | `visitBinaryExpression(BinaryExpression expression)`
`void` | `visitBitwiseNegationExpression(BitwiseNegationExpression expression)`
`void` | `visitBlockStatement(BlockStatement block)`
`void` | `visitBooleanExpression(BooleanExpression expression)` return a primitive boolean value of the BooleanExpresion.
`void` | `visitBreakStatement(BreakStatement statement)`
`void` | `visitBytecodeSequence(BytecodeSequence bytecodeSequence)`
`void` | `visitCaseStatement(CaseStatement statement)`
`void` | `visitCaseStatement(CaseStatement statement, int switchVariableIndex, org.objectweb.asm.Label thisLabel, org.objectweb.asm.Label nextLabel)`
`void` | `visitCastExpression(CastExpression expression)`
`void` | `visitClass(ClassNode classNode)`
`void` | `visitClassExpression(ClassExpression expression)` load class object on stack
`void` | `visitClosureExpression(ClosureExpression expression)`
`void` | `visitClosureListExpression(ClosureListExpression expression)`
`void` | `visitConstantExpression(ConstantExpression expression)` Generate byte code for constants
`void` | `visitConstructor(ConstructorNode node)`
`void` | `visitConstructorCallExpression(ConstructorCallExpression call)`
`protected void` | `visitConstructorOrMethod(MethodNode node, boolean isConstructor)`
`void` | `visitContinueStatement(ContinueStatement statement)`
`void` | `visitDeclarationExpression(DeclarationExpression expression)`
`void` | `visitDoWhileLoop(DoWhileStatement loop)`
`void` | `visitExpressionStatement(ExpressionStatement statement)`
`void` | `visitField(FieldNode fieldNode)`
`void` | `visitFieldExpression(FieldExpression expression)`
`void` | `visitForLoop(ForStatement loop)`
`void` | `visitGenericType(GenericsType genericsType)`
`void` | `visitGStringExpression(GStringExpression expression)`
`void` | `visitIfElse(IfStatement ifElse)`
`void` | `visitListExpression(ListExpression expression)`
`void` | `visitMapEntryExpression(MapEntryExpression expression)`
`void` | `visitMapExpression(MapExpression expression)`
`void` | `visitMethod(MethodNode node)`
`void` | `visitMethodCallExpression(MethodCallExpression call)`
`void` | `visitMethodPointerExpression(MethodPointerExpression expression)`
`void` | `visitNotExpression(NotExpression expression)`
`protected void` | `visitOuterFieldExpression(FieldExpression expression, ClassNode outerClassNode, int steps, boolean first)`
`void` | `visitPostfixExpression(PostfixExpression expression)`
`void` | `visitPrefixExpression(PrefixExpression expression)`
`void` | `visitProperty(PropertyNode statement)`
`void` | `visitPropertyExpression(PropertyExpression expression)`
`void` | `visitRangeExpression(RangeExpression expression)`
`void` | `visitRegexExpression(RegexExpression expression)`
`void` | `visitReturnStatement(ReturnStatement statement)`
`void` | `visitSpreadExpression(SpreadExpression expression)`
`void` | `visitSpreadMapExpression(SpreadMapExpression expression)`
`protected void` | `visitStatement(Statement statement)`
`void` | `visitStaticMethodCallExpression(StaticMethodCallExpression call)`
`void` | `visitSwitch(SwitchStatement statement)`
`void` | `visitSynchronizedStatement(SynchronizedStatement statement)`
`void` | `visitTernaryExpression(TernaryExpression expression)`
`void` | `visitThrowStatement(ThrowStatement statement)`
`void` | `visitTryCatchFinally(TryCatchStatement statement)`
`void` | `visitTupleExpression(TupleExpression expression)`
`void` | `visitUnaryMinusExpression(UnaryMinusExpression expression)`
`void` | `visitUnaryPlusExpression(UnaryPlusExpression expression)`
`void` | `visitVariableExpression(VariableExpression expression)` Visits a bare (unqualified) variable expression.
`void` | `visitWhileLoop(WhileStatement loop)`

Methods inherited from class org.codehaus.groovy.classgen.ClassGenerator
`getClassLoader, getInnerClasses`

Methods inherited from class org.codehaus.groovy.ast.ClassCodeVisitorSupport
`addError, visitCatchStatement, visitClassCodeContainer`

Methods inherited from class org.codehaus.groovy.ast.CodeVisitorSupport
`visitListOfExpressions, visitShortTernaryExpression`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### CREATE_DEBUG_INFO

    public static final boolean CREATE_DEBUG_INFO

See Also:
  Constant Field Values

### CREATE_LINE_NUMBER_INFO

    public static final boolean CREATE_LINE_NUMBER_INFO

See Also:
  Constant Field Values

### ASM_DEBUG

    public static final boolean ASM_DEBUG

See Also:
  Constant Field Values

Constructor Detail

### AsmClassGenerator

    public AsmClassGenerator(GeneratorContext context,
                             org.objectweb.asm.ClassVisitor classVisitor,
                             ClassLoader classLoader,
                             String sourceFile)

Method Detail

### getSourceUnit

    protected SourceUnit getSourceUnit()

  Overrides:
    `getSourceUnit` in class `ClassGenerator`

### visitClass

    public void visitClass(ClassNode classNode)

  Specified by:
    `visitClass` in interface `GroovyClassVisitor`
  Overrides:
    `visitClass` in class `ClassCodeVisitorSupport`

### visitGenericType

    public void visitGenericType(GenericsType genericsType)

### getMopMethodName

    public static String getMopMethodName(MethodNode method,
                                          boolean useThis)

  creates a MOP method name from a method

  Parameters:
    `method` - the method to be called by the mop method
    `useThis` - if true, then it is a call on "this", "super" else
  Returns:
    the mop method name

### isMopMethod

    public static boolean isMopMethod(String methodName)

  method to determine if a method is a MOP method. This is done by the method name. If the name starts with "this$" or "super$", then it is a MOP method

  Parameters:
    `methodName` - name of the method to test
  Returns:
    true if the method is a MOP method

### visitConstructorOrMethod

    protected void visitConstructorOrMethod(MethodNode node,
                                            boolean isConstructor)

  Overrides:
    `visitConstructorOrMethod` in class `ClassCodeVisitorSupport`

### visitConstructor

    public void visitConstructor(ConstructorNode node)

  Specified by:
    `visitConstructor` in interface `GroovyClassVisitor`
  Overrides:
    `visitConstructor` in class `ClassCodeVisitorSupport`

### visitMethod

    public void visitMethod(MethodNode node)

  Specified by:
    `visitMethod` in interface `GroovyClassVisitor`
  Overrides:
    `visitMethod` in class `ClassCodeVisitorSupport`

### visitField

    public void visitField(FieldNode fieldNode)

  Specified by:
    `visitField` in interface `GroovyClassVisitor`
  Overrides:
    `visitField` in class `ClassCodeVisitorSupport`

### visitProperty

    public void visitProperty(PropertyNode statement)

  Specified by:
    `visitProperty` in interface `GroovyClassVisitor`
  Overrides:
    `visitProperty` in class `ClassCodeVisitorSupport`

### visitStatement

    protected void visitStatement(Statement statement)

  Overrides:
    `visitStatement` in class `ClassCodeVisitorSupport`

### visitBlockStatement

    public void visitBlockStatement(BlockStatement block)

  Specified by:
    `visitBlockStatement` in interface `GroovyCodeVisitor`
  Overrides:
    `visitBlockStatement` in class `ClassCodeVisitorSupport`

### visitForLoop

    public void visitForLoop(ForStatement loop)

  Specified by:
    `visitForLoop` in interface `GroovyCodeVisitor`
  Overrides:
    `visitForLoop` in class `ClassCodeVisitorSupport`

### visitWhileLoop

    public void visitWhileLoop(WhileStatement loop)

  Specified by:
    `visitWhileLoop` in interface `GroovyCodeVisitor`
  Overrides:
    `visitWhileLoop` in class `ClassCodeVisitorSupport`

### visitDoWhileLoop

    public void visitDoWhileLoop(DoWhileStatement loop)

  Specified by:
    `visitDoWhileLoop` in interface `GroovyCodeVisitor`
  Overrides:
    `visitDoWhileLoop` in class `ClassCodeVisitorSupport`

### visitIfElse

    public void visitIfElse(IfStatement ifElse)

  Specified by:
    `visitIfElse` in interface `GroovyCodeVisitor`
  Overrides:
    `visitIfElse` in class `ClassCodeVisitorSupport`

### visitTernaryExpression

    public void visitTernaryExpression(TernaryExpression expression)

  Specified by:
    `visitTernaryExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitTernaryExpression` in class `CodeVisitorSupport`

### visitAssertStatement

    public void visitAssertStatement(AssertStatement statement)

  Specified by:
    `visitAssertStatement` in interface `GroovyCodeVisitor`
  Overrides:
    `visitAssertStatement` in class `ClassCodeVisitorSupport`

### visitTryCatchFinally

    public void visitTryCatchFinally(TryCatchStatement statement)

  Specified by:
    `visitTryCatchFinally` in interface `GroovyCodeVisitor`
  Overrides:
    `visitTryCatchFinally` in class `ClassCodeVisitorSupport`

### visitSwitch

    public void visitSwitch(SwitchStatement statement)

  Specified by:
    `visitSwitch` in interface `GroovyCodeVisitor`
  Overrides:
    `visitSwitch` in class `ClassCodeVisitorSupport`

### visitCaseStatement

    public void visitCaseStatement(CaseStatement statement)

  Specified by:
    `visitCaseStatement` in interface `GroovyCodeVisitor`
  Overrides:
    `visitCaseStatement` in class `ClassCodeVisitorSupport`

### visitCaseStatement

    public void visitCaseStatement(CaseStatement statement,
                                   int switchVariableIndex,
                                   org.objectweb.asm.Label thisLabel,
                                   org.objectweb.asm.Label nextLabel)

### visitBreakStatement

    public void visitBreakStatement(BreakStatement statement)

  Specified by:
    `visitBreakStatement` in interface `GroovyCodeVisitor`
  Overrides:
    `visitBreakStatement` in class `ClassCodeVisitorSupport`

### visitContinueStatement

    public void visitContinueStatement(ContinueStatement statement)

  Specified by:
    `visitContinueStatement` in interface `GroovyCodeVisitor`
  Overrides:
    `visitContinueStatement` in class `ClassCodeVisitorSupport`

### visitSynchronizedStatement

    public void visitSynchronizedStatement(SynchronizedStatement statement)

  Specified by:
    `visitSynchronizedStatement` in interface `GroovyCodeVisitor`
  Overrides:
    `visitSynchronizedStatement` in class `ClassCodeVisitorSupport`

### visitThrowStatement

    public void visitThrowStatement(ThrowStatement statement)

  Specified by:
    `visitThrowStatement` in interface `GroovyCodeVisitor`
  Overrides:
    `visitThrowStatement` in class `ClassCodeVisitorSupport`

### visitReturnStatement

    public void visitReturnStatement(ReturnStatement statement)

  Specified by:
    `visitReturnStatement` in interface `GroovyCodeVisitor`
  Overrides:
    `visitReturnStatement` in class `ClassCodeVisitorSupport`

### doConvertAndCast

    protected void doConvertAndCast(ClassNode type,
                                    Expression expression,
                                    boolean ignoreAutoboxing,
                                    boolean forceCast,
                                    boolean coerce)

  Casts to the given type unless it can be determined that the cast is unnecessary

### evaluateExpression

    protected void evaluateExpression(Expression expression)

  Parameters:
    `expression` -

### visitExpressionStatement

    public void visitExpressionStatement(ExpressionStatement statement)

  Specified by:
    `visitExpressionStatement` in interface `GroovyCodeVisitor`
  Overrides:
    `visitExpressionStatement` in class `ClassCodeVisitorSupport`

### visitDeclarationExpression

    public void visitDeclarationExpression(DeclarationExpression expression)

  Specified by:
    `visitDeclarationExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitDeclarationExpression` in class `CodeVisitorSupport`

### visitBinaryExpression

    public void visitBinaryExpression(BinaryExpression expression)

  Specified by:
    `visitBinaryExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitBinaryExpression` in class `CodeVisitorSupport`

### visitPostfixExpression

    public void visitPostfixExpression(PostfixExpression expression)

  Specified by:
    `visitPostfixExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitPostfixExpression` in class `CodeVisitorSupport`

### visitPrefixExpression

    public void visitPrefixExpression(PrefixExpression expression)

  Specified by:
    `visitPrefixExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitPrefixExpression` in class `CodeVisitorSupport`

### visitClosureExpression

    public void visitClosureExpression(ClosureExpression expression)

  Specified by:
    `visitClosureExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitClosureExpression` in class `CodeVisitorSupport`

### loadThisOrOwner

    protected void loadThisOrOwner()

  Loads either this object or if we're inside a closure then load the top level owner

### visitRegexExpression

    public void visitRegexExpression(RegexExpression expression)

  Specified by:
    `visitRegexExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitRegexExpression` in class `CodeVisitorSupport`

### visitConstantExpression

    public void visitConstantExpression(ConstantExpression expression)

  Generate byte code for constants

  Specified by:
    `visitConstantExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitConstantExpression` in class `CodeVisitorSupport`
  See Also:
    Class field types

### visitSpreadExpression

    public void visitSpreadExpression(SpreadExpression expression)

  Specified by:
    `visitSpreadExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitSpreadExpression` in class `CodeVisitorSupport`

### visitSpreadMapExpression

    public void visitSpreadMapExpression(SpreadMapExpression expression)

  Specified by:
    `visitSpreadMapExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitSpreadMapExpression` in class `CodeVisitorSupport`

### visitMethodPointerExpression

    public void visitMethodPointerExpression(MethodPointerExpression expression)

  Specified by:
    `visitMethodPointerExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitMethodPointerExpression` in class `CodeVisitorSupport`

### visitUnaryMinusExpression

    public void visitUnaryMinusExpression(UnaryMinusExpression expression)

  Specified by:
    `visitUnaryMinusExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitUnaryMinusExpression` in class `CodeVisitorSupport`

### visitUnaryPlusExpression

    public void visitUnaryPlusExpression(UnaryPlusExpression expression)

  Specified by:
    `visitUnaryPlusExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitUnaryPlusExpression` in class `CodeVisitorSupport`

### visitBitwiseNegationExpression

    public void visitBitwiseNegationExpression(BitwiseNegationExpression expression)

  Specified by:
    `visitBitwiseNegationExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitBitwiseNegationExpression` in class `CodeVisitorSupport`

### visitCastExpression

    public void visitCastExpression(CastExpression expression)

  Specified by:
    `visitCastExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitCastExpression` in class `CodeVisitorSupport`

### visitNotExpression

    public void visitNotExpression(NotExpression expression)

  Specified by:
    `visitNotExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitNotExpression` in class `CodeVisitorSupport`

### visitBooleanExpression

    public void visitBooleanExpression(BooleanExpression expression)

  return a primitive boolean value of the BooleanExpresion.

  Specified by:
    `visitBooleanExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitBooleanExpression` in class `CodeVisitorSupport`
  Parameters:
    `expression` -

### visitMethodCallExpression

    public void visitMethodCallExpression(MethodCallExpression call)

  Specified by:
    `visitMethodCallExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitMethodCallExpression` in class `CodeVisitorSupport`

### emptyArguments

    protected boolean emptyArguments(Expression arguments)

### containsSpreadExpression

    protected static boolean containsSpreadExpression(Expression arguments)

### argumentSize

    protected static int argumentSize(Expression arguments)

### visitStaticMethodCallExpression

    public void visitStaticMethodCallExpression(StaticMethodCallExpression call)

  Specified by:
    `visitStaticMethodCallExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitStaticMethodCallExpression` in class `CodeVisitorSupport`

### visitConstructorCallExpression

    public void visitConstructorCallExpression(ConstructorCallExpression call)

  Specified by:
    `visitConstructorCallExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitConstructorCallExpression` in class `CodeVisitorSupport`

### visitPropertyExpression

    public void visitPropertyExpression(PropertyExpression expression)

  Specified by:
    `visitPropertyExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitPropertyExpression` in class `CodeVisitorSupport`

### visitAttributeExpression

    public void visitAttributeExpression(AttributeExpression expression)

  Specified by:
    `visitAttributeExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitAttributeExpression` in class `CodeVisitorSupport`

### isGroovyObject

    protected boolean isGroovyObject(Expression objectExpression)

### visitFieldExpression

    public void visitFieldExpression(FieldExpression expression)

  Specified by:
    `visitFieldExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitFieldExpression` in class `CodeVisitorSupport`

### loadStaticField

    public void loadStaticField(FieldExpression fldExp)

  Parameters:
    `fldExp` -

### loadInstanceField

    public void loadInstanceField(FieldExpression fldExp)

  RHS instance field. should move most of the code in the BytecodeHelper

  Parameters:
    `fldExp` -

### storeThisInstanceField

    public void storeThisInstanceField(FieldExpression expression)

### storeStaticField

    public void storeStaticField(FieldExpression expression)

### visitOuterFieldExpression

    protected void visitOuterFieldExpression(FieldExpression expression,
                                             ClassNode outerClassNode,
                                             int steps,
                                             boolean first)

### visitVariableExpression

    public void visitVariableExpression(VariableExpression expression)

  Visits a bare (unqualified) variable expression.

  Specified by:
    `visitVariableExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitVariableExpression` in class `CodeVisitorSupport`

### processStackVariable

    protected void processStackVariable(Variable variable)

### processClassVariable

    protected void processClassVariable(String name)

### processFieldAccess

    protected void processFieldAccess(String name,
                                      FieldNode field,
                                      int steps)

### isInScriptBody

    protected boolean isInScriptBody()

  Returns:
    true if we are in a script body, where all variables declared are no longer local variables but are properties

### isPopRequired

    protected boolean isPopRequired(Expression expression)

  Returns:
    true if this expression will have left a value on the stack that must be popped

### createInterfaceSyntheticStaticFields

    protected void createInterfaceSyntheticStaticFields()

### createSyntheticStaticFields

    protected void createSyntheticStaticFields()

### visitClassExpression

    public void visitClassExpression(ClassExpression expression)

  load class object on stack

  Specified by:
    `visitClassExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitClassExpression` in class `CodeVisitorSupport`

### visitRangeExpression

    public void visitRangeExpression(RangeExpression expression)

  Specified by:
    `visitRangeExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitRangeExpression` in class `CodeVisitorSupport`

### visitMapEntryExpression

    public void visitMapEntryExpression(MapEntryExpression expression)

  Specified by:
    `visitMapEntryExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitMapEntryExpression` in class `CodeVisitorSupport`

### visitMapExpression

    public void visitMapExpression(MapExpression expression)

  Specified by:
    `visitMapExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitMapExpression` in class `CodeVisitorSupport`

### visitArgumentlistExpression

    public void visitArgumentlistExpression(ArgumentListExpression ale)

  Specified by:
    `visitArgumentlistExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitArgumentlistExpression` in class `CodeVisitorSupport`

### visitTupleExpression

    public void visitTupleExpression(TupleExpression expression)

  Specified by:
    `visitTupleExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitTupleExpression` in class `CodeVisitorSupport`

### visitArrayExpression

    public void visitArrayExpression(ArrayExpression expression)

  Specified by:
    `visitArrayExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitArrayExpression` in class `CodeVisitorSupport`

### visitClosureListExpression

    public void visitClosureListExpression(ClosureListExpression expression)

  Specified by:
    `visitClosureListExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitClosureListExpression` in class `CodeVisitorSupport`

### visitBytecodeSequence

    public void visitBytecodeSequence(BytecodeSequence bytecodeSequence)

  Overrides:
    `visitBytecodeSequence` in class `ClassGenerator`

### visitListExpression

    public void visitListExpression(ListExpression expression)

  Specified by:
    `visitListExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitListExpression` in class `CodeVisitorSupport`

### visitGStringExpression

    public void visitGStringExpression(GStringExpression expression)

  Specified by:
    `visitGStringExpression` in interface `GroovyCodeVisitor`
  Overrides:
    `visitGStringExpression` in class `CodeVisitorSupport`

### visitAnnotations

    public void visitAnnotations(AnnotatedNode node)

  Note: ignore it. Annotation generation needs the current visitor.

  Overrides:
    `visitAnnotations` in class `ClassCodeVisitorSupport`

### addInnerClass

    protected boolean addInnerClass(ClassNode innerClass)

### createClosureClass

    protected ClassNode createClosureClass(ClosureExpression expression)

### getClosureSharedVariables

    protected Parameter[] getClosureSharedVariables(ClosureExpression ce)

### getOutermostClass

    protected ClassNode getOutermostClass()

### doConvertAndCast

    protected void doConvertAndCast(ClassNode type)

### doConvertAndCast

    protected void doConvertAndCast(ClassNode type,
                                    boolean coerce)

### evaluateLogicalOrExpression

    protected void evaluateLogicalOrExpression(BinaryExpression expression)

### evaluateLogicalAndExpression

    protected void evaluateLogicalAndExpression(BinaryExpression expression)

### evaluateBinaryExpression

    protected void evaluateBinaryExpression(String method,
                                            BinaryExpression expression)

### evaluateCompareTo

    protected void evaluateCompareTo(BinaryExpression expression)

### evaluateBinaryExpressionWithAssignment

    protected void evaluateBinaryExpressionWithAssignment(String method,
                                                          BinaryExpression expression)

### evaluateEqual

    protected void evaluateEqual(BinaryExpression expression)

### getLHSType

    protected ClassNode getLHSType(Expression leftExpression)

  Deduces the type name required for some casting

  Returns:
    the type of the given (LHS) expression or null if it is java.lang.Object or it cannot be deduced

### isValidTypeForCast

    protected boolean isValidTypeForCast(ClassNode type)

### visitAndAutoboxBoolean

    protected void visitAndAutoboxBoolean(Expression expression)

### evaluatePrefixMethod

    protected void evaluatePrefixMethod(String method,
                                        Expression expression)

### evaluatePostfixMethod

    protected void evaluatePostfixMethod(String method,
                                         Expression expression)

### evaluateInstanceof

    protected void evaluateInstanceof(BinaryExpression expression)

### argumentsUseStack

    protected boolean argumentsUseStack(Expression arguments)

  Returns:
    true if the given argument expression requires the stack, in which case the arguments are evaluated first, stored in the variable stack and then reloaded to make a method call

### isNonStaticField

    protected boolean isNonStaticField(Expression expression)

  Returns:
    true if the given expression represents a non-static field

### createReturnLHSExpression

    protected Expression createReturnLHSExpression(Expression expression)

  For assignment expressions, return a safe expression for the LHS we can use to return the value

### createReusableExpression

    protected Expression createReusableExpression(Expression expression)

### isComparisonExpression

    protected boolean isComparisonExpression(Expression expression)

### onLineNumber

    protected void onLineNumber(ASTNode statement,
                                String message)

### isFieldOrVariable

    protected boolean isFieldOrVariable(String name)

  Returns:
    true if the given name is a local variable or a field

### getExpressionType

    protected ClassNode getExpressionType(Expression expression)

  Returns:
    if the type of the expression can be determined at compile time then this method returns the type - otherwise null

### isInClosureConstructor

    protected boolean isInClosureConstructor()

### isInClosure

    protected boolean isInClosure()

### isStaticMethod

    protected boolean isStaticMethod()

### getCompileUnit

    protected CompileUnit getCompileUnit()

### isHolderVariable

    protected boolean isHolderVariable(Expression expression)

### usesSuper

    public static boolean usesSuper(MethodCallExpression call)

### usesSuper

    public static boolean usesSuper(PropertyExpression pe)

### getBytecodeVersion

    protected int getBytecodeVersion()

Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2003-2008 The Codehaus. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD