Java Code Examples for jdk.nashorn.internal.ir.FunctionNode#getToken()
The following examples show how to use
jdk.nashorn.internal.ir.FunctionNode#getToken() .
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: Lower.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public Node leaveBlock(final Block block) { //now we have committed the entire statement list to the block, but we need to truncate //whatever is after the last terminal. block append won't append past it if (lc.isFunctionBody()) { final FunctionNode currentFunction = lc.getCurrentFunction(); final boolean isProgram = currentFunction.isProgram(); final Statement last = lc.getLastStatement(); final ReturnNode returnNode = new ReturnNode( last == null ? currentFunction.getLineNumber() : last.getLineNumber(), //TODO? currentFunction.getToken(), currentFunction.getFinish(), isProgram ? compilerConstant(RETURN) : LiteralNode.newInstance(block, ScriptRuntime.UNDEFINED)); returnNode.accept(this); } return block; }
Example 2
Source File: Lower.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public Node leaveBlock(final Block block) { //now we have committed the entire statement list to the block, but we need to truncate //whatever is after the last terminal. block append won't append past it if (lc.isFunctionBody()) { final FunctionNode currentFunction = lc.getCurrentFunction(); final boolean isProgram = currentFunction.isProgram(); final Statement last = lc.getLastStatement(); final ReturnNode returnNode = new ReturnNode( last == null ? currentFunction.getLineNumber() : last.getLineNumber(), //TODO? currentFunction.getToken(), currentFunction.getFinish(), isProgram ? compilerConstant(RETURN) : LiteralNode.newInstance(block, ScriptRuntime.UNDEFINED)); returnNode.accept(this); } return block; }
Example 3
Source File: LocalVariableTypesCalculator.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private void createSyntheticReturn(final Block body) { final FunctionNode functionNode = lc.getCurrentFunction(); final long token = functionNode.getToken(); final int finish = functionNode.getFinish(); final List<Statement> statements = body.getStatements(); final int lineNumber = statements.isEmpty() ? functionNode.getLineNumber() : statements.get(statements.size() - 1).getLineNumber(); final IdentNode returnExpr; if(functionNode.isProgram()) { returnExpr = new IdentNode(token, finish, RETURN.symbolName()).setSymbol(getCompilerConstantSymbol(functionNode, RETURN)); } else { returnExpr = null; } syntheticReturn = new ReturnNode(lineNumber, token, finish, returnExpr); syntheticReturn.accept(this); }
Example 4
Source File: LocalVariableTypesCalculator.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private void createSyntheticReturn(final Block body) { final FunctionNode functionNode = lc.getCurrentFunction(); final long token = functionNode.getToken(); final int finish = functionNode.getFinish(); final List<Statement> statements = body.getStatements(); final int lineNumber = statements.isEmpty() ? functionNode.getLineNumber() : statements.get(statements.size() - 1).getLineNumber(); final IdentNode returnExpr; if(functionNode.isProgram()) { returnExpr = new IdentNode(token, finish, RETURN.symbolName()).setSymbol(getCompilerConstantSymbol(functionNode, RETURN)); } else { returnExpr = null; } syntheticReturn = new ReturnNode(lineNumber, token, finish, returnExpr); syntheticReturn.accept(this); }
Example 5
Source File: LocalVariableTypesCalculator.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private void createSyntheticReturn(final Block body) { final FunctionNode functionNode = lc.getCurrentFunction(); final long token = functionNode.getToken(); final int finish = functionNode.getFinish(); final List<Statement> statements = body.getStatements(); final int lineNumber = statements.isEmpty() ? functionNode.getLineNumber() : statements.get(statements.size() - 1).getLineNumber(); final IdentNode returnExpr; if(functionNode.isProgram()) { returnExpr = new IdentNode(token, finish, RETURN.symbolName()).setSymbol(getCompilerConstantSymbol(functionNode, RETURN)); } else { returnExpr = null; } syntheticReturn = new ReturnNode(lineNumber, token, finish, returnExpr); syntheticReturn.accept(this); }
Example 6
Source File: Lower.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private IdentNode compilerConstant(final CompilerConstants cc) { final FunctionNode functionNode = lc.getCurrentFunction(); return new IdentNode(functionNode.getToken(), functionNode.getFinish(), cc.symbolName()); }
Example 7
Source File: Lower.java From hottub with GNU General Public License v2.0 | 4 votes |
private IdentNode compilerConstant(final CompilerConstants cc) { final FunctionNode functionNode = lc.getCurrentFunction(); return new IdentNode(functionNode.getToken(), functionNode.getFinish(), cc.symbolName()); }
Example 8
Source File: Lower.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
private IdentNode compilerConstant(final CompilerConstants cc) { final FunctionNode functionNode = lc.getCurrentFunction(); return new IdentNode(functionNode.getToken(), functionNode.getFinish(), cc.symbolName()); }
Example 9
Source File: Lower.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
private IdentNode compilerConstant(final CompilerConstants cc) { final FunctionNode functionNode = lc.getCurrentFunction(); return new IdentNode(functionNode.getToken(), functionNode.getFinish(), cc.symbolName()); }
Example 10
Source File: Lower.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private IdentNode compilerConstant(final CompilerConstants cc) { final FunctionNode functionNode = lc.getCurrentFunction(); return new IdentNode(functionNode.getToken(), functionNode.getFinish(), cc.symbolName()); }
Example 11
Source File: Lower.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private IdentNode compilerConstant(final CompilerConstants cc) { final FunctionNode functionNode = lc.getCurrentFunction(); return new IdentNode(functionNode.getToken(), functionNode.getFinish(), cc.symbolName()); }
Example 12
Source File: Lower.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
private IdentNode compilerConstant(final CompilerConstants cc) { final FunctionNode functionNode = lc.getCurrentFunction(); return new IdentNode(functionNode.getToken(), functionNode.getFinish(), cc.symbolName()); }
Example 13
Source File: AssignSymbols.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 2 votes |
/** * Creates an ident node for an implicit identifier within the function (one not declared in the script source * code). These identifiers are defined with function's token and finish. * @param name the name of the identifier * @return an ident node representing the implicit identifier. */ private IdentNode createImplicitIdentifier(final String name) { final FunctionNode fn = lc.getCurrentFunction(); return new IdentNode(fn.getToken(), fn.getFinish(), name); }
Example 14
Source File: AssignSymbols.java From jdk8u_nashorn with GNU General Public License v2.0 | 2 votes |
/** * Creates an ident node for an implicit identifier within the function (one not declared in the script source * code). These identifiers are defined with function's token and finish. * @param name the name of the identifier * @return an ident node representing the implicit identifier. */ private IdentNode createImplicitIdentifier(final String name) { final FunctionNode fn = lc.getCurrentFunction(); return new IdentNode(fn.getToken(), fn.getFinish(), name); }
Example 15
Source File: AssignSymbols.java From openjdk-jdk9 with GNU General Public License v2.0 | 2 votes |
/** * Creates an ident node for an implicit identifier within the function (one not declared in the script source * code). These identifiers are defined with function's token and finish. * @param name the name of the identifier * @return an ident node representing the implicit identifier. */ private IdentNode createImplicitIdentifier(final String name) { final FunctionNode fn = lc.getCurrentFunction(); return new IdentNode(fn.getToken(), fn.getFinish(), name); }
Example 16
Source File: AssignSymbols.java From openjdk-jdk8u with GNU General Public License v2.0 | 2 votes |
/** * Creates an ident node for an implicit identifier within the function (one not declared in the script source * code). These identifiers are defined with function's token and finish. * @param name the name of the identifier * @return an ident node representing the implicit identifier. */ private IdentNode createImplicitIdentifier(final String name) { final FunctionNode fn = lc.getCurrentFunction(); return new IdentNode(fn.getToken(), fn.getFinish(), name); }
Example 17
Source File: AssignSymbols.java From hottub with GNU General Public License v2.0 | 2 votes |
/** * Creates an ident node for an implicit identifier within the function (one not declared in the script source * code). These identifiers are defined with function's token and finish. * @param name the name of the identifier * @return an ident node representing the implicit identifier. */ private IdentNode createImplicitIdentifier(final String name) { final FunctionNode fn = lc.getCurrentFunction(); return new IdentNode(fn.getToken(), fn.getFinish(), name); }
Example 18
Source File: AssignSymbols.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * Creates an ident node for an implicit identifier within the function (one not declared in the script source * code). These identifiers are defined with function's token and finish. * @param name the name of the identifier * @return an ident node representing the implicit identifier. */ private IdentNode createImplicitIdentifier(final String name) { final FunctionNode fn = lc.getCurrentFunction(); return new IdentNode(fn.getToken(), fn.getFinish(), name); }
Example 19
Source File: Attr.java From nashorn with GNU General Public License v2.0 | 2 votes |
/** * Creates an ident node for an implicit identifier within the function (one not declared in the script source * code). These identifiers are defined with function's token and finish. * @param name the name of the identifier * @return an ident node representing the implicit identifier. */ private IdentNode createImplicitIdentifier(final String name) { final FunctionNode fn = lc.getCurrentFunction(); return new IdentNode(fn.getToken(), fn.getFinish(), name); }
Example 20
Source File: Attr.java From openjdk-8-source with GNU General Public License v2.0 | 2 votes |
/** * Creates an ident node for an implicit identifier within the function (one not declared in the script source * code). These identifiers are defined with function's token and finish. * @param name the name of the identifier * @return an ident node representing the implicit identifier. */ private IdentNode createImplicitIdentifier(final String name) { final FunctionNode fn = lc.getCurrentFunction(); return new IdentNode(fn.getToken(), fn.getFinish(), name); }