Java Code Examples for jdk.nashorn.internal.ir.FunctionNode#isDeclared()
The following examples show how to use
jdk.nashorn.internal.ir.FunctionNode#isDeclared() .
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: Attr.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { start(functionNode, false); if (functionNode.isLazy()) { return false; } //an outermost function in our lexical context that is not a program (runScript) //is possible - it is a function being compiled lazily if (functionNode.isDeclared()) { final Iterator<Block> blocks = lc.getBlocks(); if (blocks.hasNext()) { defineSymbol(blocks.next(), functionNode.getIdent().getName(), IS_VAR); } } returnTypes.push(functionNode.getReturnType()); pushLocalsFunction(); return true; }
Example 2
Source File: Attr.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { start(functionNode, false); if (functionNode.isLazy()) { return false; } //an outermost function in our lexical context that is not a program (runScript) //is possible - it is a function being compiled lazily if (functionNode.isDeclared()) { final Iterator<Block> blocks = lc.getBlocks(); if (blocks.hasNext()) { defineSymbol(blocks.next(), functionNode.getIdent().getName(), IS_VAR); } } returnTypes.push(functionNode.getReturnType()); pushLocalsFunction(); return true; }
Example 3
Source File: Attr.java From nashorn with GNU General Public License v2.0 | 6 votes |
@Override public boolean enterFunctionNode(final FunctionNode functionNode) { start(functionNode, false); if (functionNode.isLazy()) { return false; } //an outermost function in our lexical context that is not a program (runScript) //is possible - it is a function being compiled lazily if (functionNode.isDeclared()) { final Iterator<Block> blocks = lc.getBlocks(); if (blocks.hasNext()) { defineSymbol(blocks.next(), functionNode.getIdent().getName(), IS_VAR); } } returnTypes.push(functionNode.getReturnType()); pushLocalsFunction(); return true; }
Example 4
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(); }
Example 5
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 6
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 7
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 8
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 9
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 10
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 11
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 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 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(); }