Closed Bug 697000 Opened 13 years ago Closed 11 years ago

Token type shouldn't be set after the other fields, to allow the setting of those fields to be asserted type-safe

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: Waldo, Assigned: n.nethercote)

Details

Attachments

(1 file)

Currently we set fields like token.u.reflags before we set token.type.  This means that we can't assert that, when reflags is set, its type is TOK_REGEXP.  We should initialize in an order that makes such assertions possible, for all the various token-mutation methods.
In bug 898912, I thought about removing |tt| and just working directly with
|tp->type|, but I didn't end up doing it.

And then I saw this bug and realized that if I made that change it would be
really easy to fix.  So here you go.  The performance effect is negligible.
Attachment #784788 - Flags: review?(till)
Assignee: general → n.nethercote
Comment on attachment 784788 [details] [diff] [review]
Do kind-checking in Token's setters.

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

nice
Attachment #784788 - Flags: review?(till) → review+
https://hg.mozilla.org/mozilla-central/rev/786c07374154
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: