Package org.codehaus.groovy.classgen.asm

# Class BinaryObjectExpressionHelper

java.lang.Object
org.codehaus.groovy.classgen.asm.BinaryExpressionWriter
org.codehaus.groovy.classgen.asm.BinaryObjectExpressionHelper

public class BinaryObjectExpressionHelper extends BinaryExpressionWriter
Binary expression helper used for object operations that fall back to dynamic dispatch.

- ## Field Summary

  ### Fields inherited from class org.codehaus.groovy.classgen.asm.BinaryExpressionWriter

  `stdCompareCodes`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BinaryObjectExpressionHelper(WriterController controller)`
  Creates an object-specialized binary expression helper.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `doubleTwoOperands(org.objectweb.asm.MethodVisitor mv)`
  Duplicates the two operands already on the operand stack.
  `protected ClassNode`
  `getArrayGetResultType()`
  `protected int`
  `getBitwiseOperationBytecode(int type)`
  Returns the bitwise opcode for the supplied token.
  `protected int`
  `getCompareCode()`
  `protected ClassNode`
  `getDevisionOpResultType()`
  `protected ClassNode`
  `getNormalOpResultType()`
  `protected int`
  `getShiftOperationBytecode(int type)`
  Returns the shift opcode for the supplied token.
  `protected int`
  `getStandardOperationBytecode(int type)`
  Returns the arithmetic opcode for the supplied token.
  `protected void`
  `removeTwoOperands(org.objectweb.asm.MethodVisitor mv)`
  Removes the two operands already on the operand stack.
  `boolean`
  `write(int operation, boolean simulate)`
  Attempts to write the supplied binary operation.
  `protected boolean`
  `writeDivision(boolean simulate)`
  Writes a division operation for the current primitive type.
  `protected void`
  `writeMinusMinus(org.objectweb.asm.MethodVisitor mv)`
  Emits a prefix/postfix decrement.
  `protected void`
  `writePlusPlus(org.objectweb.asm.MethodVisitor mv)`
  Emits a prefix/postfix increment.
  `boolean`
  `writePostOrPrefixMethod(int operation, boolean simulate)`
  Attempts to write a postfix or prefix increment/decrement operation.

  ### Methods inherited from class org.codehaus.groovy.classgen.asm.BinaryExpressionWriter

  `arrayGet, arraySet, getArrayGetCaller, getArraySetCaller, getController, setArraySetAndGet, supportsDivision, writeBitwiseOp, writeShiftOp, writeSpaceship, writeStdCompare, writeStdOperators`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BinaryObjectExpressionHelper

    public BinaryObjectExpressionHelper(WriterController controller)
    Creates an object-specialized binary expression helper.
    Parameters:
      `controller` - the active writer controller

- ## Method Details

  - ### writePostOrPrefixMethod

    public boolean writePostOrPrefixMethod(int operation, boolean simulate)
    Attempts to write a postfix or prefix increment/decrement operation.
    Overrides:
      `writePostOrPrefixMethod` in class `BinaryExpressionWriter`
    Parameters:
      `operation` - the token type
      `simulate` - whether to probe support without emitting bytecode
    Returns:
      `true` if the operation is supported

  - ### write

    public boolean write(int operation, boolean simulate)
    Attempts to write the supplied binary operation.
    Overrides:
      `write` in class `BinaryExpressionWriter`
    Parameters:
      `operation` - the token type
      `simulate` - whether to probe support without emitting bytecode
    Returns:
      `true` if the operation is supported

  - ### writeDivision

    protected boolean writeDivision(boolean simulate)
    Writes a division operation for the current primitive type.
    Overrides:
      `writeDivision` in class `BinaryExpressionWriter`
    Parameters:
      `simulate` - whether to probe support without emitting bytecode
    Returns:
      `true` if division is supported

  - ### getBitwiseOperationBytecode

    protected int getBitwiseOperationBytecode(int type)
    Returns the bitwise opcode for the supplied token.
    Specified by:
      `getBitwiseOperationBytecode` in class `BinaryExpressionWriter`
    Parameters:
      `type` - the normalized token index
    Returns:
      the ASM opcode

  - ### getCompareCode

    protected int getCompareCode()
    Specified by:
      `getCompareCode` in class `BinaryExpressionWriter`
    Returns:
      the ASM compare opcode used by this primitive type

  - ### getNormalOpResultType

    protected ClassNode getNormalOpResultType()
    Specified by:
      `getNormalOpResultType` in class `BinaryExpressionWriter`
    Returns:
      the result type for normal arithmetic operations

  - ### getDevisionOpResultType

    protected ClassNode getDevisionOpResultType()
    Specified by:
      `getDevisionOpResultType` in class `BinaryExpressionWriter`
    Returns:
      the result type for division operations

  - ### getShiftOperationBytecode

    protected int getShiftOperationBytecode(int type)
    Returns the shift opcode for the supplied token.
    Specified by:
      `getShiftOperationBytecode` in class `BinaryExpressionWriter`
    Parameters:
      `type` - the normalized token index
    Returns:
      the ASM opcode

  - ### getStandardOperationBytecode

    protected int getStandardOperationBytecode(int type)
    Returns the arithmetic opcode for the supplied token.
    Specified by:
      `getStandardOperationBytecode` in class `BinaryExpressionWriter`
    Parameters:
      `type` - the normalized token index
    Returns:
      the ASM opcode

  - ### removeTwoOperands

    protected void removeTwoOperands(org.objectweb.asm.MethodVisitor mv)
    Removes the two operands already on the operand stack.
    Specified by:
      `removeTwoOperands` in class `BinaryExpressionWriter`
    Parameters:
      `mv` - the current method visitor

  - ### writePlusPlus

    protected void writePlusPlus(org.objectweb.asm.MethodVisitor mv)
    Emits a prefix/postfix increment.
    Specified by:
      `writePlusPlus` in class `BinaryExpressionWriter`
    Parameters:
      `mv` - the current method visitor

  - ### writeMinusMinus

    protected void writeMinusMinus(org.objectweb.asm.MethodVisitor mv)
    Emits a prefix/postfix decrement.
    Specified by:
      `writeMinusMinus` in class `BinaryExpressionWriter`
    Parameters:
      `mv` - the current method visitor

  - ### doubleTwoOperands

    protected void doubleTwoOperands(org.objectweb.asm.MethodVisitor mv)
    Duplicates the two operands already on the operand stack.
    Specified by:
      `doubleTwoOperands` in class `BinaryExpressionWriter`
    Parameters:
      `mv` - the current method visitor

  - ### getArrayGetResultType

    protected ClassNode getArrayGetResultType()
    Overrides:
      `getArrayGetResultType` in class `BinaryExpressionWriter`
    Returns:
      the result type produced by `BinaryExpressionWriter.getArrayGetCaller()`