Last Comment Bug 709322 - Make break/continue parse nodes type-safe
: Make break/continue parse nodes type-safe
Product: Core
Classification: Components
Component: JavaScript Engine (show other bugs)
: unspecified
: All All
-- minor (vote)
: mozilla11
Assigned To: Jeff Walden [:Waldo] (remove +bmo to email)
: Jason Orendorff [:jorendorff]
Depends on:
  Show dependency treegraph
Reported: 2011-12-09 14:30 PST by Jeff Walden [:Waldo] (remove +bmo to email)
Modified: 2011-12-16 06:12 PST (History)
1 user (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Patch (7.67 KB, patch)
2011-12-09 14:30 PST, Jeff Walden [:Waldo] (remove +bmo to email)
jorendorff: review+
Details | Diff | Splinter Review

Description User image Jeff Walden [:Waldo] (remove +bmo to email) 2011-12-09 14:30:45 PST
Created attachment 580553 [details] [diff] [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.
Comment 1 User image Jason Orendorff [:jorendorff] 2011-12-09 14:48:51 PST
Comment on attachment 580553 [details] [diff] [review]

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.
Comment 2 User image Ed Morley [:emorley] 2011-12-16 06:12:31 PST

Note You need to log in before you can comment on or make changes to this bug.