Java Code Examples for jdk.nashorn.internal.ir.FunctionNode#isAnonymous()
The following examples show how to use
jdk.nashorn.internal.ir.FunctionNode#isAnonymous() .
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: RecompilableScriptFunctionData.java From nashorn with GNU General Public License v2.0 | 6 votes |
/** * Constructor - public as scripts use it * * @param functionNode functionNode that represents this function code * @param installer installer for code regeneration versions of this function * @param allocatorClassName name of our allocator class, will be looked up dynamically if used as a constructor * @param allocatorMap allocator map to seed instances with, when constructing */ public RecompilableScriptFunctionData(final FunctionNode functionNode, final CodeInstaller<ScriptEnvironment> installer, final String allocatorClassName, final PropertyMap allocatorMap) { super(functionNode.isAnonymous() ? "" : functionNode.getIdent().getName(), functionNode.getParameters().size(), functionNode.isStrict(), false, true); this.functionNode = functionNode; this.source = functionNode.getSource(); this.token = tokenFor(functionNode); this.installer = installer; this.allocatorClassName = allocatorClassName; this.allocatorMap = allocatorMap; }
Example 2
Source File: RecompilableScriptFunctionData.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static String functionName(final FunctionNode fn) { if (fn.isAnonymous()) { return ""; } final FunctionNode.Kind kind = fn.getKind(); if (kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { final String name = NameCodec.decode(fn.getIdent().getName()); return name.substring(GET_SET_PREFIX_LENGTH); } return fn.getIdent().getName(); }
Example 3
Source File: RecompilableScriptFunctionData.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static String functionName(final FunctionNode fn) { if (fn.isAnonymous()) { return ""; } final FunctionNode.Kind kind = fn.getKind(); if (kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { final String name = NameCodec.decode(fn.getIdent().getName()); return name.substring(GET_SET_PREFIX_LENGTH); } return fn.getIdent().getName(); }
Example 4
Source File: RecompilableScriptFunctionData.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static String functionName(final FunctionNode fn) { if (fn.isAnonymous()) { return ""; } final FunctionNode.Kind kind = fn.getKind(); if (kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { final String name = NameCodec.decode(fn.getIdent().getName()); return name.substring(GET_SET_PREFIX_LENGTH); } return fn.getIdent().getName(); }
Example 5
Source File: RecompilableScriptFunctionData.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static String functionName(final FunctionNode fn) { if (fn.isAnonymous()) { return ""; } final FunctionNode.Kind kind = fn.getKind(); if (kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { final String name = NameCodec.decode(fn.getIdent().getName()); return name.substring(GET_SET_PREFIX_LENGTH); } return fn.getIdent().getName(); }
Example 6
Source File: RecompilableScriptFunctionData.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
private static String functionName(final FunctionNode fn) { if (fn.isAnonymous()) { return ""; } final FunctionNode.Kind kind = fn.getKind(); if (kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { final String name = NameCodec.decode(fn.getIdent().getName()); return name.substring(GET_SET_PREFIX_LENGTH); } return fn.getIdent().getName(); }
Example 7
Source File: RecompilableScriptFunctionData.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private static String functionName(final FunctionNode fn) { if (fn.isAnonymous()) { return ""; } final FunctionNode.Kind kind = fn.getKind(); if (kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { final String name = NameCodec.decode(fn.getIdent().getName()); return name.substring(GET_SET_PREFIX_LENGTH); } return fn.getIdent().getName(); }
Example 8
Source File: RecompilableScriptFunctionData.java From hottub with GNU General Public License v2.0 | 5 votes |
private static String functionName(final FunctionNode fn) { if (fn.isAnonymous()) { return ""; } final FunctionNode.Kind kind = fn.getKind(); if (kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { final String name = NameCodec.decode(fn.getIdent().getName()); return name.substring(GET_SET_PREFIX_LENGTH); } return fn.getIdent().getName(); }
Example 9
Source File: RecompilableScriptFunctionData.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
private static String functionName(final FunctionNode fn) { if (fn.isAnonymous()) { return ""; } else { final FunctionNode.Kind kind = fn.getKind(); if (kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { final String name = NameCodec.decode(fn.getIdent().getName()); return name.substring(4); // 4 is "get " or "set " } else { return fn.getIdent().getName(); } } }
Example 10
Source File: RecompilableScriptFunctionData.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private static String functionName(final FunctionNode fn) { if (fn.isAnonymous()) { return ""; } else { final FunctionNode.Kind kind = fn.getKind(); if (kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { final String name = NameCodec.decode(fn.getIdent().getName()); return name.substring(4); // 4 is "get " or "set " } else { return fn.getIdent().getName(); } } }
Example 11
Source File: JSONWriter.java From nashorn with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { final boolean program = functionNode.isProgram(); if (program) { return emitProgram(functionNode); } enterDefault(functionNode); final String name; if (functionNode.isDeclared()) { name = "FunctionDeclaration"; } else { name = "FunctionExpression"; } type(name); comma(); property("id"); final FunctionNode.Kind kind = functionNode.getKind(); if (functionNode.isAnonymous() || kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { nullValue(); } else { functionNode.getIdent().accept(this); } comma(); array("params", functionNode.getParameters()); comma(); arrayStart("defaults"); arrayEnd(); comma(); property("rest"); nullValue(); comma(); property("body"); functionNode.getBody().accept(this); comma(); property("generator", false); comma(); property("expression", false); return leave(); }
Example 12
Source File: JSONWriter.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { final boolean program = functionNode.isProgram(); if (program) { return emitProgram(functionNode); } enterDefault(functionNode); final String name; if (functionNode.isDeclared()) { name = "FunctionDeclaration"; } else { name = "FunctionExpression"; } type(name); comma(); property("id"); final FunctionNode.Kind kind = functionNode.getKind(); if (functionNode.isAnonymous() || kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { nullValue(); } else { functionNode.getIdent().accept(this); } comma(); array("params", functionNode.getParameters()); comma(); arrayStart("defaults"); arrayEnd(); comma(); property("rest"); nullValue(); comma(); property("body"); functionNode.getBody().accept(this); comma(); property("generator", false); comma(); property("expression", false); return leave(); }
Example 13
Source File: JSONWriter.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { final boolean program = functionNode.isProgram(); if (program) { return emitProgram(functionNode); } enterDefault(functionNode); final String name; if (functionNode.isDeclared()) { name = "FunctionDeclaration"; } else { name = "FunctionExpression"; } type(name); comma(); property("id"); final FunctionNode.Kind kind = functionNode.getKind(); if (functionNode.isAnonymous() || kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { nullValue(); } else { functionNode.getIdent().accept(this); } comma(); array("params", functionNode.getParameters()); comma(); arrayStart("defaults"); arrayEnd(); comma(); property("rest"); nullValue(); comma(); property("body"); functionNode.getBody().accept(this); comma(); property("generator", false); comma(); property("expression", false); return leave(); }
Example 14
Source File: JSONWriter.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { final boolean program = functionNode.isProgram(); if (program) { return emitProgram(functionNode); } enterDefault(functionNode); final String name; if (functionNode.isDeclared()) { name = "FunctionDeclaration"; } else { name = "FunctionExpression"; } type(name); comma(); property("id"); final FunctionNode.Kind kind = functionNode.getKind(); if (functionNode.isAnonymous() || kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { nullValue(); } else { functionNode.getIdent().accept(this); } comma(); array("params", functionNode.getParameters()); comma(); arrayStart("defaults"); arrayEnd(); comma(); property("rest"); nullValue(); comma(); property("body"); functionNode.getBody().accept(this); comma(); property("generator", false); comma(); property("expression", false); return leave(); }
Example 15
Source File: JSONWriter.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { final boolean program = functionNode.isProgram(); if (program) { return emitProgram(functionNode); } enterDefault(functionNode); final String name; if (functionNode.isDeclared()) { name = "FunctionDeclaration"; } else { name = "FunctionExpression"; } type(name); comma(); property("id"); final FunctionNode.Kind kind = functionNode.getKind(); if (functionNode.isAnonymous() || kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { nullValue(); } else { functionNode.getIdent().accept(this); } comma(); array("params", functionNode.getParameters()); comma(); arrayStart("defaults"); arrayEnd(); comma(); property("rest"); nullValue(); comma(); property("body"); functionNode.getBody().accept(this); comma(); property("generator", false); comma(); property("expression", false); return leave(); }
Example 16
Source File: JSONWriter.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { final boolean program = functionNode.isProgram(); if (program) { return emitProgram(functionNode); } enterDefault(functionNode); final String name; if (functionNode.isDeclared()) { name = "FunctionDeclaration"; } else { name = "FunctionExpression"; } type(name); comma(); property("id"); final FunctionNode.Kind kind = functionNode.getKind(); if (functionNode.isAnonymous() || kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { nullValue(); } else { functionNode.getIdent().accept(this); } comma(); array("params", functionNode.getParameters()); comma(); arrayStart("defaults"); arrayEnd(); comma(); property("rest"); nullValue(); comma(); property("body"); functionNode.getBody().accept(this); comma(); property("generator", false); comma(); property("expression", false); return leave(); }
Example 17
Source File: JSONWriter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { final boolean program = functionNode.isProgram(); if (program) { return emitProgram(functionNode); } enterDefault(functionNode); final String name; if (functionNode.isDeclared()) { name = "FunctionDeclaration"; } else { name = "FunctionExpression"; } type(name); comma(); property("id"); final FunctionNode.Kind kind = functionNode.getKind(); if (functionNode.isAnonymous() || kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { nullValue(); } else { functionNode.getIdent().accept(this); } comma(); array("params", functionNode.getParameters()); comma(); arrayStart("defaults"); arrayEnd(); comma(); property("rest"); nullValue(); comma(); property("body"); functionNode.getBody().accept(this); comma(); property("generator", false); comma(); property("expression", false); return leave(); }
Example 18
Source File: JSONWriter.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { final boolean program = functionNode.isProgram(); if (program) { return emitProgram(functionNode); } enterDefault(functionNode); final String name; if (functionNode.isDeclared()) { name = "FunctionDeclaration"; } else { name = "FunctionExpression"; } type(name); comma(); property("id"); final FunctionNode.Kind kind = functionNode.getKind(); if (functionNode.isAnonymous() || kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { nullValue(); } else { functionNode.getIdent().accept(this); } comma(); array("params", functionNode.getParameters()); comma(); arrayStart("defaults"); arrayEnd(); comma(); property("rest"); nullValue(); comma(); property("body"); functionNode.getBody().accept(this); comma(); property("generator", false); comma(); property("expression", false); return leave(); }
Example 19
Source File: JSONWriter.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { final boolean program = functionNode.isProgram(); if (program) { return emitProgram(functionNode); } enterDefault(functionNode); final String name; if (functionNode.isDeclared()) { name = "FunctionDeclaration"; } else { name = "FunctionExpression"; } type(name); comma(); property("id"); final FunctionNode.Kind kind = functionNode.getKind(); if (functionNode.isAnonymous() || kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { nullValue(); } else { functionNode.getIdent().accept(this); } comma(); array("params", functionNode.getParameters()); comma(); arrayStart("defaults"); arrayEnd(); comma(); property("rest"); nullValue(); comma(); property("body"); functionNode.getBody().accept(this); comma(); property("generator", false); comma(); property("expression", false); return leave(); }
Example 20
Source File: JSONWriter.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { final boolean program = functionNode.isProgram(); if (program) { return emitProgram(functionNode); } enterDefault(functionNode); final String name; if (functionNode.isDeclared()) { name = "FunctionDeclaration"; } else { name = "FunctionExpression"; } type(name); comma(); property("id"); final FunctionNode.Kind kind = functionNode.getKind(); if (functionNode.isAnonymous() || kind == FunctionNode.Kind.GETTER || kind == FunctionNode.Kind.SETTER) { nullValue(); } else { functionNode.getIdent().accept(this); } comma(); array("params", functionNode.getParameters()); comma(); arrayStart("defaults"); arrayEnd(); comma(); property("rest"); nullValue(); comma(); property("body"); functionNode.getBody().accept(this); comma(); property("generator", false); comma(); property("expression", false); return leave(); }