Changeset 106297 in webkit
- Timestamp:
- Jan 30, 2012 3:59:20 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r106294 r106297 1 2012-01-30 Oliver Hunt <oliver@apple.com> 2 3 Unexpected syntax error 4 https://bugs.webkit.org/show_bug.cgi?id=77340 5 6 Reviewed by Gavin Barraclough. 7 8 Add new tests for correct parsing of new expressions 9 10 * fast/js/parser-syntax-check-expected.txt: 11 * fast/js/script-tests/parser-syntax-check.js: 12 (runTest): 13 (invalid): 14 1 15 2012-01-30 Tony Chang <tony@chromium.org> 2 16 -
trunk/LayoutTests/fast/js/parser-syntax-check-expected.txt
r89228 r106297 568 568 PASS Valid: "if (0) obj.foo\u03bb; " 569 569 PASS Valid: "function f() { if (0) obj.foo\u03bb; }" 570 PASS Valid: "if (0) new a(b+c).d = 5" 571 PASS Valid: "function f() { if (0) new a(b+c).d = 5 }" 572 PASS Valid: "if (0) new a(b+c) = 5" 573 PASS Valid: "function f() { if (0) new a(b+c) = 5 }" 570 574 PASS e.line is 1 571 575 PASS foo is 'PASS' -
trunk/LayoutTests/fast/js/script-tests/parser-syntax-check.js
r98407 r106297 3 3 ); 4 4 5 function runTest(_a, throws)5 function runTest(_a, errorType) 6 6 { 7 7 var success; … … 14 14 success = !(e instanceof SyntaxError); 15 15 } 16 if ( throws== !success) {17 if ( throws)16 if ((!!errorType) == !success) { 17 if (errorType) 18 18 testPassed('Invalid: "' + _a + '"'); 19 19 else 20 20 testPassed('Valid: "' + _a + '"'); 21 21 } else { 22 if ( throws)23 testFailed('Invalid: "' + _a + '" should throw SyntaxError: Parse error');22 if (errorType) 23 testFailed('Invalid: "' + _a + '" should throw ' + errorType.name); 24 24 else 25 testFailed('Valid: "' + _a + '" should NOT throw SyntaxError: Parse error');25 testFailed('Valid: "' + _a + '" should NOT throw '); 26 26 } 27 27 } … … 34 34 } 35 35 36 function invalid(_a )36 function invalid(_a, _type) 37 37 { 38 _type = _type || SyntaxError; 38 39 // Test both the grammar and the syntax checker 39 40 runTest(_a, true); … … 361 362 valid("if (0) obj.foo_; ") 362 363 valid("if (0) obj.foo\\u03bb; ") 364 valid("if (0) new a(b+c).d = 5"); 365 valid("if (0) new a(b+c) = 5"); 363 366 364 367 try { eval("a.b.c = {};"); } catch(e1) { e=e1; shouldBe("e.line", "1") } -
trunk/Source/JavaScriptCore/ChangeLog
r106296 r106297 1 2012-01-30 Oliver Hunt <oliver@apple.com> 2 3 Unexpected syntax error 4 https://bugs.webkit.org/show_bug.cgi?id=77340 5 6 Reviewed by Gavin Barraclough. 7 8 Function calls and new expressions have the same semantics for 9 assignment, so should simply share their lhs handling. 10 11 * parser/Parser.cpp: 12 (JSC::::parseMemberExpression): 13 1 14 2012-01-30 Gavin Barraclough <barraclough@apple.com> 2 15 -
trunk/Source/JavaScriptCore/parser/Parser.cpp
r105638 r106297 1513 1513 case OPENPAREN: { 1514 1514 m_nonTrivialExpressionCount++; 1515 int nonLHSCount = m_nonLHSCount; 1515 1516 if (newCount) { 1516 1517 newCount--; 1517 if (match(OPENPAREN)) { 1518 int exprEnd = lastTokenEnd(); 1519 TreeArguments arguments = parseArguments(context); 1520 failIfFalse(arguments); 1521 base = context.createNewExpr(m_lexer->lastLineNumber(), base, arguments, start, exprEnd, lastTokenEnd()); 1522 } else 1523 base = context.createNewExpr(m_lexer->lastLineNumber(), base, start, lastTokenEnd()); 1518 int exprEnd = lastTokenEnd(); 1519 TreeArguments arguments = parseArguments(context); 1520 failIfFalse(arguments); 1521 base = context.createNewExpr(m_lexer->lastLineNumber(), base, arguments, start, exprEnd, lastTokenEnd()); 1524 1522 } else { 1525 int nonLHSCount = m_nonLHSCount;1526 1523 int expressionEnd = lastTokenEnd(); 1527 1524 TreeArguments arguments = parseArguments(context); 1528 1525 failIfFalse(arguments); 1529 1526 base = context.makeFunctionCallNode(m_lexer->lastLineNumber(), base, arguments, expressionStart, expressionEnd, lastTokenEnd()); 1530 m_nonLHSCount = nonLHSCount;1531 1527 } 1528 m_nonLHSCount = nonLHSCount; 1532 1529 break; 1533 1530 }
Note: See TracChangeset
for help on using the changeset viewer.