Class JSOverloadedBinaryNode
java.lang.Object
com.oracle.truffle.api.nodes.Node
com.oracle.truffle.js.nodes.JavaScriptBaseNode
com.oracle.truffle.js.nodes.binary.JSOverloadedBinaryNode
- All Implemented Interfaces:
com.oracle.truffle.api.nodes.NodeInterface,Cloneable
This node implements the semantics of a binary operator in the case when one of the two operands
features overloaded operators. Its job is to call ToOperand on its arguments (converting objects
which don't overload operators to primitives). The bulk of the work is then delegated to the
JSOverloadedBinaryNode.DispatchBinaryOperatorNode.
Check JSAddNode for an example of using this node.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class implements theDispatchBinaryOperatorspec function.Nested classes/interfaces inherited from class com.oracle.truffle.api.nodes.Node
com.oracle.truffle.api.nodes.Node.Child, com.oracle.truffle.api.nodes.Node.Children -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedJSOverloadedBinaryNode(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName, boolean numeric, JSToPrimitiveNode.Hint hint, boolean leftToRight) -
Method Summary
Modifier and TypeMethodDescriptionstatic JSOverloadedBinaryNodecreate(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName, JSToPrimitiveNode.Hint hint) static JSOverloadedBinaryNodecreateHintDefault(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName) static JSOverloadedBinaryNodecreateHintNumber(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName) static JSOverloadedBinaryNodecreateHintNumberLeftToRight(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName) static JSOverloadedBinaryNodecreateHintNumberRightToLeft(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName) static JSOverloadedBinaryNodecreateHintString(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName) static JSOverloadedBinaryNodecreateNumeric(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName) protected ObjectdoToNumericOperand(Object left, Object right, JSToNumericNode toNumericOperandLeftNode, JSToNumericNode toNumericOperandRightNode, JSOverloadedBinaryNode.DispatchBinaryOperatorNode dispatchBinaryOperatorNode) protected ObjectdoToOperandAddition(Object left, Object right, com.oracle.truffle.api.nodes.Node node, JSToOperandNode toOperandLeftNode, JSToOperandNode toOperandRightNode, JSOverloadedBinaryNode.DispatchBinaryOperatorNode dispatchBinaryOperatorNode, JSToStringNode toStringLeftNode, JSToStringNode toStringRightNode, com.oracle.truffle.api.profiles.InlinedConditionProfile leftStringProfile, com.oracle.truffle.api.profiles.InlinedConditionProfile rightStringProfile, JSAddNode addNode) protected ObjectdoToOperandGeneric(Object left, Object right, JSToOperandNode toOperandLeftNode, JSToOperandNode toOperandRightNode, JSOverloadedBinaryNode.DispatchBinaryOperatorNode dispatchBinaryOperatorNode) abstract Objectprotected JSToPrimitiveNode.HintgetHint()protected com.oracle.truffle.api.strings.TruffleStringprotected booleanprotected booleanprotected final booleanMethods inherited from class com.oracle.truffle.js.nodes.JavaScriptBaseNode
copy, getJSContext, getLanguage, getLanguageOptions, getRealm, hasOverloadedOperators, onReplaceMethods inherited from class com.oracle.truffle.api.nodes.Node
accept, adoptChildren, atomic, atomic, deepCopy, getChildren, getCost, getDebugProperties, getDescription, getEncapsulatingSourceSection, getLock, getParent, getRootNode, getSourceSection, insert, insert, isAdoptable, isSafelyReplaceableBy, notifyInserted, replace, replace, reportPolymorphicSpecialize, toString
-
Constructor Details
-
JSOverloadedBinaryNode
protected JSOverloadedBinaryNode(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName, boolean numeric, JSToPrimitiveNode.Hint hint, boolean leftToRight)
-
-
Method Details
-
create
public static JSOverloadedBinaryNode create(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName, JSToPrimitiveNode.Hint hint) -
createHintDefault
public static JSOverloadedBinaryNode createHintDefault(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName) -
createHintNumber
public static JSOverloadedBinaryNode createHintNumber(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName) -
createHintNumberLeftToRight
public static JSOverloadedBinaryNode createHintNumberLeftToRight(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName) -
createHintNumberRightToLeft
public static JSOverloadedBinaryNode createHintNumberRightToLeft(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName) -
createHintString
public static JSOverloadedBinaryNode createHintString(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName) -
createNumeric
public static JSOverloadedBinaryNode createNumeric(com.oracle.truffle.api.strings.TruffleString overloadedOperatorName) -
execute
-
doToOperandGeneric
protected Object doToOperandGeneric(Object left, Object right, JSToOperandNode toOperandLeftNode, JSToOperandNode toOperandRightNode, JSOverloadedBinaryNode.DispatchBinaryOperatorNode dispatchBinaryOperatorNode) -
doToOperandAddition
protected Object doToOperandAddition(Object left, Object right, com.oracle.truffle.api.nodes.Node node, JSToOperandNode toOperandLeftNode, JSToOperandNode toOperandRightNode, JSOverloadedBinaryNode.DispatchBinaryOperatorNode dispatchBinaryOperatorNode, JSToStringNode toStringLeftNode, JSToStringNode toStringRightNode, com.oracle.truffle.api.profiles.InlinedConditionProfile leftStringProfile, com.oracle.truffle.api.profiles.InlinedConditionProfile rightStringProfile, JSAddNode addNode) -
doToNumericOperand
protected Object doToNumericOperand(Object left, Object right, JSToNumericNode toNumericOperandLeftNode, JSToNumericNode toNumericOperandRightNode, JSOverloadedBinaryNode.DispatchBinaryOperatorNode dispatchBinaryOperatorNode) -
getOverloadedOperatorName
protected com.oracle.truffle.api.strings.TruffleString getOverloadedOperatorName() -
isNumeric
protected final boolean isNumeric() -
getHint
-
isAddition
protected boolean isAddition() -
isEquality
protected boolean isEquality()
-