Skip to content
Permalink
Browse files
2010-10-18 Zoltan Herczeg <zherczeg@webkit.org>
        Reviewed by Oliver Hunt.

        if (0) throw "x" ; else { } throws parse error after r69906
        https://bugs.webkit.org/show_bug.cgi?id=47807

        r69906 introduced a bug: the semicolon is not parsed after a throw
        expression anymore. Thus, the semicolon terminates the "if" parsing
        in the example above, and the else token results a parse error.

        * parser/JSParser.cpp:
        (JSC::JSParser::parseThrowStatement):
2010-10-18  Zoltan Herczeg  <zherczeg@webkit.org>

        Reviewed by Oliver Hunt.

        if (0) throw "x" ; else { } throws parse error after r69906
        https://bugs.webkit.org/show_bug.cgi?id=47807

        Adding a new test case to break-ASI.js

        * fast/js/break-ASI-expected.txt:
        * fast/js/script-tests/break-ASI.js:

Canonical link: https://commits.webkit.org/60529@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@69963 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Zoltan Herczeg committed Oct 18, 2010
1 parent 1710bd2 commit 42a87765b3f15329be513d0e8f045559751fb068
Showing 5 changed files with 29 additions and 0 deletions.
@@ -1,3 +1,17 @@
2010-10-18 Zoltan Herczeg <zherczeg@webkit.org>

Reviewed by Oliver Hunt.

if (0) throw "x" ; else { } throws parse error after r69906
https://bugs.webkit.org/show_bug.cgi?id=47807

r69906 introduced a bug: the semicolon is not parsed after a throw
expression anymore. Thus, the semicolon terminates the "if" parsing
in the example above, and the else token results a parse error.

* parser/JSParser.cpp:
(JSC::JSParser::parseThrowStatement):

2010-10-18 Peter Varga <pvarga@inf.u-szeged.hu>

Reviewed by Andreas Kling.
@@ -900,6 +900,7 @@ template <class TreeBuilder> TreeStatement JSParser::parseThrowStatement(TreeBui
failIfFalse(expr);
int eEnd = lastTokenEnd();
int endLine = tokenLine();
failIfFalse(autoSemiColon());

return context.createThrowStatement(expr, eStart, eEnd, startLine, endLine);
}
@@ -1,3 +1,15 @@
2010-10-18 Zoltan Herczeg <zherczeg@webkit.org>

Reviewed by Oliver Hunt.

if (0) throw "x" ; else { } throws parse error after r69906
https://bugs.webkit.org/show_bug.cgi?id=47807

Adding a new test case to break-ASI.js

* fast/js/break-ASI-expected.txt:
* fast/js/script-tests/break-ASI.js:

2010-10-18 Csaba Osztrogonác <ossy@webkit.org>

[Qt] Add platform specific expected results for new passing tests.
@@ -9,6 +9,7 @@ PASS do { if(0) continue
;else true; } while (0) is true
PASS (function(){if (0) return
;else return true;})() is true
PASS do { if(0) throw 'x';else true; } while (0) is true
PASS if (0) throw
'Shouldn't have parsed this.'; threw exception SyntaxError: Parse error.
PASS successfullyParsed is true
@@ -3,6 +3,7 @@ description("Test to make sure we don't incorrectly insert a semi colon after a
shouldBeTrue("do { if(0) break\n;else true; } while (0)")
shouldBeTrue("do { if(0) continue\n;else true; } while (0)")
shouldBeTrue("(function(){if (0) return\n;else return true;})()")
shouldBeTrue("do { if(0) throw 'x';else true; } while (0)")
shouldThrow("if (0) throw\n'Shouldn\'t have parsed this.';")

var successfullyParsed = true;

0 comments on commit 42a8776

Please sign in to comment.