| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/spread/mult-err-itr-value.case |
| 3 |
// - src/spread/error/array.template |
| 4 |
/*--- |
| 5 |
description: Spread operator following other arguments when IteratorValue fails (Array initializer) |
| 6 |
esid: sec-runtime-semantics-arrayaccumulation |
| 7 |
features: [Symbol.iterator] |
| 8 |
flags: [generated] |
| 9 |
info: | |
| 10 |
SpreadElement : ...AssignmentExpression |
| 11 |
|
| 12 |
1. Let spreadRef be the result of evaluating AssignmentExpression. |
| 13 |
2. Let spreadObj be ? GetValue(spreadRef). |
| 14 |
3. Let iterator be ? GetIterator(spreadObj). |
| 15 |
4. Repeat |
| 16 |
a. Let next be ? IteratorStep(iterator). |
| 17 |
b. If next is false, return nextIndex. |
| 18 |
c. Let nextValue be ? IteratorValue(next). |
| 19 |
d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), |
| 20 |
nextValue). |
| 21 |
e. Assert: status is true. |
| 22 |
f. Let nextIndex be nextIndex + 1. |
| 23 |
|
| 24 |
12.3.6.1 Runtime Semantics: ArgumentListEvaluation |
| 25 |
|
| 26 |
ArgumentList : ArgumentList , ... AssignmentExpression |
| 27 |
|
| 28 |
1. Let precedingArgs be the result of evaluating ArgumentList. |
| 29 |
2. Let spreadRef be the result of evaluating AssignmentExpression. |
| 30 |
3. Let iterator be GetIterator(GetValue(spreadRef) ). |
| 31 |
4. ReturnIfAbrupt(iterator). |
| 32 |
|
| 33 |
7.4.4 IteratorValue ( iterResult ) |
| 34 |
|
| 35 |
1. Assert: Type(iterResult) is Object. |
| 36 |
2. Return Get(iterResult, "value"). |
| 37 |
|
| 38 |
7.3.1 Get (O, P) |
| 39 |
|
| 40 |
[...] |
| 41 |
3. Return O.[[Get]](P, O). |
| 42 |
---*/ |
| 43 |
var iter = {}; |
| 44 |
var poisonedValue = Object.defineProperty({}, 'value', { |
| 45 |
get: function() { |
| 46 |
throw new Test262Error(); |
| 47 |
} |
| 48 |
}); |
| 49 |
iter[Symbol.iterator] = function() { |
| 50 |
return { |
| 51 |
next: function() { |
| 52 |
return poisonedValue; |
| 53 |
} |
| 54 |
}; |
| 55 |
}; |
| 56 |
|
| 57 |
assert.throws(Test262Error, function() { |
| 58 |
[0, ...iter]; |
| 59 |
}); |
| 60 |
|
| 61 |
reportCompare(0, 0); |