Closed Bug 709322 Opened 8 years ago Closed 8 years ago

Make break/continue parse nodes type-safe

Categories

(Core :: JavaScript Engine, defect, minor)

defect
Not set
minor

Tracking

()

RESOLVED FIXED
mozilla11

People

(Reporter: Waldo, Assigned: Waldo)

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
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
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
You need to log in before you can comment on or make changes to this bug.