Java Code Examples for jdk.nashorn.internal.ir.BinaryNode#isAssignment()
The following examples show how to use
jdk.nashorn.internal.ir.BinaryNode#isAssignment() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OptimisticTypesCalculator.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if(binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if(!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if(lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode)lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment expressions if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
Example 2
Source File: OptimisticTypesCalculator.java From jdk8u_nashorn with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if(binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if(!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if(lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode)lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment expressions if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
Example 3
Source File: OptimisticTypesCalculator.java From hottub with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if(binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if(!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if(lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode)lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment expressions if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
Example 4
Source File: OptimisticTypesCalculator.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if(binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if(!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if(lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode)lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment expressions if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if(binaryNode.isTokenType(TokenType.INSTANCEOF)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
Example 5
Source File: OptimisticTypesCalculator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if(binaryNode.isAssignment()) { final Expression lhs = binaryNode.lhs(); if(!binaryNode.isSelfModifying()) { tagNeverOptimistic(lhs); } if(lhs instanceof IdentNode) { final Symbol symbol = ((IdentNode)lhs).getSymbol(); // Assignment to internal symbols is never optimistic, except for self-assignment expressions if(symbol.isInternal() && !binaryNode.rhs().isSelfModifying()) { tagNeverOptimistic(binaryNode.rhs()); } } } else if(binaryNode.isTokenType(TokenType.INSTANCEOF) || binaryNode.isTokenType(TokenType.EQ_STRICT) || binaryNode.isTokenType(TokenType.NE_STRICT)) { tagNeverOptimistic(binaryNode.lhs()); tagNeverOptimistic(binaryNode.rhs()); } return true; }
Example 6
Source File: IRTranslator.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { if (binaryNode.isAssignment()) { final ExpressionTree srcTree = translateExpr(binaryNode.getAssignmentSource()); final ExpressionTree destTree = translateExpr(binaryNode.getAssignmentDest()); if (binaryNode.isTokenType(TokenType.ASSIGN)) { curExpr = new AssignmentTreeImpl(binaryNode, destTree, srcTree); } else { curExpr = new CompoundAssignmentTreeImpl(binaryNode, destTree, srcTree); } } else { final ExpressionTree leftTree = translateExpr(binaryNode.lhs()); final ExpressionTree rightTree = translateExpr(binaryNode.rhs()); if (binaryNode.isTokenType(TokenType.INSTANCEOF)) { curExpr = new InstanceOfTreeImpl(binaryNode, leftTree, rightTree); } else { curExpr = new BinaryTreeImpl(binaryNode, leftTree, rightTree); } } return false; }
Example 7
Source File: JSONWriter.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { enterDefault(binaryNode); final String name; if (binaryNode.isAssignment()) { name = "AssignmentExpression"; } else if (isLogical(binaryNode.tokenType())) { name = "LogicalExpression"; } else { name = "BinaryExpression"; } type(name); comma(); property("operator", binaryNode.tokenType().getName()); comma(); property("left"); binaryNode.lhs().accept(this); comma(); property("right"); binaryNode.rhs().accept(this); return leave(); }
Example 8
Source File: LocalVariableTypesCalculator.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first. final Expression lhs = binaryNode.lhs(); final LvarType lhsType; if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) { lhsType = visitExpression(lhs); } else { // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def. // The type is irrelevant, as only RHS is used to determine the type anyway. lhsType = LvarType.UNDEFINED; } final boolean isLogical = binaryNode.isLogical(); final Label joinLabel = isLogical ? new Label("") : null; if(isLogical) { jumpToLabel((JoinPredecessor)lhs, joinLabel); } final Expression rhs = binaryNode.rhs(); final LvarType rhsType = visitExpression(rhs); if(isLogical) { jumpToLabel((JoinPredecessor)rhs, joinLabel); } joinOnLabel(joinLabel); final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType()); if(binaryNode.isAssignment() && lhs instanceof IdentNode) { if(binaryNode.isSelfModifying()) { onSelfAssignment((IdentNode)lhs, type); } else { onAssignment((IdentNode)lhs, type); } } typeStack.push(type); return false; }
Example 9
Source File: JSONWriter.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { enterDefault(binaryNode); final String name; if (binaryNode.isAssignment()) { name = "AssignmentExpression"; } else if (binaryNode.isLogical()) { name = "LogicalExpression"; } else { name = "BinaryExpression"; } type(name); comma(); property("operator", binaryNode.tokenType().getName()); comma(); property("left"); binaryNode.lhs().accept(this); comma(); property("right"); binaryNode.rhs().accept(this); return leave(); }
Example 10
Source File: LocalVariableTypesCalculator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first. final Expression lhs = binaryNode.lhs(); final LvarType lhsType; if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) { lhsType = visitExpression(lhs); } else { // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def. // The type is irrelevant, as only RHS is used to determine the type anyway. lhsType = LvarType.UNDEFINED; } final boolean isLogical = binaryNode.isLogical(); final Label joinLabel = isLogical ? new Label("") : null; if(isLogical) { jumpToLabel((JoinPredecessor)lhs, joinLabel); } final Expression rhs = binaryNode.rhs(); final LvarType rhsType = visitExpression(rhs); if(isLogical) { jumpToLabel((JoinPredecessor)rhs, joinLabel); } joinOnLabel(joinLabel); final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType()); if(binaryNode.isAssignment() && lhs instanceof IdentNode) { if(binaryNode.isSelfModifying()) { onSelfAssignment((IdentNode)lhs, type); } else { onAssignment((IdentNode)lhs, type); } } typeStack.push(type); return false; }
Example 11
Source File: JSONWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { enterDefault(binaryNode); final String name; if (binaryNode.isAssignment()) { name = "AssignmentExpression"; } else if (binaryNode.isLogical()) { name = "LogicalExpression"; } else { name = "BinaryExpression"; } type(name); comma(); property("operator", binaryNode.tokenType().getName()); comma(); property("left"); binaryNode.lhs().accept(this); comma(); property("right"); binaryNode.rhs().accept(this); return leave(); }
Example 12
Source File: JSONWriter.java From nashorn with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { enterDefault(binaryNode); final String name; if (binaryNode.isAssignment()) { name = "AssignmentExpression"; } else if (isLogical(binaryNode.tokenType())) { name = "LogicalExpression"; } else { name = "BinaryExpression"; } type(name); comma(); property("operator", binaryNode.tokenType().getName()); comma(); property("left"); binaryNode.lhs().accept(this); comma(); property("right"); binaryNode.rhs().accept(this); return leave(); }
Example 13
Source File: JSONWriter.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { enterDefault(binaryNode); final String name; if (binaryNode.isAssignment()) { name = "AssignmentExpression"; } else if (isLogical(binaryNode.tokenType())) { name = "LogicalExpression"; } else { name = "BinaryExpression"; } type(name); comma(); property("operator", binaryNode.tokenType().getName()); comma(); property("left"); binaryNode.lhs().accept(this); comma(); property("right"); binaryNode.rhs().accept(this); return leave(); }
Example 14
Source File: JSONWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { enterDefault(binaryNode); final String name; if (binaryNode.isAssignment()) { name = "AssignmentExpression"; } else if (binaryNode.isLogical()) { name = "LogicalExpression"; } else { name = "BinaryExpression"; } type(name); comma(); property("operator", binaryNode.tokenType().getName()); comma(); property("left"); binaryNode.lhs().accept(this); comma(); property("right"); binaryNode.rhs().accept(this); return leave(); }
Example 15
Source File: LocalVariableTypesCalculator.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first. final Expression lhs = binaryNode.lhs(); final LvarType lhsType; if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) { lhsType = visitExpression(lhs); } else { // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def. // The type is irrelevant, as only RHS is used to determine the type anyway. lhsType = LvarType.UNDEFINED; } final boolean isLogical = binaryNode.isLogical(); final Label joinLabel = isLogical ? new Label("") : null; if(isLogical) { jumpToLabel((JoinPredecessor)lhs, joinLabel); } final Expression rhs = binaryNode.rhs(); final LvarType rhsType = visitExpression(rhs); if(isLogical) { jumpToLabel((JoinPredecessor)rhs, joinLabel); } joinOnLabel(joinLabel); final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType()); if(binaryNode.isAssignment() && lhs instanceof IdentNode) { if(binaryNode.isSelfModifying()) { onSelfAssignment((IdentNode)lhs, type); } else { onAssignment((IdentNode)lhs, type); } } typeStack.push(type); return false; }
Example 16
Source File: JSONWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { enterDefault(binaryNode); final String name; if (binaryNode.isAssignment()) { name = "AssignmentExpression"; } else if (binaryNode.isLogical()) { name = "LogicalExpression"; } else { name = "BinaryExpression"; } type(name); comma(); property("operator", binaryNode.tokenType().getName()); comma(); property("left"); binaryNode.lhs().accept(this); comma(); property("right"); binaryNode.rhs().accept(this); return leave(); }
Example 17
Source File: JSONWriter.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { enterDefault(binaryNode); final String name; if (binaryNode.isAssignment()) { name = "AssignmentExpression"; } else if (binaryNode.isLogical()) { name = "LogicalExpression"; } else { name = "BinaryExpression"; } type(name); comma(); property("operator", binaryNode.tokenType().getName()); comma(); property("left"); binaryNode.lhs().accept(this); comma(); property("right"); binaryNode.rhs().accept(this); return leave(); }
Example 18
Source File: LocalVariableTypesCalculator.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first. final Expression lhs = binaryNode.lhs(); final LvarType lhsType; if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) { lhsType = visitExpression(lhs); } else { // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def. // The type is irrelevant, as only RHS is used to determine the type anyway. lhsType = LvarType.UNDEFINED; } final boolean isLogical = binaryNode.isLogical(); final Label joinLabel = isLogical ? new Label("") : null; if(isLogical) { jumpToLabel((JoinPredecessor)lhs, joinLabel); } final Expression rhs = binaryNode.rhs(); final LvarType rhsType = visitExpression(rhs); if(isLogical) { jumpToLabel((JoinPredecessor)rhs, joinLabel); } joinOnLabel(joinLabel); final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType()); if(binaryNode.isAssignment() && lhs instanceof IdentNode) { if(binaryNode.isSelfModifying()) { onSelfAssignment((IdentNode)lhs, type); } else { onAssignment((IdentNode)lhs, type); } } typeStack.push(type); return false; }
Example 19
Source File: JSONWriter.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { enterDefault(binaryNode); final String name; if (binaryNode.isAssignment()) { name = "AssignmentExpression"; } else if (binaryNode.isLogical()) { name = "LogicalExpression"; } else { name = "BinaryExpression"; } type(name); comma(); property("operator", binaryNode.tokenType().getName()); comma(); property("left"); binaryNode.lhs().accept(this); comma(); property("right"); binaryNode.rhs().accept(this); return leave(); }
Example 20
Source File: LocalVariableTypesCalculator.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public boolean enterBinaryNode(final BinaryNode binaryNode) { // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first. final Expression lhs = binaryNode.lhs(); final LvarType lhsType; if (!(lhs instanceof IdentNode && binaryNode.isTokenType(TokenType.ASSIGN))) { lhsType = visitExpression(lhs); } else { // Can't visit IdentNode on LHS of a simple assignment, as visits imply use, and this is def. // The type is irrelevant, as only RHS is used to determine the type anyway. lhsType = LvarType.UNDEFINED; } final boolean isLogical = binaryNode.isLogical(); final Label joinLabel = isLogical ? new Label("") : null; if(isLogical) { jumpToLabel((JoinPredecessor)lhs, joinLabel); } final Expression rhs = binaryNode.rhs(); final LvarType rhsType = visitExpression(rhs); if(isLogical) { jumpToLabel((JoinPredecessor)rhs, joinLabel); } joinOnLabel(joinLabel); final LvarType type = toLvarType(binaryNode.setOperands(lhsType.typeExpression, rhsType.typeExpression).getType()); if(binaryNode.isAssignment() && lhs instanceof IdentNode) { if(binaryNode.isSelfModifying()) { onSelfAssignment((IdentNode)lhs, type); } else { onAssignment((IdentNode)lhs, type); } } typeStack.push(type); return false; }