Java Code Examples for jdk.nashorn.internal.ir.UnaryNode#tokenType()
The following examples show how to use
jdk.nashorn.internal.ir.UnaryNode#tokenType() .
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: BranchOptimizer.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) { final Expression rhs = unaryNode.rhs(); switch (unaryNode.tokenType()) { case NOT: branchOptimizer(rhs, label, !state); return; default: if (unaryNode.getType().isBoolean()) { branchOptimizer(rhs, label, state); return; } break; } // convert to boolean codegen.load(unaryNode, Type.BOOLEAN); if (state) { method.ifne(label); } else { method.ifeq(label); } }
Example 2
Source File: BranchOptimizer.java From nashorn with GNU General Public License v2.0 | 6 votes |
private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) { final Expression rhs = unaryNode.rhs(); switch (unaryNode.tokenType()) { case NOT: branchOptimizer(rhs, label, !state); return; case CONVERT: if (unaryNode.getType().isBoolean()) { branchOptimizer(rhs, label, state); return; } break; default: break; } // convert to boolean load(unaryNode); method.convert(Type.BOOLEAN); if (state) { method.ifne(label); } else { method.ifeq(label); } }
Example 3
Source File: BranchOptimizer.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private void branchOptimizer(final UnaryNode unaryNode, final Label label, final boolean state) { final Expression rhs = unaryNode.rhs(); switch (unaryNode.tokenType()) { case NOT: branchOptimizer(rhs, label, !state); return; default: if (unaryNode.getType().isBoolean()) { branchOptimizer(rhs, label, state); return; } break; } // convert to boolean codegen.load(unaryNode, Type.BOOLEAN); if (state) { method.ifne(label); } else { method.ifeq(label); } }
Example 4
Source File: NodeOperatorVisitor.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public final Node leaveUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case ADD: return leaveADD(unaryNode); case BIT_NOT: return leaveBIT_NOT(unaryNode); case DELETE: return leaveDELETE(unaryNode); case DISCARD: return leaveDISCARD(unaryNode); case NEW: return leaveNEW(unaryNode); case NOT: return leaveNOT(unaryNode); case SUB: return leaveSUB(unaryNode); case TYPEOF: return leaveTYPEOF(unaryNode); case VOID: return leaveVOID(unaryNode); case DECPREFIX: case DECPOSTFIX: case INCPREFIX: case INCPOSTFIX: return leaveDECINC(unaryNode); default: return super.leaveUnaryNode(unaryNode); } }
Example 5
Source File: AssignSymbols.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case DELETE: return leaveDELETE(unaryNode); case TYPEOF: return leaveTYPEOF(unaryNode); default: return super.leaveUnaryNode(unaryNode); } }
Example 6
Source File: NodeOperatorVisitor.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public final Node leaveUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case ADD: return leaveADD(unaryNode); case BIT_NOT: return leaveBIT_NOT(unaryNode); case DELETE: return leaveDELETE(unaryNode); case DISCARD: return leaveDISCARD(unaryNode); case NEW: return leaveNEW(unaryNode); case NOT: return leaveNOT(unaryNode); case SUB: return leaveSUB(unaryNode); case TYPEOF: return leaveTYPEOF(unaryNode); case VOID: return leaveVOID(unaryNode); case DECPREFIX: case DECPOSTFIX: case INCPREFIX: case INCPOSTFIX: return leaveDECINC(unaryNode); default: return super.leaveUnaryNode(unaryNode); } }
Example 7
Source File: AssignSymbols.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case DELETE: return leaveDELETE(unaryNode); case TYPEOF: return leaveTYPEOF(unaryNode); default: return super.leaveUnaryNode(unaryNode); } }
Example 8
Source File: NodeOperatorVisitor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public final boolean enterUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case ADD: return enterADD(unaryNode); case BIT_NOT: return enterBIT_NOT(unaryNode); case DELETE: return enterDELETE(unaryNode); case NEW: return enterNEW(unaryNode); case NOT: return enterNOT(unaryNode); case SUB: return enterSUB(unaryNode); case TYPEOF: return enterTYPEOF(unaryNode); case VOID: return enterVOID(unaryNode); case DECPREFIX: case DECPOSTFIX: case INCPREFIX: case INCPOSTFIX: return enterDECINC(unaryNode); default: return super.enterUnaryNode(unaryNode); } }
Example 9
Source File: NodeOperatorVisitor.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public final Node leaveUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case ADD: return leaveADD(unaryNode); case BIT_NOT: return leaveBIT_NOT(unaryNode); case DELETE: return leaveDELETE(unaryNode); case NEW: return leaveNEW(unaryNode); case NOT: return leaveNOT(unaryNode); case SUB: return leaveSUB(unaryNode); case TYPEOF: return leaveTYPEOF(unaryNode); case VOID: return leaveVOID(unaryNode); case DECPREFIX: case DECPOSTFIX: case INCPREFIX: case INCPOSTFIX: return leaveDECINC(unaryNode); default: return super.leaveUnaryNode(unaryNode); } }
Example 10
Source File: NodeOperatorVisitor.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public final boolean enterUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case ADD: return enterADD(unaryNode); case BIT_NOT: return enterBIT_NOT(unaryNode); case DELETE: return enterDELETE(unaryNode); case NEW: return enterNEW(unaryNode); case NOT: return enterNOT(unaryNode); case SUB: return enterSUB(unaryNode); case TYPEOF: return enterTYPEOF(unaryNode); case VOID: return enterVOID(unaryNode); case DECPREFIX: case DECPOSTFIX: case INCPREFIX: case INCPOSTFIX: return enterDECINC(unaryNode); default: return super.enterUnaryNode(unaryNode); } }
Example 11
Source File: AssignSymbols.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case DELETE: return leaveDELETE(unaryNode); case TYPEOF: return leaveTYPEOF(unaryNode); default: return super.leaveUnaryNode(unaryNode); } }
Example 12
Source File: NodeOperatorVisitor.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public final Node leaveUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case ADD: return leaveADD(unaryNode); case BIT_NOT: return leaveBIT_NOT(unaryNode); case DELETE: return leaveDELETE(unaryNode); case NEW: return leaveNEW(unaryNode); case NOT: return leaveNOT(unaryNode); case SUB: return leaveSUB(unaryNode); case TYPEOF: return leaveTYPEOF(unaryNode); case VOID: return leaveVOID(unaryNode); case DECPREFIX: case DECPOSTFIX: case INCPREFIX: case INCPOSTFIX: return leaveDECINC(unaryNode); default: return super.leaveUnaryNode(unaryNode); } }
Example 13
Source File: NodeOperatorVisitor.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public final boolean enterUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case ADD: return enterADD(unaryNode); case BIT_NOT: return enterBIT_NOT(unaryNode); case DELETE: return enterDELETE(unaryNode); case NEW: return enterNEW(unaryNode); case NOT: return enterNOT(unaryNode); case SUB: return enterSUB(unaryNode); case TYPEOF: return enterTYPEOF(unaryNode); case VOID: return enterVOID(unaryNode); case DECPREFIX: case DECPOSTFIX: case INCPREFIX: case INCPOSTFIX: return enterDECINC(unaryNode); default: return super.enterUnaryNode(unaryNode); } }
Example 14
Source File: NodeOperatorVisitor.java From nashorn with GNU General Public License v2.0 | 5 votes |
@Override public final boolean enterUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case ADD: return enterADD(unaryNode); case BIT_NOT: return enterBIT_NOT(unaryNode); case CONVERT: return enterCONVERT(unaryNode); case DELETE: return enterDELETE(unaryNode); case DISCARD: return enterDISCARD(unaryNode); case NEW: return enterNEW(unaryNode); case NOT: return enterNOT(unaryNode); case SUB: return enterSUB(unaryNode); case TYPEOF: return enterTYPEOF(unaryNode); case VOID: return enterVOID(unaryNode); case DECPREFIX: case DECPOSTFIX: case INCPREFIX: case INCPOSTFIX: return enterDECINC(unaryNode); default: return super.enterUnaryNode(unaryNode); } }
Example 15
Source File: AssignSymbols.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public Node leaveUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case DELETE: return leaveDELETE(unaryNode); case TYPEOF: return leaveTYPEOF(unaryNode); default: return super.leaveUnaryNode(unaryNode); } }
Example 16
Source File: NodeOperatorVisitor.java From nashorn with GNU General Public License v2.0 | 5 votes |
@Override public final Node leaveUnaryNode(final UnaryNode unaryNode) { switch (unaryNode.tokenType()) { case ADD: return leaveADD(unaryNode); case BIT_NOT: return leaveBIT_NOT(unaryNode); case CONVERT: return leaveCONVERT(unaryNode); case DELETE: return leaveDELETE(unaryNode); case DISCARD: return leaveDISCARD(unaryNode); case NEW: return leaveNEW(unaryNode); case NOT: return leaveNOT(unaryNode); case SUB: return leaveSUB(unaryNode); case TYPEOF: return leaveTYPEOF(unaryNode); case VOID: return leaveVOID(unaryNode); case DECPREFIX: case DECPOSTFIX: case INCPREFIX: case INCPOSTFIX: return leaveDECINC(unaryNode); default: return super.leaveUnaryNode(unaryNode); } }
Example 17
Source File: JSONWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterUnaryNode(final UnaryNode unaryNode) { enterDefault(unaryNode); final TokenType tokenType = unaryNode.tokenType(); if (tokenType == TokenType.NEW) { type("NewExpression"); comma(); final CallNode callNode = (CallNode)unaryNode.getExpression(); property("callee"); callNode.getFunction().accept(this); comma(); array("arguments", callNode.getArgs()); } else { final String operator; final boolean prefix; switch (tokenType) { case INCPOSTFIX: prefix = false; operator = "++"; break; case DECPOSTFIX: prefix = false; operator = "--"; break; case INCPREFIX: operator = "++"; prefix = true; break; case DECPREFIX: operator = "--"; prefix = true; break; default: prefix = true; operator = tokenType.getName(); break; } type(unaryNode.isAssignment()? "UpdateExpression" : "UnaryExpression"); comma(); property("operator", operator); comma(); property("prefix", prefix); comma(); property("argument"); unaryNode.getExpression().accept(this); } return leave(); }
Example 18
Source File: JSONWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterUnaryNode(final UnaryNode unaryNode) { enterDefault(unaryNode); final TokenType tokenType = unaryNode.tokenType(); if (tokenType == TokenType.NEW) { type("NewExpression"); comma(); final CallNode callNode = (CallNode)unaryNode.getExpression(); property("callee"); callNode.getFunction().accept(this); comma(); array("arguments", callNode.getArgs()); } else { final String operator; final boolean prefix; switch (tokenType) { case INCPOSTFIX: prefix = false; operator = "++"; break; case DECPOSTFIX: prefix = false; operator = "--"; break; case INCPREFIX: operator = "++"; prefix = true; break; case DECPREFIX: operator = "--"; prefix = true; break; default: prefix = true; operator = tokenType.getName(); break; } type(unaryNode.isAssignment()? "UpdateExpression" : "UnaryExpression"); comma(); property("operator", operator); comma(); property("prefix", prefix); comma(); property("argument"); unaryNode.getExpression().accept(this); } return leave(); }
Example 19
Source File: JSONWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterUnaryNode(final UnaryNode unaryNode) { enterDefault(unaryNode); final TokenType tokenType = unaryNode.tokenType(); if (tokenType == TokenType.NEW) { type("NewExpression"); comma(); final CallNode callNode = (CallNode)unaryNode.getExpression(); property("callee"); callNode.getFunction().accept(this); comma(); array("arguments", callNode.getArgs()); } else { final String operator; final boolean prefix; switch (tokenType) { case INCPOSTFIX: prefix = false; operator = "++"; break; case DECPOSTFIX: prefix = false; operator = "--"; break; case INCPREFIX: operator = "++"; prefix = true; break; case DECPREFIX: operator = "--"; prefix = true; break; default: prefix = true; operator = tokenType.getName(); break; } type(unaryNode.isAssignment()? "UpdateExpression" : "UnaryExpression"); comma(); property("operator", operator); comma(); property("prefix", prefix); comma(); property("argument"); unaryNode.getExpression().accept(this); } return leave(); }
Example 20
Source File: JSONWriter.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterUnaryNode(final UnaryNode unaryNode) { enterDefault(unaryNode); final TokenType tokenType = unaryNode.tokenType(); if (tokenType == TokenType.NEW) { type("NewExpression"); comma(); final CallNode callNode = (CallNode)unaryNode.getExpression(); property("callee"); callNode.getFunction().accept(this); comma(); array("arguments", callNode.getArgs()); } else { final String operator; final boolean prefix; switch (tokenType) { case INCPOSTFIX: prefix = false; operator = "++"; break; case DECPOSTFIX: prefix = false; operator = "--"; break; case INCPREFIX: operator = "++"; prefix = true; break; case DECPREFIX: operator = "--"; prefix = true; break; default: prefix = true; operator = tokenType.getName(); break; } type(unaryNode.isAssignment()? "UpdateExpression" : "UnaryExpression"); comma(); property("operator", operator); comma(); property("prefix", prefix); comma(); property("argument"); unaryNode.getExpression().accept(this); } return leave(); }