Closed Bug 1091945 Opened 5 years ago Closed 4 years ago

%IteratorPrototypeObject% should not be Iterator.prototype

Categories

(Core :: JavaScript Engine, defect)

x86_64
Linux
defect
Not set

Tracking

()

RESOLVED DUPLICATE of bug 1225396

People

(Reporter: evilpie, Unassigned)

References

Details

Attachments

(1 file)

Right now %IteratorPrototypeObject% is Iterator.prototype. I think it would be better for %IteratorPrototypeObject% to be a distinct object. "Iterator" is kind of legacy and shouldn't pollute %IteratorPrototypeObject%  with e.g. the legacy next method.
Attached patch WIPSplinter Review
Comment on attachment 8514692 [details] [diff] [review]
WIP

What do you think of this idea?
Attachment #8514692 - Flags: feedback?(wingo)
Comment on attachment 8514692 [details] [diff] [review]
WIP

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

I don't really know.  It could make sense to have an Iterator object in some future ES.  OTOH it probably shouldn't be the current Iterator object, as Iterator.prototype does the StopIteration thing, so you're probably right there.  feedback+ on my side then.

::: js/src/jsiter.cpp
@@ +1251,5 @@
>      nullptr                  /* construct   */
>  };
>  
>  /* static */ bool
> +GlobalObject::initLegayIteratorClass(JSContext *cx, Handle<GlobalObject *> global)

"legacy"

@@ +1311,5 @@
>  JSObject *
>  js_InitIteratorClasses(JSContext *cx, HandleObject obj)
>  {
>      Rooted<GlobalObject*> global(cx, &obj->as<GlobalObject>());
> +    if (!GlobalObject::initLegayIteratorClass(cx, global))

"legacy"

::: js/src/vm/GlobalObject.h
@@ +448,5 @@
>          return &self->getSlot(slot).toObject();
>      }
>  
>    public:
> +    // todo should be nativeobject

what does this mean?
Attachment #8514692 - Flags: feedback?(wingo) → feedback+
Assignee: evilpies → nobody
Duplicate of this bug: 1032198
Blocks: 1201089
Patches in bug 1225396 address this.
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1225396
You need to log in before you can comment on or make changes to this bug.