Closed Bug 1579792 Opened 5 years ago Closed 4 years ago

Function#toString on an arrow function with expression followed by single line comment and EOF contains the comment

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

RESOLVED FIXED
87 Branch
Tracking Status
firefox71 --- wontfix
firefox87 --- fixed

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

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: nobody → arai.unmht
Status: NEW → ASSIGNED

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.

Pushed by arai_a@mac.com: https://hg.mozilla.org/integration/autoland/rev/7c4508de726d Unget EOF token in Parser::{optionalExpr, memberExpr}. r=yulia
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → 87 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: