src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java

Print this page

        

*** 3281,3291 **** body.accept(this); if(repeatLabel != continueLabel) { emitContinueLabel(continueLabel, liveLocalsOnContinue); } ! if (loopNode.hasPerIterationScope() && lc.getParentBlock().needsScope()) { // ES6 for loops with LET init need a new scope for each iteration. We just create a shallow copy here. method.loadCompilerConstant(SCOPE); method.invoke(virtualCallNoLookup(ScriptObject.class, "copy", ScriptObject.class)); method.storeCompilerConstant(SCOPE); } --- 3281,3291 ---- body.accept(this); if(repeatLabel != continueLabel) { emitContinueLabel(continueLabel, liveLocalsOnContinue); } ! if (loopNode.hasPerIterationScope() && lc.getCurrentBlock().needsScope()) { // ES6 for loops with LET init need a new scope for each iteration. We just create a shallow copy here. method.loadCompilerConstant(SCOPE); method.invoke(virtualCallNoLookup(ScriptObject.class, "copy", ScriptObject.class)); method.storeCompilerConstant(SCOPE); }