Closed
Bug 1304097
Opened 8 years ago
Closed 8 years ago
Use TokenStream::consumeKnownToken instead of TokenStream::getToken for known token.
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla52
Tracking | Status | |
---|---|---|
firefox52 | --- | fixed |
People
(Reporter: arai, Assigned: vinayakagarwal6996, Mentored)
Details
(Keywords: good-first-bug, Whiteboard: [good first bug][lang=c++])
Attachments
(1 file, 1 obsolete file)
839 bytes,
patch
|
arai
:
review+
|
Details | Diff | Splinter Review |
https://dxr.mozilla.org/mozilla-central/rev/f0f15b7c6aa77a0c5750918aa0a1cb3dc82185bc/js/src/frontend/Parser.cpp#4531 > if (!tokenStream.peekToken(&tt)) > return null(); > > if (tt == TOK_COMMA) { > if (!tokenStream.getToken(&tt) || !tokenStream.getToken(&tt)) > return null(); the first |tokenStream.getToken(&tt)| gets the token that is peeked by |tokenStream.peekToken(&tt)| above, and it's known to be TOK_COMMA. We should use |tokenStream.consumeKnownToken(tt);| instead.
Hi, I am new here and would like to fix this bug. Could you tell me how to proceed?
Reporter | ||
Comment 2•8 years ago
|
||
Hi :) Here's documents explaining workflow. https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build https://mozilla-version-control-tools.readthedocs.io/en/latest/hgmozilla/firefoxworkflow.html Basically, clone the tree, fix the bug, make it a patch and post, and ask review. If you have any question, feel free to ask here or in IRC #introduction channel. https://wiki.mozilla.org/IRC
Assignee | ||
Comment 3•8 years ago
|
||
Hello, I am a first timer. I looked up consumeKnownToken here: https://dxr.mozilla.org/mozilla-central/source/js/src/frontend/TokenStream.h According to this, consumeKnownToken returns void. So if it is in an if statement, it will give an error. Please correct me where I am wrong Thanks!
Reporter | ||
Comment 4•8 years ago
|
||
You can move it out of if's condition. consumeKnownToken never fails, unless it's called wrongly, like the passed TokenKind doesn't match to the token in lookahead buffer. and if it fails, it intentionally crashes (on debug build), instead of returning falsy value.
Assignee | ||
Comment 5•8 years ago
|
||
Please review the patch. Thanks!
Attachment #8793175 -
Flags: review?(arai.unmht)
Reporter | ||
Comment 6•8 years ago
|
||
Comment on attachment 8793175 [details] [diff] [review] Used consumeKnownToken followed by the required if statement Review of attachment 8793175 [details] [diff] [review]: ----------------------------------------------------------------- thank you for your patch :) it would be nice to build and test patch locally, before attaching. here's build documentation for SpiderMonkey shell: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Build_Documentation whole Firefox: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Build_Instructions/Simple_Firefox_build ::: js/src/frontend/Parser.cpp @@ +4528,4 @@ > return null(); > > if (tt == TOK_COMMA) { > + tokenStream.consumeKnownToken(&tt); consumeKnownToken receives TokenKind, not TokenKind*. so you don't need "&".
Attachment #8793175 -
Flags: review?(arai.unmht) → feedback+
Reporter | ||
Comment 7•8 years ago
|
||
Aaron, if you're looking for C++ bug, I've filed bug 1304310, feel free to take it.
Assignee | ||
Comment 8•8 years ago
|
||
Please review the commit. I built it and it gave no errors
Attachment #8793460 -
Flags: review?(arai.unmht)
Reporter | ||
Comment 9•8 years ago
|
||
Comment on attachment 8793460 [details] [diff] [review] used consumeKnownToken(tt) please check "patch" when attaching ;)
Attachment #8793460 -
Attachment is patch: true
Reporter | ||
Comment 10•8 years ago
|
||
Comment on attachment 8793175 [details] [diff] [review] Used consumeKnownToken followed by the required if statement and also mark previous patch "obsolete"
Attachment #8793175 -
Attachment is obsolete: true
Reporter | ||
Updated•8 years ago
|
Assignee: nobody → vinayakagarwal6996
Status: NEW → ASSIGNED
Reporter | ||
Comment 11•8 years ago
|
||
Comment on attachment 8793460 [details] [diff] [review] used consumeKnownToken(tt) Review of attachment 8793460 [details] [diff] [review]: ----------------------------------------------------------------- perfect :)
Attachment #8793460 -
Flags: review?(arai.unmht) → review+
Assignee | ||
Comment 12•8 years ago
|
||
(In reply to Tooru Fujisawa [:arai] from comment #10) > Comment on attachment 8793175 [details] [diff] [review] > Used consumeKnownToken followed by the required if statement > > and also mark previous patch "obsolete" Where is the option to mark the patch obselete? I couldn't see it. Thanks!
Reporter | ||
Comment 13•8 years ago
|
||
in attachment form, above the comment field.
Reporter | ||
Comment 14•8 years ago
|
||
here's try run https://treeherder.mozilla.org/#/jobs?repo=try&revision=fda2e532946c (your changeset is not shown there but it's there in parent of the changeset)
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Comment 15•8 years ago
|
||
Pushed by cbook@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/ff8d7c4926fb Used consumeKnownToken instead of getToken. r=arai
Keywords: checkin-needed
Comment 16•8 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/ff8d7c4926fb
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla52
You need to log in
before you can comment on or make changes to this bug.
Description
•