%IteratorPrototypeObject% should not be Iterator.prototype

RESOLVED DUPLICATE of bug 1225396

Status

()

Core
JavaScript Engine
RESOLVED DUPLICATE of bug 1225396
3 years ago
2 years ago

People

(Reporter: evilpie, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

3 years ago
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.
(Reporter)

Comment 2

3 years ago
Comment on attachment 8514692 [details] [diff] [review]
WIP

What do you think of this idea?
Attachment #8514692 - Flags: feedback?(wingo)

Comment 3

3 years ago
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+
(Reporter)

Updated

3 years ago
Assignee: evilpies → nobody

Updated

2 years ago
Duplicate of this bug: 1032198

Updated

2 years ago
Blocks: 1201089
Patches in bug 1225396 address this.
Status: NEW → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1225396
You need to log in before you can comment on or make changes to this bug.