Closed Bug 397104 Opened 17 years ago Closed 13 years ago

Blockcomment containing at least one newline not treated as newline

Categories

(Core :: JavaScript Engine, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 475834

People

(Reporter: geckobugs, Unassigned)

Details

(Keywords: testcase)

Attachments

(1 file)

User-Agent:       Opera/9.20 (Windows NT 5.1; U; nb)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6

According to the ECMAScript spec, 

return /*

*/ someVariable;

should be executed as 

return 

someVariable;

i.e. return undefined, since automatic semicolon insertion will occur after return statement.

Reproducible: Always

Steps to Reproduce:
1.
2.
3.
Attached file Test case
Bug was actually found by David Andersson (liorean)
7.4 Comments

Comments behave like white space and are discarded except that, if a MultiLineComment contains a line terminator character, then the entire comment is considered to be a LineTerminator for purposes of parsing by the syntactic grammar.

7.9.1 Rules of Automatic Semicolon Insertion


ReturnStatement :
    return [no LineTerminator here] Expressionopt ;

Status: UNCONFIRMED → NEW
Ever confirmed: true
Brendan, would you like me to fuzz to find more bugs of this type?  If you think it's worth it, I can look for more bugs where "/*\n*/" and "\n" don't result in the same decompilation or disassembly (assuming bug 396512 gets fixed) or syntax error message.
Opera has the only browser hosted ECMAScript engines that comply to this part of the ES3 spec. Wouldn't it be better for interoperability to change the spec behaviour instead of all those "broken" engines?

I doubt there are any developers out there who expects that /**/ and /*\n*/ will give different results.
This is a dup of bug 475834, which in turn has been fixed in 1.9.1, so this bug report can be closed as well.
Dup'ing forward.

/be
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: