• keuchel@chromium.org's avatar
    Sync parser and preparser on do-while and return statements. · 410219c8
    keuchel@chromium.org authored
    This CL fixes the preparser to have the same liberal automatic semicolon
    insertion behaviour as the parser. In the case of a return statement in
    global code we throw a syntax error at runtime rather than an early error
    due to compatibility with KJS. However that hack allowed the following
    syntactically incorrect program in global code in the parser but not in
    the preparser:
      if (false) return else {}
    while the slightly saner version with the obligatory semicolon
      if (false) return; else {}
    was disallowed in the parser, but the preparser allowed it. This CL also
    fixes that issue.
    
    BUG=v8:1856
    TEST=cctest/test-parsing.cc
    
    Review URL: http://codereview.chromium.org/8844002
    
    git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10201 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
    410219c8
parser.cc 188 KB