The default bug view has changed. See this FAQ.

Make break/continue parse nodes type-safe

RESOLVED FIXED in mozilla11

Status

()

Core
JavaScript Engine
--
minor
RESOLVED FIXED
5 years ago
5 years ago

People

(Reporter: Waldo, Assigned: Waldo)

Tracking

unspecified
mozilla11
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

Created attachment 580553 [details] [diff] [review]
Patch

Construct them using constructors that are purely a function of their arguments, and make access to the associated label type-safe.  This is more code than the current way, but I think it's easier to follow by being more explicit and not relying on implicit state.
Attachment #580553 - Flags: review?(jorendorff)
Comment on attachment 580553 [details] [diff] [review]
Patch

Splitting BreakStatement and ContinueStatement is farther than I would have gone, but OK.

In Parser.cpp, Parser::statement, case TOK_BREAK:
>+        BreakStatement *breakStmt = tc->parser->new_<BreakStatement>(label, begin, end);
>+        if (!breakStmt)
>             return NULL;
[...]
>+        pn = breakStmt;

Looks like you could just assign directly to pn. Same thing in case TOK_CONTINUE.

Those two cases look awfully similar.
Attachment #580553 - Flags: review?(jorendorff) → review+
https://hg.mozilla.org/mozilla-central/rev/8b1a1c88441a
Status: ASSIGNED → RESOLVED
Last Resolved: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
You need to log in before you can comment on or make changes to this bug.