Status: Untriaged
Owner: ----

New issue 4270 by [email protected]: new Map(iterable) should close the argument iterator after a value is not Object error.
https://code.google.com/p/v8/issues/detail?id=4270

Version: V8 version 4.5.0 (candidate)
OS: Mac OS
Architecture: x64.debug

When creating a new Map object, if a iterable item is caught on the `not Object` error, it should close the iterator:

Ref: 23.1.1.1 item 9.f.ii

  23.1.1.1 Map ( [ iterable ] )

  ...
  9. Repeat
    ...
    d. Let nextItem be IteratorValue(next).
    e. ReturnIfAbrupt(nextItem).
    f. If Type(nextItem) is not Object,
      i. Let error be Completion{[[type]]: throw, [[value]]: a newly created
      TypeError object, [[target]]:empty}.
      ii. Return IteratorClose(iter, error).

Example Code:

```
var closed = false;
var iterable = {};
iterable[Symbol.iterator] = function() {
  return {
    next: function() {
      return { value: 1, done: false };
    },
    return: function() {
      closed = true;
    }
  };
};

try {
  new Map(iterable);
} catch() {
  // it will throw a TypeError
}
```

Expects `closed` to be `true`, as the iterable argument should be closed.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to