--- old/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Block.java 2015-03-09 18:38:57.603671156 +0530 +++ new/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Block.java 2015-03-09 18:38:57.515670716 +0530 @@ -56,7 +56,7 @@ /** Break label. */ private final Label breakLabel; - /** Does the block/function need a new scope? */ + /** Does the block/function need a new scope? Is this synthetic? */ protected final int flags; /** @@ -80,6 +80,11 @@ public static final int IS_GLOBAL_SCOPE = 1 << 3; /** + * Is this block a synthetic one introduced by Parser? + */ + public static final int IS_SYNTHETIC = 1 << 4; + + /** * Constructor * * @param token The first token of the block @@ -108,7 +113,7 @@ * @param statements All statements in the block */ public Block(final long token, final int finish, final Statement...statements){ - this(token, finish, 0, statements); + this(token, finish, IS_SYNTHETIC, statements); } /** @@ -119,7 +124,7 @@ * @param statements All statements in the block */ public Block(final long token, final int finish, final List statements){ - this(token, finish, 0, statements); + this(token, finish, IS_SYNTHETIC, statements); } /** @@ -366,6 +371,15 @@ return (flags & NEEDS_SCOPE) == NEEDS_SCOPE; } + /** + * Check whether this block is synthetic or not. + * + * @return true if this is a synthetic block + */ + public boolean isSynthetic() { + return (flags & IS_SYNTHETIC) == IS_SYNTHETIC; + } + @Override public Block setFlags(final LexicalContext lc, final int flags) { if (this.flags == flags) {