Closed Bug 1189282 Opened 9 years ago Closed 9 years ago

Refactor parser BindData class

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla43
Tracking Status
firefox43 --- fixed

People

(Reporter: jonco, Assigned: jonco)

Details

Attachments

(1 file)

Attached patch refactor-binderSplinter Review
BindData is a helper class that's used to create bindings.  To handle the different kinds of bindings this currently has the caller set a function pointer to determine what happens when we bind.  This is pretty confusing.

The patch refactors BindData to use an enum to represent the different binding kinds and switches on the kind when we bind.  Also it makes more of the data private and adds assertions that the class is used correctly.
Attachment #8641046 - Flags: review?(efaustbmo)
Comment on attachment 8641046 [details] [diff] [review]
refactor-binder

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

Yes yes yes. Thank you for bringing C++ to what was clearly an old C holdover.

Sorry about the review delay. The patch is great.

::: js/src/frontend/Parser.cpp
@@ +1162,5 @@
>  /*
> + * Helper class for creating bindings.
> + *
> + * The same instance can be used more than once by repeatedly calling
> + * setNameNode() followed by bind().

This comment would have saved me a ton of time the first time I used this. Thanks.
Attachment #8641046 - Flags: review?(efaustbmo) → review+
https://hg.mozilla.org/mozilla-central/rev/13aaf1d82d6f
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla43
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: