src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java

Print this page

        

@@ -701,30 +701,16 @@
                 FunctionNode.Kind.SCRIPT,
                 functionLine,
                 Collections.<IdentNode>emptyList());
         lc.push(script);
         final ParserContextBlockNode body = newBlock();
-        // If ES6 block scope is enabled add a per-script block for top-level LET and CONST declarations.
-        final int startLine = start;
-        final ParserContextBlockNode outer = useBlockScope() ? newBlock() : null;
-        functionDeclarations = new ArrayList<>();
 
-        try {
+        functionDeclarations = new ArrayList<>();
             sourceElements(allowPropertyFunction);
             addFunctionDeclarations(script);
-        } finally {
-            if (outer != null) {
-                restoreBlock(outer);
-                appendStatement(new BlockStatement(
-                        startLine,
-                        new Block(
-                                functionToken,
-                                startLine, outer.getFlags(),
-                                outer.getStatements())));
-            }
-        }
         functionDeclarations = null;
+
         restoreBlock(body);
         body.setFlag(Block.NEEDS_SCOPE);
         final Block programBody = new Block(functionToken, functionLine, body.getFlags(), body.getStatements());
         lc.pop(script);
         script.setLastToken(token);