Closed
Bug 1184597
Opened 9 years ago
Closed 9 years ago
Unnecessary test and assignment in Parser<FullParseHandler>::forStatement
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla42
Tracking | Status | |
---|---|---|
firefox42 | --- | fixed |
People
(Reporter: anba, Assigned: bbouvier)
Details
Attachments
(1 file)
1.23 KB,
patch
|
efaust
:
review+
|
Details | Diff | Splinter Review |
Just happened to notice this, could be cleaned up when someone touches that method (or the parser in general) again. http://hg.mozilla.org/mozilla-central/file/d8023b434e25/js/src/frontend/Parser.cpp#l4927 --- if (headKind == PNK_FOROF) { forStmt.type = (headKind == PNK_FOROF) ? STMT_FOR_OF_LOOP : STMT_FOR_IN_LOOP; ... } --- No reason to check |headKind| twice. http://hg.mozilla.org/mozilla-central/file/d8023b434e25/js/src/frontend/Parser.cpp#l5020 --- headKind = PNK_FORHEAD; --- The assignment to |headKind| is not needed, cf. http://hg.mozilla.org/mozilla-central/file/d8023b434e25/js/src/frontend/Parser.cpp#l4907 http://hg.mozilla.org/mozilla-central/file/d8023b434e25/js/src/frontend/Parser.cpp#l4918
Assignee | ||
Comment 1•9 years ago
|
||
Wow, nice find (even Coverity hasn't found it!). A quite simple patch too.
Attachment #8635223 -
Flags: review?(efaustbmo)
Reporter | ||
Comment 2•9 years ago
|
||
(In reply to Benjamin Bouvier [:bbouvier] from comment #1) > Created attachment 8635223 [details] [diff] [review] > redundant.patch > > Wow, nice find (even Coverity hasn't found it!). A quite simple patch too. To tell the truth I was unsure about filing this issue because it's that simple. :) The reassignment to headKind in l.5020 can be removed, too. Right?
Comment 3•9 years ago
|
||
Comment on attachment 8635223 [details] [diff] [review] redundant.patch uh. Yeahp.
Attachment #8635223 -
Flags: review?(efaustbmo) → review+
Assignee | ||
Comment 4•9 years ago
|
||
(In reply to André Bargull from comment #2) > (In reply to Benjamin Bouvier [:bbouvier] from comment #1) > > Created attachment 8635223 [details] [diff] [review] > > redundant.patch > > > > Wow, nice find (even Coverity hasn't found it!). A quite simple patch too. > > To tell the truth I was unsure about filing this issue because it's that > simple. :) > > The reassignment to headKind in l.5020 can be removed, too. Right? Indeed, I've changed it to an assert.
Comment 6•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/2ba437578597
Assignee: nobody → benj
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in
before you can comment on or make changes to this bug.
Description
•