Class BinaryNode
java.lang.Object
com.oracle.js.parser.ir.Node
com.oracle.js.parser.ir.Expression
com.oracle.js.parser.ir.BinaryNode
- All Implemented Interfaces:
Assignment<Expression>,Cloneable
BinaryNode nodes represent two operand operations.
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaccept(NodeVisitor<? extends LexicalContext> visitor) Assist in IR navigation.<R> Raccept(TranslatorNodeVisitor<? extends LexicalContext, R> visitor) Provides a means to navigate the IR.Get assignment destination.Get the assignment source.getLhs()Get the left hand side expression for this nodegetRhs()Get the right hand side expression for this nodebooleanReturns true if the runtime value of this expression is always false when converted to boolean as per ECMAScript ToBoolean conversion.booleanReturns true if the runtime value of this expression is always true when converted to boolean as per ECMAScript ToBoolean conversion.booleanCheck if this node is an assignmentbooleanReturns true if the node is a comparison operation (either equality, inequality, or relational).booleanReturns true if the node is a logical operation.static booleanReturns true if the token type represents a logical operation.booleanReturns true if the node is a relational operation (less than (or equals), greater than (or equals)).booleanIs this a self modifying assignment?setLHS(Expression lhs) Set the left hand side expression for this nodesetRHS(Expression rhs) Set the right hand side expression for this nodevoidtoString(StringBuilder sb, boolean printType) Print logic that decides whether to show the optimistic type or not - for example it should not be printed after just parse, when it hasn't been computed, or has been set to a trivially provable valueMethods inherited from class com.oracle.js.parser.ir.Expression
getFinish, getFinishWithoutParens, getStart, getStartWithoutParens, isParenthesized, makeParenthesized
-
Constructor Details
-
BinaryNode
Constructor- Parameters:
token- tokenlhs- left hand siderhs- right hand side
-
-
Method Details
-
isComparison
public boolean isComparison()Returns true if the node is a comparison operation (either equality, inequality, or relational).- Returns:
- true if the node is a comparison operation.
-
isRelational
public boolean isRelational()Returns true if the node is a relational operation (less than (or equals), greater than (or equals)).- Returns:
- true if the node is a relational operation.
-
isLogical
public boolean isLogical()Returns true if the node is a logical operation.- Returns:
- true if the node is a logical operation.
-
isLogical
Returns true if the token type represents a logical operation.- Parameters:
tokenType- the token type- Returns:
- true if the token type represents a logical operation.
-
isAssignment
public boolean isAssignment()Check if this node is an assignment- Overrides:
isAssignmentin classNode- Returns:
- true if this node assigns a value
-
isSelfModifying
public boolean isSelfModifying()Description copied from class:ExpressionIs this a self modifying assignment?- Overrides:
isSelfModifyingin classExpression- Returns:
- true if self modifying, e.g. a++, or a*= 17
-
getAssignmentDest
Description copied from interface:AssignmentGet assignment destination.- Specified by:
getAssignmentDestin interfaceAssignment<Expression>- Returns:
- the assignment destination node
-
getAssignmentSource
Description copied from interface:AssignmentGet the assignment source.- Specified by:
getAssignmentSourcein interfaceAssignment<Expression>- Returns:
- the assignment source node
-
accept
Assist in IR navigation. -
accept
Description copied from class:NodeProvides a means to navigate the IR. -
isAlwaysFalse
public boolean isAlwaysFalse()Description copied from class:ExpressionReturns true if the runtime value of this expression is always false when converted to boolean as per ECMAScript ToBoolean conversion. Used in control flow calculations.- Overrides:
isAlwaysFalsein classExpression- Returns:
- true if this expression's runtime value converted to boolean is always false.
-
isAlwaysTrue
public boolean isAlwaysTrue()Description copied from class:ExpressionReturns true if the runtime value of this expression is always true when converted to boolean as per ECMAScript ToBoolean conversion. Used in control flow calculations.- Overrides:
isAlwaysTruein classExpression- Returns:
- true if this expression's runtime value converted to boolean is always true.
-
toString
Description copied from class:NodePrint logic that decides whether to show the optimistic type or not - for example it should not be printed after just parse, when it hasn't been computed, or has been set to a trivially provable value -
getLhs
Get the left hand side expression for this node- Returns:
- the left hand side expression
-
getRhs
Get the right hand side expression for this node- Returns:
- the left hand side expression
-
setLHS
Set the left hand side expression for this node- Parameters:
lhs- new left hand side expression- Returns:
- a node equivalent to this one except for the requested change.
-
setRHS
Set the right hand side expression for this node- Parameters:
rhs- new left hand side expression- Returns:
- a node equivalent to this one except for the requested change.
-