New issue
Advanced search Search tips

Issue 806548 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Feb 2018
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Return followed by a comment will return undefined/void

Reported by nunomigu...@gmail.com, Jan 28 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36

Steps to reproduce the problem:
The following code:

var test = /* test 1
test 2
*/ "ok";

assigns "ok" to the variable 'test'.

> test
"ok"

However, the following code:

function test() {
 return /* test1
 test 2
 */ "ok";
}

Will not return "ok" when I call the function:

> test()
undefined

This is because the comment has a line break.

This seems to do the expected:

function test() {
 return /* test1 test 2 */ "ok";
}

> test()
"ok"

What is the expected behavior?

What went wrong?
My understanding is that comments should be ignored, and line breaks shouldn't affect the way a comment is parsed. Shouldn't test() return "ok" in the example with the multi-line comment?

Did this work before? N/A 

Chrome version: 63.0.3239.132  Channel: stable
OS Version: 10.0
Flash Version:
 

Comment 1 by woxxom@gmail.com, Jan 28 2018

This is working as intended.
Quoting the spec http://www.ecma-international.org/ecma-262/5.1/#sec-7.4

     if a MultiLineComment contains a line terminator character, then the entire comment is considered to be a LineTerminator 
Labels: Needs-Triage-M63
Components: -Blink Blink>JavaScript
Labels: Triaged-ET M-66 FoundIn-66 Target-66 OS-Linux OS-Mac
Status: Untriaged (was: Unconfirmed)
Able to reproduce this issue on Mac 10.12.6, Win-10 and Ubuntu 14.04 using chrome reported version #63.0.3239.132, latest stable #64.0.3282.119 and latest canary #66.0.3334.0.
This is a non-regression issue as it is observed from M60 old builds. 

Hence, marking it as untriaged to get more inputs from dev team.

Thanks...!!
Status: WontFix (was: Untriaged)
WAI as indicated in #1.

Sign in to add a comment