Bug 23611

Summary: Multiline Javascript comments cause incorrect parsing of following script.
Product: WebKit Reporter: Mike Samuel <msamuel>
Component: JavaScriptCoreAssignee: 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

Description Mike Samuel 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).
Comment 1 Mark Rowe (bdash) 2009-01-28 23:07:49 PST
<rdar://problem/6538820>
Comment 2 kangax 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`
Comment 3 kangax 2010-03-04 11:29:11 PST
Still happens in rev 55516.
Comment 4 kangax 2010-10-26 08:11:27 PDT
Oh wow. This one is still in r70429.
Comment 5 Gavin Barraclough 2011-06-16 18:53:45 PDT
Fixed in r89100