src/jdk/nashorn/internal/ir/VarNode.java

Print this page

        

*** 43,65 **** private final Expression init; /** Is this a var statement (as opposed to a "var" in a for loop statement) */ private final int flags; - /** Flag that determines if this function node is a statement */ - public static final int IS_STATEMENT = 1 << 0; - /** Flag for ES6 LET declaration */ ! public static final int IS_LET = 1 << 1; /** Flag for ES6 CONST declaration */ ! public static final int IS_CONST = 1 << 2; /** Flag that determines if this is the last function declaration in a function * This is used to micro optimize the placement of return value assignments for * a program node */ ! public static final int IS_LAST_FUNCTION_DECLARATION = 1 << 3; /** * Constructor * * @param lineNumber line number --- 43,62 ---- private final Expression init; /** Is this a var statement (as opposed to a "var" in a for loop statement) */ private final int flags; /** Flag for ES6 LET declaration */ ! public static final int IS_LET = 1 << 0; /** Flag for ES6 CONST declaration */ ! public static final int IS_CONST = 1 << 1; /** Flag that determines if this is the last function declaration in a function * This is used to micro optimize the placement of return value assignments for * a program node */ ! public static final int IS_LAST_FUNCTION_DECLARATION = 1 << 2; /** * Constructor * * @param lineNumber line number
*** 67,77 **** * @param finish finish * @param name name of variable * @param init init node or null if just a declaration */ public VarNode(final int lineNumber, final long token, final int finish, final IdentNode name, final Expression init) { ! this(lineNumber, token, finish, name, init, IS_STATEMENT); } private VarNode(final VarNode varNode, final IdentNode name, final Expression init, final int flags) { super(varNode); this.name = init == null ? name : name.setIsInitializedHere(); --- 64,74 ---- * @param finish finish * @param name name of variable * @param init init node or null if just a declaration */ public VarNode(final int lineNumber, final long token, final int finish, final IdentNode name, final Expression init) { ! this(lineNumber, token, finish, name, init, 0); } private VarNode(final VarNode varNode, final IdentNode name, final Expression init, final int flags) { super(varNode); this.name = init == null ? name : name.setIsInitializedHere();
*** 258,275 **** public VarNode setFlag(final int flag) { return setFlags(flags | flag); } /** - * Returns true if this is a var statement (as opposed to a var initializer in a for loop). - * @return true if this is a var statement (as opposed to a var initializer in a for loop). - */ - public boolean isStatement() { - return (flags & IS_STATEMENT) != 0; - } - - /** * Returns true if this is a function declaration. * @return true if this is a function declaration. */ public boolean isFunctionDeclaration() { return init instanceof FunctionNode && ((FunctionNode)init).isDeclared(); --- 255,264 ----