Changeset 69963 in webkit


Ignore:
Timestamp:
Oct 18, 2010 9:30:12 AM (14 years ago)
Author:
zherczeg@webkit.org
Message:

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:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r69957 r69963  
     12010-10-18  Zoltan Herczeg  <zherczeg@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        if (0) throw "x" ; else { } throws parse error after r69906
     6        https://bugs.webkit.org/show_bug.cgi?id=47807
     7
     8        r69906 introduced a bug: the semicolon is not parsed after a throw
     9        expression anymore. Thus, the semicolon terminates the "if" parsing
     10        in the example above, and the else token results a parse error.
     11
     12        * parser/JSParser.cpp:
     13        (JSC::JSParser::parseThrowStatement):
     14
    1152010-10-18  Peter Varga  <pvarga@inf.u-szeged.hu>
    216
  • trunk/JavaScriptCore/parser/JSParser.cpp

    r69941 r69963  
    901901    int eEnd = lastTokenEnd();
    902902    int endLine = tokenLine();
     903    failIfFalse(autoSemiColon());
    903904
    904905    return context.createThrowStatement(expr, eStart, eEnd, startLine, endLine);
  • trunk/LayoutTests/ChangeLog

    r69958 r69963  
     12010-10-18  Zoltan Herczeg  <zherczeg@webkit.org>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        if (0) throw "x" ; else { } throws parse error after r69906
     6        https://bugs.webkit.org/show_bug.cgi?id=47807
     7
     8        Adding a new test case to break-ASI.js
     9
     10        * fast/js/break-ASI-expected.txt:
     11        * fast/js/script-tests/break-ASI.js:
     12
    1132010-10-18  Csaba Osztrogonác  <ossy@webkit.org>
    214
  • trunk/LayoutTests/fast/js/break-ASI-expected.txt

    r69906 r69963  
    1010PASS (function(){if (0) return
    1111;else return true;})() is true
     12PASS do { if(0) throw 'x';else true; } while (0) is true
    1213PASS if (0) throw
    1314'Shouldn't have parsed this.'; threw exception SyntaxError: Parse error.
  • trunk/LayoutTests/fast/js/script-tests/break-ASI.js

    r69906 r69963  
    44shouldBeTrue("do { if(0) continue\n;else true; } while (0)")
    55shouldBeTrue("(function(){if (0) return\n;else return true;})()")
     6shouldBeTrue("do { if(0) throw 'x';else true; } while (0)")
    67shouldThrow("if (0) throw\n'Shouldn\'t have parsed this.';")
    78
Note: See TracChangeset for help on using the changeset viewer.