Java Code Examples for com.google.javascript.rhino.IR#trueNode()
The following examples show how to use
com.google.javascript.rhino.IR#trueNode() .
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: PeepholeFoldConstants.java From astor with GNU General Public License v2.0 | 5 votes |
/** * Try to fold {@code left instanceof right} into {@code true} * or {@code false}. */ private Node tryFoldInstanceof(Node n, Node left, Node right) { Preconditions.checkArgument(n.isInstanceOf()); // TODO(johnlenz) Use type information if available to fold // instanceof. if (NodeUtil.isLiteralValue(left, true) && !mayHaveSideEffects(right)) { Node replacementNode = null; if (NodeUtil.isImmutableValue(left)) { // Non-object types are never instances. replacementNode = IR.falseNode(); } else if (right.isName() && "Object".equals(right.getString())) { replacementNode = IR.trueNode(); } if (replacementNode != null) { n.getParent().replaceChild(n, replacementNode); reportCodeChange(); return replacementNode; } } return n; }
Example 2
Source File: Closure_23_PeepholeFoldConstants_t.java From coming with MIT License | 5 votes |
/** * Try to fold {@code left instanceof right} into {@code true} * or {@code false}. */ private Node tryFoldInstanceof(Node n, Node left, Node right) { Preconditions.checkArgument(n.isInstanceOf()); // TODO(johnlenz) Use type information if available to fold // instanceof. if (NodeUtil.isLiteralValue(left, true) && !mayHaveSideEffects(right)) { Node replacementNode = null; if (NodeUtil.isImmutableValue(left)) { // Non-object types are never instances. replacementNode = IR.falseNode(); } else if (right.isName() && "Object".equals(right.getString())) { replacementNode = IR.trueNode(); } if (replacementNode != null) { n.getParent().replaceChild(n, replacementNode); reportCodeChange(); return replacementNode; } } return n; }
Example 3
Source File: Closure_23_PeepholeFoldConstants_s.java From coming with MIT License | 5 votes |
/** * Try to fold {@code left instanceof right} into {@code true} * or {@code false}. */ private Node tryFoldInstanceof(Node n, Node left, Node right) { Preconditions.checkArgument(n.isInstanceOf()); // TODO(johnlenz) Use type information if available to fold // instanceof. if (NodeUtil.isLiteralValue(left, true) && !mayHaveSideEffects(right)) { Node replacementNode = null; if (NodeUtil.isImmutableValue(left)) { // Non-object types are never instances. replacementNode = IR.falseNode(); } else if (right.isName() && "Object".equals(right.getString())) { replacementNode = IR.trueNode(); } if (replacementNode != null) { n.getParent().replaceChild(n, replacementNode); reportCodeChange(); return replacementNode; } } return n; }
Example 4
Source File: jKali_003_s.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 5
Source File: NodeUtil.java From astor with GNU General Public License v2.0 | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 6
Source File: Closure_10_NodeUtil_s.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 7
Source File: Closure_10_NodeUtil_t.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 8
Source File: jMutRepair_003_t.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 9
Source File: jMutRepair_003_s.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 10
Source File: Cardumen_00200_s.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 11
Source File: jKali_003_t.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 12
Source File: Cardumen_0087_t.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 13
Source File: Cardumen_0087_s.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 14
Source File: Cardumen_0014_s.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 15
Source File: Cardumen_0014_t.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 16
Source File: Cardumen_00149_t.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 17
Source File: Cardumen_00149_s.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }
Example 18
Source File: Cardumen_00200_t.java From coming with MIT License | 4 votes |
/** * @return An appropriate AST node for the boolean value. */ static Node booleanNode(boolean value) { return value ? IR.trueNode() : IR.falseNode(); }