Closed
Bug 1163851
Opened 10 years ago
Closed 10 years ago
Use InHandling to implement restrictions on |in| expressions in the first part of a for(;;) loop
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: Waldo, Assigned: Waldo)
References
Details
Attachments
(4 files)
4.19 KB,
patch
|
efaust
:
review+
|
Details | Diff | Splinter Review |
13.31 KB,
patch
|
efaust
:
review+
|
Details | Diff | Splinter Review |
3.20 KB,
patch
|
efaust
:
review+
|
Details | Diff | Splinter Review |
11.49 KB,
patch
|
efaust
:
review+
|
Details | Diff | Splinter Review |
Following up on all the infrastructure landed in bug 1155472. This is approximately a five-liner, modulo ripping out all the manual forparsingForInit maintenance code.
This is not a null change from a functionality point of view. At an absolute minimum, it's expected that this should be the case:
js> for (x => x in true; false; ) break;
typein:3:4 SyntaxError: invalid for/in left-hand side:
typein:3:4 for (x => x in true; false; ) break;
typein:3:4 ....^
But it's not in the current parsingForInit system.
Assignee | ||
Comment 1•10 years ago
|
||
No functionality change, but without this, later patches in the sequence would be buggy. Also a test for something I misread in the spec grammar. Stupid parser that makes it hard to straightforwardly implement the grammar.
Attachment #8605660 -
Flags: review?(efaustbmo)
Assignee | ||
Comment 2•10 years ago
|
||
Alternative to InForInit/NotInForInit I could pass an InHandling argument, but I'd somewhat prefer to leave that for methods that correspond to *actual* grammar terms and such. There's not a single grammar term Parser::variables corresponds to, so I'd prefer something sui generis.
Attachment #8605661 -
Flags: review?(efaustbmo)
Assignee | ||
Comment 3•10 years ago
|
||
Attachment #8605662 -
Flags: review?(efaustbmo)
Assignee | ||
Comment 4•10 years ago
|
||
Attachment #8605663 -
Flags: review?(efaustbmo)
Updated•10 years ago
|
Attachment #8605660 -
Flags: review?(efaustbmo) → review+
Comment 5•10 years ago
|
||
Comment on attachment 8605661 [details] [diff] [review]
Remove remaining tests of |pc->parsingForInit|
Review of attachment 8605661 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/frontend/Parser.cpp
@@ +3835,5 @@
> template <typename ParseHandler>
> typename ParseHandler::Node
> Parser<ParseHandler>::variables(YieldHandling yieldHandling,
> + ParseNodeKind kind,
> + ForInitLocation location,
not that we should have many more callers in the future, but it would be nice to have these default in some nice way. This is more a comment about all of these enums as a whole, rather than this specific instance. Feel free to ignore, but perhaps food for thought. InForInit is very specific.
Attachment #8605661 -
Flags: review?(efaustbmo) → review+
Comment 6•10 years ago
|
||
Comment on attachment 8605662 [details] [diff] [review]
Use the InHandling parameter in the parser to determine when to allow |in|
Review of attachment 8605662 [details] [diff] [review]:
-----------------------------------------------------------------
Looks great!
Attachment #8605662 -
Flags: review?(efaustbmo) → review+
Comment 7•10 years ago
|
||
Comment on attachment 8605663 [details] [diff] [review]
|pc->parsingForInit| is dead. Long live |InHandling|!
Review of attachment 8605663 [details] [diff] [review]:
-----------------------------------------------------------------
:)
::: js/src/frontend/Parser.cpp
@@ +4850,5 @@
> // 'for (var v = expr1 in expr2) stmt'.
> ParseNode* hoistedVar = nullptr;
>
> + // If there's an |in| keyword here, it's a for-in loop, by dint of careful
> + // parsing of |pn1|.
I wish this were somehow assertable. It isn't, clearly, but it all seems "very cleverly constructed"
Attachment #8605663 -
Flags: review?(efaustbmo) → review+
![]() |
||
Comment 9•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/5de5618316a8
https://hg.mozilla.org/mozilla-central/rev/8c0564d37591
https://hg.mozilla.org/mozilla-central/rev/64722e4b3310
https://hg.mozilla.org/mozilla-central/rev/77322b0deed3
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
status-firefox41:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
You need to log in
before you can comment on or make changes to this bug.
Description
•