Closed Bug 1418235 Opened 2 years ago Closed 2 years ago

Remove/Simplify parenthesised name tracking in SyntaxParseHandler

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: anba, Assigned: anba)

References

Details

Attachments

(1 file)

From https://searchfox.org/mozilla-central/rev/9bab9dc5a9472e3c163ab279847d2249322c206e/js/src/frontend/SyntaxParseHandler.h#62-75
---
...
[(a)] = [3]; [(obj.prop)] = [4]; // invalid ES6 syntax
...
---

But that's actually correct ES6 syntax.

That means we could potentially simplify the various Node{Unparenthesized, Parenthesized}XYZName types in SyntaxParseHandler, because it's not actually necessary to differentiate between parenthesised and unparenthesised names.
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED
Attached patch bug1418235.patchSplinter Review
We don't (or no longer?) need to differentiate between unparenthesised and parenthesised names in the syntax parse handler. This allows us to merge NodeParenthesized(Arguments|Eval)Name and NodeUnparenthesized(Arguments|Eval)Name, so we only have NodeName, NodeArgumentsName, and NodeEvalName. The check methods have been renamed accordingly (isName(), isArgumentsName(), and isEvalName()).

Furthermore we can move the nameIsArgumentsOrEval() method from FullParseHandler and the SyntaxParseHandler to the parser, so we don't have two identical copies of the same code.
Attachment #8929484 - Flags: review?(arai.unmht)
Comment on attachment 8929484 [details] [diff] [review]
bug1418235.patch

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

Great refactoring :D
Attachment #8929484 - Flags: review?(arai.unmht) → review+
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ba0c13798895
Simplify tracking of parenthesized names in SyntaxParseHandler. r=arai
Keywords: checkin-needed
Priority: -- → P3
https://hg.mozilla.org/mozilla-central/rev/ba0c13798895
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.