Revision control
Copy as Markdown
// Copyright (C) 2016 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
template: error
desc: Error forwarding when IteratorValue returns an abrupt completion
info: >
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
BindingRestElement : ... BindingIdentifier
1. Let lhs be ResolveBinding(StringValue of BindingIdentifier,
environment).
2. ReturnIfAbrupt(lhs).
3. Let A be ArrayCreate(0).
4. Let n=0.
5. Repeat,
[...]
c. Let nextValue be IteratorValue(next).
d. If nextValue is an abrupt completion, set iteratorRecord.[[done]] to
true.
e. ReturnIfAbrupt(nextValue).
features: [Symbol.iterator]
---*/
//- setup
var poisonedValue = Object.defineProperty({}, 'value', {
get: function() {
throw new Test262Error();
}
});
var iter = {};
iter[Symbol.iterator] = function() {
return {
next: function() {
return poisonedValue;
}
};
};
//- elems
[...x]
//- vals
iter
//- error
Test262Error