Bug 23611
Summary: | Multiline Javascript comments cause incorrect parsing of following script. | ||
---|---|---|---|
Product: | WebKit | Reporter: | Mike Samuel <msamuel> |
Component: | JavaScriptCore | Assignee: | Nobody <webkit-unassigned> |
Status: | RESOLVED FIXED | ||
Severity: | Minor | CC: | barraclough, kangax, oliver |
Priority: | P2 | Keywords: | HasReduction, InRadar |
Version: | 528+ (Nightly build) | ||
Hardware: | PC | ||
OS: | All | ||
URL: | http://bugs.ecmascript.org/ticket/414 |
Mike Samuel
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 | ||
---|---|---|
Add attachment proposed patch, testcase, etc. |
Mark Rowe (bdash)
<rdar://problem/6538820>
kangax
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
Still happens in rev 55516.
kangax
Oh wow. This one is still in r70429.
Gavin Barraclough
Fixed in r89100