Bug 1363191 - Pop eval lexical scope before propagating its var scope's Annex B functions. (r=anba)
☠☠ backed out by dc3008e45ba6 ☠ ☠
authorShu-yu Guo <shu@rfrn.org>
Tue, 09 May 2017 14:45:27 -0700
changeset 357444 cf2ee5242986e5d087ac48238a1fca8e96d6e1a9
parent 357443 8756a6262190bdd3945a873f80c6aadd41da3aad
child 357445 5a473a4e0eed937aea85cd97725dd93a85fbdf0c
push id31792
push usercbook@mozilla.com
push dateWed, 10 May 2017 13:07:59 +0000
treeherdermozilla-central@ebbcdaa5b580 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersanba
bugs1363191
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1363191 - Pop eval lexical scope before propagating its var scope's Annex B functions. (r=anba)
js/src/frontend/Parser.cpp
js/src/jit-test/tests/parser/bug-1363191.js
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -2093,31 +2093,34 @@ Parser<FullParseHandler, char16_t>::eval
     ParseContext evalpc(this, evalsc, /* newDirectives = */ nullptr);
     if (!evalpc.init())
         return nullptr;
 
     ParseContext::VarScope varScope(this);
     if (!varScope.init(pc))
         return nullptr;
 
-    // All evals have an implicit non-extensible lexical scope.
-    ParseContext::Scope lexicalScope(this);
-    if (!lexicalScope.init(pc))
-        return nullptr;
-
-    ParseNode* body = statementList(YieldIsName);
-    if (!body)
-        return nullptr;
-
-    if (!checkStatementsEOF())
-        return nullptr;
-
-    body = finishLexicalScope(lexicalScope, body);
-    if (!body)
-        return nullptr;
+    ParseNode* body;
+    {
+        // All evals have an implicit non-extensible lexical scope.
+        ParseContext::Scope lexicalScope(this);
+        if (!lexicalScope.init(pc))
+            return nullptr;
+
+        body = statementList(YieldIsName);
+        if (!body)
+            return nullptr;
+
+        if (!checkStatementsEOF())
+            return nullptr;
+
+        body = finishLexicalScope(lexicalScope, body);
+        if (!body)
+            return nullptr;
+    }
 
     // It's an error to use 'arguments' in a legacy generator expression.
     //
     // If 'arguments' appears free (i.e. not a declared name) or if the
     // declaration does not shadow the enclosing script's 'arguments'
     // binding (i.e. not a lexical declaration), check the enclosing
     // script.
     if (hasUsedName(context->names().arguments)) {
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/parser/bug-1363191.js
@@ -0,0 +1,2 @@
+eval("{ function f() {} }");
+let f;