Closed Bug 1314083 Opened 3 years ago Closed 3 years ago

CoverInitName not supported in async arrow function parameters

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: anba, Assigned: anba)

Details

Attachments

(1 file, 1 obsolete file)

Test case:
---
async({a = 0}) => {}
---

Expected: No syntax error
Actual: Throws syntax error "missing : after property id"
Assignee: nobody → andrebargull
Attached patch Bug1314083.patch (obsolete) — Splinter Review
The detection of unparenthesized "async" in Parser::memberExpr() isn't necessary to fix this bug, I've only added it to give better error messages in some cases.
Attachment #8806375 - Flags: review?(arai.unmht)
Comment on attachment 8806375 [details] [diff] [review]
Bug1314083.patch

Review of attachment 8806375 [details] [diff] [review]:
-----------------------------------------------------------------

Thank you :D

::: js/src/tests/ecma_2017/AsyncFunctions/cover-init-name-syntax.js
@@ +44,5 @@
> +    typeof async({a = 1}, {b = 2}, {c = 3} = {});
> +`), SyntaxError);
> +assertThrowsInstanceOf(() => eval(`
> +    typeof async({a = 1}, {b = 2} = {}, {c = 3} = {});
> +`), SyntaxError);

would be nice to add |a.async({a = 1});| case too.
Attachment #8806375 - Flags: review?(arai.unmht) → review+
Updated patch to include additional test per review comment. Carrying r+ from arai.
Attachment #8806375 - Attachment is obsolete: true
Attachment #8807090 - Flags: review+
Keywords: checkin-needed
Pushed by cbook@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/8a36d67577d8
Handle destructuring-only syntax when initially parsing async arrow parameters. r=arai
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/8a36d67577d8
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in before you can comment on or make changes to this bug.