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

## [Java] Class StaticTypesBinaryExpressionMultiTypeDispatcher

- org.codehaus.groovy.classgen.asm.sc.StaticTypesBinaryExpressionMultiTypeDispatcher

-     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.

- - Inherited fields
    Fields inherited from class | Fields
    --- | ---
    `class BinaryExpressionMultiTypeDispatcher` | `binExpWriter, typeMap, typeMapKeyNames`
    `class BinaryExpressionHelper` | `controller`

  - ### Constructor Summary

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

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected void` | `assignToArray(Expression enclosing, Expression receiver, Expression subscript, Expression rhsValueLoader, boolean safe)` * * Emits an array-style assignment using the dynamic `putAt` protocol. * * Parameters: `parent` - the original assignment expression * `receiver` - the array or indexable receiver * `index` - the subscript expression * `rhsValueLoader` - an expression that reloads the right-hand value * `safe` - whether the receiver access is null-safe
    `` | `protected void` | `evaluateBinaryExpressionWithAssignment(String method, BinaryExpression expression)` * * Evaluates an operator-assignment expression such as `+=`. * * Parameters: `method` - the operator method name * `expression` - the assignment expression
    `` | `protected void` | `evaluateCompoundAssign(String assignName, String baseName, BinaryExpression expression)` * * GEP-15: dynamic-mode compound-assign codegen. Routes through * ScriptBytecodeAdapter.compoundAssign * 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.
    `` | `public void` | `evaluateEqual(BinaryExpression expression, boolean defineVariable)` * Evaluates an assignment expression. * * Parameters: `expression` - the assignment expression * `defineVariable` - whether the left-hand side declares a new variable
    `` | `protected void` | `writePostOrPrefixMethod(int op, String method, Expression expression, Expression orig)` * * Emits the method call used to implement a prefix or postfix operation. * * Parameters: `op` - the token type * `method` - the helper method name * `expression` - the receiver expression * `orig` - the original prefix/postfix expression

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class BinaryExpressionMultiTypeDispatcher` | `assignToArray, doPrimitiveCompare, doPrimtiveCompare, evaluateBinaryExpression, evaluateBinaryExpressionWithAssignment, evaluateCompareExpression, evaluateCompoundAssign, getOperandType, initializeDelegateHelpers, writePostOrPrefixMethod`
    `class BinaryExpressionHelper` | `assignToArray, eval, evaluateArrayAssignmentWithOperator, evaluateBinaryExpression, evaluateBinaryExpressionWithAssignment, evaluateCompareExpression, evaluateCompoundAssign, evaluateElvisEqual, evaluateEqual, evaluatePostfixMethod, evaluatePrefixMethod, evaluateTernary, getController, getIsCaseMethod, writePostOrPrefixMethod`

- - ### Constructor Detail

    - #### public StaticTypesBinaryExpressionMultiTypeDispatcher(WriterController wc)

      Creates a binary-expression dispatcher for statically compiled bytecode generation.

  - ### Method Detail

    - #### protected void assignToArray(Expression enclosing, Expression receiver, Expression subscript, Expression rhsValueLoader, boolean safe)

      * * Emits an array-style assignment using the dynamic `putAt` protocol. * *

      Parameters:
        `parent` - the original assignment expression *
        `receiver` - the array or indexable receiver *
        `index` - the subscript expression *
        `rhsValueLoader` - an expression that reloads the right-hand value *
        `safe` - whether the receiver access is null-safe

    - #### protected void evaluateBinaryExpressionWithAssignment(String method, BinaryExpression expression)

      * * Evaluates an operator-assignment expression such as `+=`. * *

      Parameters:
        `method` - the operator method name *
        `expression` - the assignment expression

    - #### protected void evaluateCompoundAssign(String assignName, String baseName, BinaryExpression expression)

      * * GEP-15: dynamic-mode compound-assign codegen. Routes through * ScriptBytecodeAdapter.compoundAssign * 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.

    - #### public void evaluateEqual(BinaryExpression expression, boolean defineVariable)

      * Evaluates an assignment expression. * *

      Parameters:
        `expression` - the assignment expression *
        `defineVariable` - whether the left-hand side declares a new variable

    - #### protected void writePostOrPrefixMethod(int op, String method, Expression expression, Expression orig)

      * * Emits the method call used to implement a prefix or postfix operation. * *

      Parameters:
        `op` - the token type *
        `method` - the helper method name *
        `expression` - the receiver expression *
        `orig` - the original prefix/postfix expression