public class BinaryExpressionMultiTypeDispatcher
extends BinaryExpressionHelper
This class is for internal use only! This class will dispatch to the right type adapters according to the kind of binary expression that is provided.
| Modifiers | Name | Description |
|---|---|---|
protected BinaryExpressionWriter[] |
binExpWriter |
Per-type helpers used to emit primitive binary operations. |
static Map<ClassNode, Integer> |
typeMap |
Maps primitive operand types to helper indexes. |
static String[] |
typeMapKeyNames |
Human-readable names for the indexes used by typeMap. |
| Fields inherited from class | Fields |
|---|---|
class BinaryExpressionHelper |
controller |
| Constructor and description |
|---|
BinaryExpressionMultiTypeDispatcher(WriterController wc)Creates a dispatcher that routes primitive binary expressions to type-specific helpers. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
assignToArray(Expression orig, Expression receiver, Expression index, Expression rhsValueLoader, boolean safe)* Emits an array-style assignment using the dynamic putAt protocol.
*
*
|
|
protected boolean |
doPrimitiveCompare(ClassNode leftType, ClassNode rightType, BinaryExpression binExp)Attempts primitive comparison bytecode generation for the supplied operands. |
|
protected boolean |
doPrimtiveCompare(ClassNode leftType, ClassNode rightType, BinaryExpression binExp)Delegates to doPrimitiveCompare(ClassNode, ClassNode, BinaryExpression). |
|
protected void |
evaluateBinaryExpression(String message, BinaryExpression binExp)* Evaluates a dynamic binary operator by invoking the named helper method. * *
|
|
protected void |
evaluateBinaryExpressionWithAssignment(String method, BinaryExpression binExp)* Evaluates an operator-assignment expression such as +=.
*
*
|
|
protected void |
evaluateCompareExpression(MethodCaller compareMethod, BinaryExpression binExp)* Evaluates a comparison expression, using primitive helpers when possible. * *
|
|
protected void |
evaluateCompoundAssign(String assignName, String baseName, BinaryExpression binExp)* 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.
|
|
protected int |
getOperandType(ClassNode type)Returns the helper index for the supplied operand type. |
|
protected BinaryExpressionWriter[] |
initializeDelegateHelpers()Creates the helper table used for primitive binary-expression dispatch. |
|
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 | Name |
|---|---|
class BinaryExpressionHelper |
assignToArray, eval, evaluateArrayAssignmentWithOperator, evaluateBinaryExpression, evaluateBinaryExpressionWithAssignment, evaluateCompareExpression, evaluateCompoundAssign, evaluateElvisEqual, evaluateEqual, evaluatePostfixMethod, evaluatePrefixMethod, evaluateTernary, getController, getIsCaseMethod, writePostOrPrefixMethod |
Per-type helpers used to emit primitive binary operations.
Creates a dispatcher that routes primitive binary expressions to type-specific helpers.
wc - the active writer controller
* Emits an array-style assignment using the dynamic putAt protocol.
*
*
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-safeAttempts primitive comparison bytecode generation for the supplied operands.
leftType - the left operand typerightType - the right operand typebinExp - the comparison expressiontrue if a primitive-specialized implementation handled the comparisonDelegates to doPrimitiveCompare(ClassNode, ClassNode, BinaryExpression).
* Evaluates a dynamic binary operator by invoking the named helper method. * *
message - the operator method name
*expression - the expression to compile
* Evaluates an operator-assignment expression such as +=.
*
*
method - the operator method name
*expression - the assignment expression* Evaluates a comparison expression, using primitive helpers when possible. * *
compareMethod - the dynamic comparison helper
*expression - the comparison 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.
Returns the helper index for the supplied operand type.
type - the operand type0 when no primitive specialization appliesCreates the helper table used for primitive binary-expression dispatch.
* Emits the method call used to implement a prefix or postfix operation. * *
op - the token type
*method - the helper method name
*expression - the receiver expression
*orig - the original prefix/postfix expressionCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.