Function#toString on an arrow function with expression followed by single line comment and EOF contains the comment
Categories
(Core :: JavaScript Engine, defect, P3)
Tracking
()
People
(Reporter: arai, Assigned: arai)
Details
(Keywords: parity-chrome, parity-edge, parity-safari)
Attachments
(1 file)
originally reported by https://twitter.com/ziyunfei/status/1170975016248176641
testcase:
print(eval(`
()=>1//comment
`).toString());
print(eval(`
()=>1//comment
;
`).toString());
the first one contains the single line comment (and also newline),
the second one doesn't.
looks like this issue happens only when the comment is followed by EOF
Comment 1•4 years ago
|
||
I made a whole demo page before finding this bug already been reported here.
https://croquet.io/static/func-to-string.html
This actually caused me a long trouble-shooting session that I finally tracked down to a mixin class after webpack replaced the source code with eval, which worked fine on any browser but Firefox.
Assignee | ||
Updated•4 years ago
|
Assignee | ||
Comment 2•4 years ago
|
||
Consumers of memberExpr and optionalExpr expect the currentToken to be the
last token of the expression after calling them.
If they hit EOF, the EOF token should be unget before returning.
Comment 4•4 years ago
|
||
bugherder |
Updated•4 years ago
|
Description
•