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:
,
Jan 28 2018
,
Jan 29 2018
,
Jan 30 2018
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...!!
,
Feb 6 2018
WAI as indicated in #1. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by woxxom@gmail.com
, Jan 28 2018