< prev index next >
src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ForNode.java
Print this page
@@ -272,6 +272,16 @@
@Override
public boolean hasPerIterationScope() {
return (flags & PER_ITERATION_SCOPE) != 0;
}
+
+ /**
+ * Returns true if this for-node needs the scope creator of its containing block to create
+ * per-iteration scope. This is only true for for-in loops with lexical declarations.
+ *
+ * @return true if the containing block's scope object creator is required in codegen
+ */
+ public boolean needsScopeCreator() {
+ return isForIn() && hasPerIterationScope();
+ }
}
< prev index next >