RESOLVED FIXED Bug 23611
Multiline Javascript comments cause incorrect parsing of following script.
https://bugs.webkit.org/show_bug.cgi?id=23611
Summary Multiline Javascript comments cause incorrect parsing of following script.
Mike Samuel
Reported 2009-01-28 21:44:38 PST
Chapter 5.1.2 of the recently approved ES3.1 spec, and the corresponding language from ES 262 say "A MultiLineComment? (that is, a comment of the form "/* ... */" regardless of whether it spans more than one line) is likewise simply discarded if it contains no line terminator, but if a MultiLineComment? contains one or more line terminators, then it is replaced with a single line terminator, which becomes part of the stream of inputs for the syntactic grammar." But the below returns 2 on Safari, when it should return 1. (function () { a: for (;;) { for (;;) { break/* */a; } return 1; } return 2; })() By way of explanation, the comment between break and a should introduce a newline, which since break is a restricted production, should cause it to break without a label (out of the inner loop), instead of breaking to the label a (the outer loop).
Attachments
Mark Rowe (bdash)
Comment 1 2009-01-28 23:07:49 PST
kangax
Comment 2 2010-02-22 06:01:22 PST
This is still an issue (as of r55043) A simple example demonstrating WebKit non-conformance in regards to replacing LineTerminator-containing multiline comment with LineTerminator: (function(){ return/* */1 })(); Expected: `undefined` Actual: `1`
kangax
Comment 3 2010-03-04 11:29:11 PST
Still happens in rev 55516.
kangax
Comment 4 2010-10-26 08:11:27 PDT
Oh wow. This one is still in r70429.
Gavin Barraclough
Comment 5 2011-06-16 18:53:45 PDT
Fixed in r89100
Note You need to log in before you can comment on or make changes to this bug.