Closed
Bug 1478911
Opened 6 years ago
Closed 6 years ago
Improve the error message when yield/await is used inside parameter
Categories
(Core :: JavaScript Engine, enhancement, P5)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla64
Tracking | Status | |
---|---|---|
firefox64 | --- | fixed |
People
(Reporter: arai, Assigned: Anushi1998, Mentored)
References
(Blocks 1 open bug)
Details
(Keywords: good-first-bug, Whiteboard: [lang=c++])
Attachments
(1 file, 2 obsolete files)
5.20 KB,
patch
|
Anushi1998
:
review+
|
Details | Diff | Splinter Review |
js> async function* f(a = yield) {}
typein:19:22 SyntaxError: yield in default expression:
typein:19:22 async function* f(a = yield) {}
typein:19:22 ......................^
js> async function* f(a = await 10) {}
typein:21:22 SyntaxError: await can't be used in default expression:
typein:21:22 async function* f(a = await 10) {}
typein:21:22 ......................^
js> async function* f([a = yield]) {}
typein:24:23 SyntaxError: yield in default expression:
typein:24:23 async function* f([a = yield]) {}
typein:24:23 .......................^
js> async function* f([a = await]) {}
typein:23:28 SyntaxError: expected expression, got ']':
typein:23:28 async function* f([a = await]) {}
typein:23:28 ............................^
the actual issue is that yield/await cannot be used in parameter, and it's not about whether it's in default expression.
(of course it can appear only in default parameter or destructuring default tho)
we should say something like:
* yield expression can't be used in parameter
* await expression can't be used in parameter
other browsers's output:
Safari
> function* f(a = yield) {}
SyntaxError: Unexpected keyword 'yield'. Cannot use yield expression within parameters.
> async function f(a = await 10) {}
SyntaxError: Unexpected identifier 'await'. Cannot use await expression within parameters.
Chrome
> function* f(a = yield) {}
Uncaught SyntaxError: Yield expression not allowed in formal parameter
> async function f(a = await 10) {}
Uncaught SyntaxError: Illegal await-expression in formal parameters of async function
things to do here:
1. fix the error message in js/src/js.msg
2. fix the name of the error message in js/src/js.msg, and its consumers
Reporter | ||
Updated•6 years ago
|
Priority: -- → P5
Comment 1•6 years ago
|
||
I want to solve this issue.
Reporter | ||
Comment 2•6 years ago
|
||
Thanks!
Let me know if you have any question.
here's instruction for preparing development environment and building Firefox.
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build
also you can look for the error message consumer here https://searchfox.org/
Once you've fixed it locally, please export it as a patch file and attach here, and ask review from me.
Reporter | ||
Comment 4•6 years ago
|
||
mayank is working on this bug (see comment #1).
there are similar bugs under bug 622261,
let me know if you need help finding a bug to work on (bug comment or :arai in #jsapi channel in irc)
Flags: needinfo?(arai.unmht)
Can somebody give me some pointers on where to start and also which file should I be looking at to fix this bug?
Comment 6•6 years ago
|
||
Can i go ahead for this bug
Comment 7•6 years ago
|
||
i solved it please ,if mayank hasn't done it i can post it in :)
Reporter | ||
Comment 8•6 years ago
|
||
sure, given that there's no activity for a while, you can take this over.
Comment 9•6 years ago
|
||
sorry i forgot to introduce myself ;
i am an undergrad in engineering and looking up for open source contribution ,setting goals for getting chance to be a part of gsoc and mozilla ;
i have a problem i changed file in my build (files) but now how to i submit it ,please help :)
Reporter | ||
Comment 10•6 years ago
|
||
basic workflow:
1. clone mozilla-unified (or mozilla-central)
2. modify file
3. create a changeset for the modification by "hg commit" command
a. the commit message should follow this rule https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Committing_Rules_and_Responsibilities#Checkin_comment
4. export the changeset by "hg export -r . > somewhere/bugNNNN.patch"
5. attach the file here, and ask review (there's review field in the attachment form)
if you've done 1-2, please try 3-5.
Assignee | ||
Comment 11•6 years ago
|
||
:arai, Is anybody working on this bug?
Flags: needinfo?(arai.unmht)
Reporter | ||
Comment 12•6 years ago
|
||
I'm not sure who's currently working on, but I'll assign this bug to anyone who posts the patch ;)
Flags: needinfo?(arai.unmht)
Comment 13•6 years ago
|
||
Is anyone working on this? I am new to opensource and i want take this up.
Assignee | ||
Comment 14•6 years ago
|
||
Yes I have completed it and will be submitting PR soon :)
Assignee | ||
Comment 15•6 years ago
|
||
Attachment #9007408 -
Flags: review?(arai.unmht)
Reporter | ||
Updated•6 years ago
|
Assignee: nobody → anushimaheshwari95
Status: NEW → ASSIGNED
Reporter | ||
Comment 16•6 years ago
|
||
Comment on attachment 9007408 [details] [diff] [review]
bug1478911.patch
Review of attachment 9007408 [details] [diff] [review]:
-----------------------------------------------------------------
Thank you for your patch :D
given the expected error message is changed, can you fix the following line as well?
https://searchfox.org/mozilla-central/rev/37663bb87004167184de6f2afa6b05875eb0528e/js/src/tests/non262/async-functions/await-in-parameters-of-async-func.js#23
this is just a message and this test doesn't fail, but nice to fix :)
Also, please change the first line of the commit message to follow this rule?
https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Committing_Rules_and_Responsibilities#Commit_message_restrictions
basically, "Bug NNNNNN - description of the change"
::: js/src/js.msg
@@ +188,4 @@
> MSG_DEF(JSMSG_ARRAY_INIT_TOO_BIG, 0, JSEXN_INTERNALERR, "array initializer too large")
> MSG_DEF(JSMSG_AS_AFTER_IMPORT_STAR, 0, JSEXN_SYNTAXERR, "missing keyword 'as' after import *")
> MSG_DEF(JSMSG_AS_AFTER_RESERVED_WORD, 1, JSEXN_SYNTAXERR, "missing keyword 'as' after reserved word '{0}'")
> +MSG_DEF(JSMSG_AWAIT_IN_PARAMETER, 0, JSEXN_SYNTAXERR, "await expression can't be used in parameter")
please align "0" to "1" in the previous line
Attachment #9007408 -
Flags: review?(arai.unmht) → feedback+
Assignee | ||
Comment 17•6 years ago
|
||
Attachment #9007410 -
Flags: review?(arai.unmht)
Reporter | ||
Comment 18•6 years ago
|
||
Comment on attachment 9007410 [details] [diff] [review]
bug1478911.patch
Review of attachment 9007410 [details] [diff] [review]:
-----------------------------------------------------------------
Excellent :D
here's try run, which executes automated tests (with previous patch, but the result should be same)
https://treeherder.mozilla.org/#/jobs?repo=try&revision=3a8b7bed8badb07801940dd105b903eba2d2864c&group_state=expanded
if it completes without any failure, you can add "checkin-needed" keyword to this bug, so that this patch will be landed shortly.
also, you can mark the previous patch "obsolete" when attaching new patch.
now you can mark it obsolete in attachment details page above.
Attachment #9007410 -
Flags: review?(arai.unmht) → review+
Assignee | ||
Updated•6 years ago
|
Attachment #9007408 -
Attachment is obsolete: true
Assignee | ||
Comment 19•6 years ago
|
||
Thanks :arai :)
Reporter | ||
Comment 20•6 years ago
|
||
I overlooked that the bug number in the commit message is wrong.
can you fix it to "Bug 1478911" ?
Flags: needinfo?(anushimaheshwari95)
Reporter | ||
Comment 21•6 years ago
|
||
also, when attaching, you can add "r=arai" at the end of the commit message, first line,
and choose "+" for "review" (please declare that you're carrying forward the previous review, in the comment)
the try run looks fine. after attaching the updated patch, you can add "checkin-needed" keyword.
Assignee | ||
Comment 22•6 years ago
|
||
Carrying forward previous review.
Flags: needinfo?(anushimaheshwari95)
Attachment #9007419 -
Flags: review+
Attachment #9007419 -
Flags: checkin+
Reporter | ||
Comment 23•6 years ago
|
||
not, "checkin" flag.
add "checkin-needed" to "Keyword" under "Tracking" section
Assignee | ||
Updated•6 years ago
|
Attachment #9007419 -
Flags: checkin+
Assignee | ||
Updated•6 years ago
|
Keywords: checkin-needed
Reporter | ||
Updated•6 years ago
|
Attachment #9007410 -
Attachment is obsolete: true
Comment 24•6 years ago
|
||
Pushed by toros@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/5208ae2ec7da
Changed error message and name of error for `JSMSG_AWAIT_IN_DEFAULT` and `JSMSG_YIELD_IN_PARAMETER` and corresponding change in consumer files. r=arai
Keywords: checkin-needed
Comment 25•6 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox64:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in
before you can comment on or make changes to this bug.
Description
•