Closed Bug 615068 Opened 10 years ago Closed 9 years ago

obj is only used ifdef DEBUG in JS_NextProperty

Categories

(Core :: JavaScript Engine, enhancement)

enhancement
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: timeless)

References

(Blocks 1 open bug)

Details

(Keywords: coverity, Whiteboard: [fixed-in-tracemonkey])

Attachments

(1 file)

860 bytes, patch
jorendorff
: review+
Details | Diff | Splinter Review
3956 JS_NextProperty(JSContext *cx, JSObject *iterobj, jsid *idp)
3966     if (i < 0) {
3967         /* Native case: private data is a property tree node pointer. */
3968         obj = iterobj->getParent();
3969         JS_ASSERT(obj->isNative());
3970         shape = (Shape *) iterobj->getPrivate();
3971 
3972         /*
3973          * If the next property mapped by obj in the property tree ancestor
3974          * line is not enumerable, or it's an alias, skip it and keep on trying
3975          * to find an enumerable property that is still in obj.
3976          */
3977         while (shape->previous() && (!shape->enumerable() || shape->isAlias()))
3978             shape = shape->previous();
3979 
3980         if (!shape->previous()) {
3981             JS_ASSERT(JSID_IS_EMPTY(shape->id));
3982             *idp = JSID_VOID;
3983         } else {
3984             iterobj->setPrivate(const_cast<Shape *>(shape->previous()));
3985             *idp = shape->id;
3986         }
3987     } else {
Attached patch patchSplinter Review
Assignee: general → timeless
Status: NEW → ASSIGNED
Attachment #493558 - Flags: review?(jorendorff)
Comment on attachment 493558 [details] [diff] [review]
patch

Thanks. The comment immediately following this code still mentions obj, though:

    /*
     * If the next property mapped by obj in the property tree ancestor
     * line is not enumerable, or it's an alias, skip it and keep on trying
     * to find an enumerable property that is still in obj.
     */
    while (shape->previous() && (!shape->enumerable() || shape->isAlias()))
        shape = shape->previous();

Honestly the code makes more sense than the comment, so please just delete the comment.
Attachment #493558 - Flags: review?(jorendorff) → review+
http://hg.mozilla.org/mozilla-central/rev/e154ca97d884
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.