Title: [113270] trunk
Revision
113270
Author
[email protected]
Date
2012-04-04 17:56:54 -0700 (Wed, 04 Apr 2012)

Log Message

Parser fails to revert some state after parsing _expression_ and object literals.
https://bugs.webkit.org/show_bug.cgi?id=83236

Reviewed by Gavin Barraclough.

Source/_javascript_Core:

Reset left hand side counter after parsing the literals.

* parser/Parser.cpp:
(JSC::::parseObjectLiteral):
(JSC::::parseStrictObjectLiteral):
(JSC::::parseArrayLiteral):

LayoutTests:

Add more parser test cases.

* fast/js/parser-syntax-check-expected.txt:
* fast/js/script-tests/parser-syntax-check.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (113269 => 113270)


--- trunk/LayoutTests/ChangeLog	2012-04-05 00:48:08 UTC (rev 113269)
+++ trunk/LayoutTests/ChangeLog	2012-04-05 00:56:54 UTC (rev 113270)
@@ -1,3 +1,15 @@
+2012-04-04  Oliver Hunt  <[email protected]>
+
+        Parser fails to revert some state after parsing _expression_ and object literals.
+        https://bugs.webkit.org/show_bug.cgi?id=83236
+
+        Reviewed by Gavin Barraclough.
+
+        Add more parser test cases.
+
+        * fast/js/parser-syntax-check-expected.txt:
+        * fast/js/script-tests/parser-syntax-check.js:
+
 2012-04-04  Adam Klein  <[email protected]>
 
         Delay post-insertion notifications until new DOM tree is complete

Modified: trunk/LayoutTests/fast/js/parser-syntax-check-expected.txt (113269 => 113270)


--- trunk/LayoutTests/fast/js/parser-syntax-check-expected.txt	2012-04-05 00:48:08 UTC (rev 113269)
+++ trunk/LayoutTests/fast/js/parser-syntax-check-expected.txt	2012-04-05 00:56:54 UTC (rev 113270)
@@ -571,6 +571,10 @@
 PASS Valid:   "function f() { if (0) new a(b+c).d = 5 }"
 PASS Valid:   "if (0) new a(b+c) = 5"
 PASS Valid:   "function f() { if (0) new a(b+c) = 5 }"
+PASS Valid:   "([1 || 1].a = 1)"
+PASS Valid:   "function f() { ([1 || 1].a = 1) }"
+PASS Valid:   "({a: 1 || 1}.a = 1)"
+PASS Valid:   "function f() { ({a: 1 || 1}.a = 1) }"
 PASS e.line is 1
 PASS foo is 'PASS'
 PASS bar is 'PASS'

Modified: trunk/LayoutTests/fast/js/script-tests/parser-syntax-check.js (113269 => 113270)


--- trunk/LayoutTests/fast/js/script-tests/parser-syntax-check.js	2012-04-05 00:48:08 UTC (rev 113269)
+++ trunk/LayoutTests/fast/js/script-tests/parser-syntax-check.js	2012-04-05 00:56:54 UTC (rev 113270)
@@ -363,6 +363,8 @@
 valid("if (0) obj.foo\\u03bb; ")
 valid("if (0) new a(b+c).d = 5");
 valid("if (0) new a(b+c) = 5");
+valid("([1 || 1].a = 1)");
+valid("({a: 1 || 1}.a = 1)");
 
 try { eval("a.b.c = {};"); } catch(e1) { e=e1; shouldBe("e.line", "1") }
 foo = 'FAIL';

Modified: trunk/Source/_javascript_Core/ChangeLog (113269 => 113270)


--- trunk/Source/_javascript_Core/ChangeLog	2012-04-05 00:48:08 UTC (rev 113269)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-04-05 00:56:54 UTC (rev 113270)
@@ -1,3 +1,17 @@
+2012-04-04  Oliver Hunt  <[email protected]>
+
+        Parser fails to revert some state after parsing _expression_ and object literals.
+        https://bugs.webkit.org/show_bug.cgi?id=83236
+
+        Reviewed by Gavin Barraclough.
+
+        Reset left hand side counter after parsing the literals.
+
+        * parser/Parser.cpp:
+        (JSC::::parseObjectLiteral):
+        (JSC::::parseStrictObjectLiteral):
+        (JSC::::parseArrayLiteral):
+
 2012-04-04  Filip Pizlo  <[email protected]>
 
         DFG InstanceOf should not uselessly speculate cell

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (113269 => 113270)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2012-04-05 00:48:08 UTC (rev 113269)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2012-04-05 00:56:54 UTC (rev 113270)
@@ -1256,6 +1256,8 @@
     unsigned oldLineNumber = m_lexer->lineNumber();
     consumeOrFailWithFlags(OPENBRACE, TreeBuilder::DontBuildStrings);
     
+    int oldNonLHSCount = m_nonLHSCount;
+    
     if (match(CLOSEBRACE)) {
         next();
         return context.createObjectLiteral(m_lexer->lastLineNumber());
@@ -1291,6 +1293,8 @@
     
     consumeOrFail(CLOSEBRACE);
     
+    m_nonLHSCount = oldNonLHSCount;
+    
     return context.createObjectLiteral(m_lexer->lastLineNumber(), propertyList);
 }
 
@@ -1299,6 +1303,8 @@
 {
     consumeOrFail(OPENBRACE);
     
+    int oldNonLHSCount = m_nonLHSCount;
+
     if (match(CLOSEBRACE)) {
         next();
         return context.createObjectLiteral(m_lexer->lastLineNumber());
@@ -1335,7 +1341,9 @@
     }
     
     consumeOrFail(CLOSEBRACE);
-    
+
+    m_nonLHSCount = oldNonLHSCount;
+
     return context.createObjectLiteral(m_lexer->lastLineNumber(), propertyList);
 }
 
@@ -1344,6 +1352,8 @@
 {
     consumeOrFailWithFlags(OPENBRACKET, TreeBuilder::DontBuildStrings);
     
+    int oldNonLHSCount = m_nonLHSCount;
+    
     int elisions = 0;
     while (match(COMMA)) {
         next(TreeBuilder::DontBuildStrings);
@@ -1379,6 +1389,8 @@
     
     consumeOrFail(CLOSEBRACKET);
     
+    m_nonLHSCount = oldNonLHSCount;
+    
     return context.createArray(m_lexer->lastLineNumber(), elementList);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to