Package org.codehaus.groovy.classgen.asm.sc

# Class StaticTypesBinaryExpressionMultiTypeDispatcher

java.lang.Object
org.codehaus.groovy.classgen.asm.BinaryExpressionHelper
org.codehaus.groovy.classgen.asm.BinaryExpressionMultiTypeDispatcher
org.codehaus.groovy.classgen.asm.sc.StaticTypesBinaryExpressionMultiTypeDispatcher

Direct Known Subclasses:
  `IndyStaticTypesMultiTypeDispatcher`

public class StaticTypesBinaryExpressionMultiTypeDispatcher extends BinaryExpressionMultiTypeDispatcher
A specialized version of the multi type binary expression dispatcher which is aware of static compilation. It is able to generate optimized bytecode for some operations using JVM instructions when available.

- ## Field Summary

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

  `binExpWriter, typeMap, typeMapKeyNames`

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

  `controller`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StaticTypesBinaryExpressionMultiTypeDispatcher(WriterController wc)`
  Creates a binary-expression dispatcher for statically compiled bytecode generation.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected void`
  `assignToArray(Expression enclosing, Expression receiver, Expression subscript, Expression rhsValueLoader, boolean safe)`
  Emits an array-style assignment using the dynamic `putAt` protocol.
  `protected void`
  `evaluateBinaryExpressionWithAssignment(String method, BinaryExpression expression)`
  Evaluates an operator-assignment expression such as `+=`.
  `protected void`
  `evaluateCompoundAssign(String assignName, String baseName, BinaryExpression expression)`
  GEP-15: dynamic-mode compound-assign codegen.
  `void`
  `evaluateEqual(BinaryExpression expression, boolean defineVariable)`
  Evaluates an assignment expression.
  `protected void`
  `writePostOrPrefixMethod(int op, String method, Expression expression, Expression orig)`
  Emits the method call used to implement a prefix or postfix operation.

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

  `doPrimitiveCompare, doPrimtiveCompare, evaluateBinaryExpression, evaluateCompareExpression, getOperandType, initializeDelegateHelpers`

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

  `eval, evaluateArrayAssignmentWithOperator, evaluateElvisEqual, evaluatePostfixMethod, evaluatePrefixMethod, evaluateTernary, getController, getIsCaseMethod`

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

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

- ## Constructor Details

  - ### StaticTypesBinaryExpressionMultiTypeDispatcher

    public StaticTypesBinaryExpressionMultiTypeDispatcher(WriterController wc)
    Creates a binary-expression dispatcher for statically compiled bytecode generation.

- ## Method Details

  - ### writePostOrPrefixMethod

    protected void writePostOrPrefixMethod(int op, String method, Expression expression, Expression orig)
    Emits the method call used to implement a prefix or postfix operation.
    Overrides:
      `writePostOrPrefixMethod` in class `BinaryExpressionMultiTypeDispatcher`
    Parameters:
      `op` - the token type
      `method` - the helper method name
      `expression` - the receiver expression
      `orig` - the original prefix/postfix expression

  - ### evaluateBinaryExpressionWithAssignment

    protected void evaluateBinaryExpressionWithAssignment(String method, BinaryExpression expression)
    Evaluates an operator-assignment expression such as `+=`.
    Overrides:
      `evaluateBinaryExpressionWithAssignment` in class `BinaryExpressionMultiTypeDispatcher`
    Parameters:
      `method` - the operator method name
      `expression` - the assignment expression

  - ### evaluateCompoundAssign

    protected void evaluateCompoundAssign(String assignName, String baseName, BinaryExpression expression)
    GEP-15: dynamic-mode compound-assign codegen. Routes through `ScriptBytecodeAdapter.compoundAssign(Object, Object, String, String)` which dispatches to `assignName` when the receiver responds to it, and falls back to `baseName` otherwise. The caller stores the helper's return value into the LHS — for the in-place branch this is a no-op store of the receiver back to itself; for the fallback branch it is the usual "x = x.op(y)" assignment.
    Overrides:
      `evaluateCompoundAssign` in class `BinaryExpressionMultiTypeDispatcher`

  - ### evaluateEqual

    public void evaluateEqual(BinaryExpression expression, boolean defineVariable)
    Evaluates an assignment expression.
    Overrides:
      `evaluateEqual` in class `BinaryExpressionHelper`
    Parameters:
      `expression` - the assignment expression
      `defineVariable` - whether the left-hand side declares a new variable

  - ### assignToArray

    protected void assignToArray(Expression enclosing, Expression receiver, Expression subscript, Expression rhsValueLoader, boolean safe)
    Emits an array-style assignment using the dynamic `putAt` protocol.
    Overrides:
      `assignToArray` in class `BinaryExpressionMultiTypeDispatcher`
    Parameters:
      `enclosing` - the original assignment expression
      `receiver` - the array or indexable receiver
      `subscript` - the subscript expression
      `rhsValueLoader` - an expression that reloads the right-hand value
      `safe` - whether the receiver access is null-safe