Title: [181503] trunk
Revision
181503
Author
[email protected]
Date
2015-03-14 21:58:55 -0700 (Sat, 14 Mar 2015)

Log Message

parseClass should popScope after pushScope
https://bugs.webkit.org/show_bug.cgi?id=142689

Reviewed by Benjamin Poulain.

Source/_javascript_Core:

Pop the parser scope as needed.

* parser/Parser.cpp:
(JSC::Parser<LexerType>::parseClass):

LayoutTests:

Added a regression test for the test case that caught this bug.

* TestExpectations: Skipped the test since ES6 class syntax isn't enabled by default.
* js/class-syntax-scoping-expected.txt: Added.
* js/class-syntax-scoping.html: Added.
* js/script-tests/class-syntax-scoping.js: Added.
(test):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (181502 => 181503)


--- trunk/LayoutTests/ChangeLog	2015-03-14 22:54:46 UTC (rev 181502)
+++ trunk/LayoutTests/ChangeLog	2015-03-15 04:58:55 UTC (rev 181503)
@@ -1,3 +1,18 @@
+2015-03-14  Ryosuke Niwa  <[email protected]>
+
+        parseClass should popScope after pushScope
+        https://bugs.webkit.org/show_bug.cgi?id=142689
+
+        Reviewed by Benjamin Poulain.
+
+        Added a regression test for the test case that caught this bug.
+
+        * TestExpectations: Skipped the test since ES6 class syntax isn't enabled by default.
+        * js/class-syntax-scoping-expected.txt: Added.
+        * js/class-syntax-scoping.html: Added.
+        * js/script-tests/class-syntax-scoping.js: Added.
+        (test):
+
 2015-03-14  Michael Saboff  <[email protected]>
 
         ES6: Add binary and octal literal support

Modified: trunk/LayoutTests/TestExpectations (181502 => 181503)


--- trunk/LayoutTests/TestExpectations	2015-03-14 22:54:46 UTC (rev 181502)
+++ trunk/LayoutTests/TestExpectations	2015-03-15 04:58:55 UTC (rev 181503)
@@ -71,6 +71,7 @@
 webkit.org/b/140491 js/class-syntax-declaration.html [ Failure ]
 webkit.org/b/140491 js/class-syntax-_expression_.html [ Failure ]
 webkit.org/b/140491 js/class-syntax-extends.html [ Failure ]
+webkit.org/b/140491 js/class-syntax-scoping.html [ Failure ]
 webkit.org/b/140491 js/class-syntax-super.html [ Failure ]
 
 # This test verifies dynamic manipulation of the mroot and msqrt elements.

Added: trunk/LayoutTests/js/class-syntax-scoping-expected.txt (0 => 181503)


--- trunk/LayoutTests/js/class-syntax-scoping-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/js/class-syntax-scoping-expected.txt	2015-03-15 04:58:55 UTC (rev 181503)
@@ -0,0 +1,10 @@
+Tests for scoping of variables in ES6 class syntax
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS test() is "PASS"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/js/class-syntax-scoping.html (0 => 181503)


--- trunk/LayoutTests/js/class-syntax-scoping.html	                        (rev 0)
+++ trunk/LayoutTests/js/class-syntax-scoping.html	2015-03-15 04:58:55 UTC (rev 181503)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script src=""
+<script src=""
+<script src=""
+</body>
+</html>

Added: trunk/LayoutTests/js/script-tests/class-syntax-scoping.js (0 => 181503)


--- trunk/LayoutTests/js/script-tests/class-syntax-scoping.js	                        (rev 0)
+++ trunk/LayoutTests/js/script-tests/class-syntax-scoping.js	2015-03-15 04:58:55 UTC (rev 181503)
@@ -0,0 +1,16 @@
+//@ skip
+
+description('Tests for scoping of variables in ES6 class syntax');
+
+var local = "FAIL";
+function test() {
+    var local = "PASS";
+    class A {
+        getLocal(x) { return local; }
+    };
+    return new A().getLocal();
+}
+
+shouldBe('test()', '"PASS"');
+
+var successfullyParsed = true;

Modified: trunk/Source/_javascript_Core/ChangeLog (181502 => 181503)


--- trunk/Source/_javascript_Core/ChangeLog	2015-03-14 22:54:46 UTC (rev 181502)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-03-15 04:58:55 UTC (rev 181503)
@@ -1,3 +1,15 @@
+2015-03-14  Ryosuke Niwa  <[email protected]>
+
+        parseClass should popScope after pushScope
+        https://bugs.webkit.org/show_bug.cgi?id=142689
+
+        Reviewed by Benjamin Poulain.
+
+        Pop the parser scope as needed.
+
+        * parser/Parser.cpp:
+        (JSC::Parser<LexerType>::parseClass):
+
 2015-03-14  Dean Jackson  <[email protected]>
 
         Feature flag for Animations Level 2

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (181502 => 181503)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2015-03-14 22:54:46 UTC (rev 181502)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2015-03-15 04:58:55 UTC (rev 181503)
@@ -1552,6 +1552,7 @@
     // FIXME: Create a Miranda function instead.
     semanticFailIfFalse(constructor, "Class declaration without a constructor is not supported yet");
 
+    failIfFalse(popScope(classScope, TreeBuilder::NeedsFreeVariableInfo), "Parser error");
     consumeOrFail(CLOSEBRACE, "Expected a closing '}' after a class body");
 
     return context.createClassExpr(location, *className, constructor, parentClass, instanceMethods, staticMethods);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to