public class BinaryExpressionHelper
extends Object
Emits bytecode for dynamic binary expressions.
| Modifiers | Name | Description |
|---|---|---|
protected WriterController |
controller |
Coordinates the active bytecode-generation state. |
| Constructor and description |
|---|
BinaryExpressionHelper(WriterController wc)Creates a binary expression helper for the supplied controller. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
protected void |
assignToArray(Expression parent, Expression receiver, Expression index, Expression rhsValueLoader, boolean safe)Emits an array-style assignment using the dynamic putAt protocol. |
|
public void |
eval(BinaryExpression expression)Evaluates the supplied binary expression. |
|
protected void |
evaluateArrayAssignmentWithOperator(String method, BinaryExpression expression, BinaryExpression leftBinExpr)Evaluates a compound assignment whose left-hand side is a subscript expression. |
|
protected void |
evaluateBinaryExpression(String message, BinaryExpression expression)Evaluates a dynamic binary operator by invoking the named helper method. |
|
protected void |
evaluateBinaryExpressionWithAssignment(String method, BinaryExpression expression)Evaluates an operator-assignment expression such as +=. |
|
protected void |
evaluateCompareExpression(MethodCaller compareMethod, BinaryExpression expression)Evaluates a comparison expression, using primitive helpers when possible. |
|
protected void |
evaluateCompoundAssign(String assignName, String baseName, BinaryExpression expression)GEP-15: dynamic-mode compound-assign codegen. |
|
public void |
evaluateElvisEqual(BinaryExpression expression)Rewrites and evaluates the Elvis-assignment form. |
|
public void |
evaluateEqual(BinaryExpression expression, boolean defineVariable)Evaluates an assignment expression. |
|
public void |
evaluatePostfixMethod(PostfixExpression expression)Evaluates a postfix increment or decrement expression. |
|
public void |
evaluatePrefixMethod(PrefixExpression expression)Evaluates a prefix increment or decrement expression. |
|
public void |
evaluateTernary(TernaryExpression expression)Evaluates a ternary or Elvis expression. |
|
public WriterController |
getController()
|
|
public MethodCaller |
getIsCaseMethod()
|
|
protected void |
writePostOrPrefixMethod(int op, String method, Expression expression, Expression orig)Emits the method call used to implement a prefix or postfix operation. |
Coordinates the active bytecode-generation state.
Creates a binary expression helper for the supplied controller.
wc - the active writer controller Emits an array-style assignment using the dynamic putAt protocol.
parent - the original assignment expressionreceiver - the array or indexable receiverindex - the subscript expressionrhsValueLoader - an expression that reloads the right-hand valuesafe - whether the receiver access is null-safeEvaluates the supplied binary expression.
expression - the expression to compileEvaluates a compound assignment whose left-hand side is a subscript expression.
method - the operator method nameexpression - the compound assignment expressionleftBinExpr - the indexed left-hand sideEvaluates a dynamic binary operator by invoking the named helper method.
message - the operator method nameexpression - the expression to compile Evaluates an operator-assignment expression such as +=.
method - the operator method nameexpression - the assignment expressionEvaluates a comparison expression, using primitive helpers when possible.
compareMethod - the dynamic comparison helperexpression - 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.
Rewrites and evaluates the Elvis-assignment form.
expression - the Elvis-assignment expressionEvaluates an assignment expression.
expression - the assignment expressiondefineVariable - whether the left-hand side declares a new variableEvaluates a postfix increment or decrement expression.
expression - the postfix expressionEvaluates a prefix increment or decrement expression.
expression - the prefix expressionEvaluates a ternary or Elvis expression.
expression - the expression to compile
isCase dispatchEmits the method call used to implement a prefix or postfix operation.
op - the token typemethod - the helper method nameexpression - the receiver expressionorig - the original prefix/postfix expressionCopyright © 2003-2026 The Apache Software Foundation. All rights reserved.