src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/Block.java
Print this page
*** 54,64 ****
private final Label entryLabel;
/** Break label. */
private final Label breakLabel;
! /** Does the block/function need a new scope? */
protected final int flags;
/**
* @see JoinPredecessor
*/
--- 54,64 ----
private final Label entryLabel;
/** Break label. */
private final Label breakLabel;
! /** Does the block/function need a new scope? Is this synthetic? */
protected final int flags;
/**
* @see JoinPredecessor
*/
*** 78,87 ****
--- 78,92 ----
* outermost level of recompiles
*/
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
* @param finish The index of the last character
* @param flags The flags of the block
*** 106,127 ****
* @param token The first token of the block
* @param finish The index of the last character
* @param statements All statements in the block
*/
public Block(final long token, final int finish, final Statement...statements){
! this(token, finish, 0, statements);
}
/**
* Constructs a new block
*
* @param token The first token of the block
* @param finish The index of the last character
* @param statements All statements in the block
*/
public Block(final long token, final int finish, final List<Statement> statements){
! this(token, finish, 0, statements);
}
/**
* Constructor
*
--- 111,132 ----
* @param token The first token of the block
* @param finish The index of the last character
* @param statements All statements in the block
*/
public Block(final long token, final int finish, final Statement...statements){
! this(token, finish, IS_SYNTHETIC, statements);
}
/**
* Constructs a new block
*
* @param token The first token of the block
* @param finish The index of the last character
* @param statements All statements in the block
*/
public Block(final long token, final int finish, final List<Statement> statements){
! this(token, finish, IS_SYNTHETIC, statements);
}
/**
* Constructor
*
*** 364,373 ****
--- 369,387 ----
*/
public boolean needsScope() {
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) {
return this;
}