Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/assignment/dstr-array-rest-nested-array-iter-thrw-close-skip.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-assignment/array-rest-nested-array-iter-thrw-close-skip.case
3 // - src/dstr-assignment/error/assignment-expr.template
4 /*---
5 description: IteratorClose is not called when nested array pattern evaluation produces an abrupt completion (AssignmentExpression)
6 esid: sec-variable-statement-runtime-semantics-evaluation
7 es6id: 13.3.2.4
8 features: [Symbol.iterator, destructuring-binding]
9 flags: [generated]
10 info: |
11 VariableDeclaration : BindingPattern Initializer
12
13 1. Let rhs be the result of evaluating Initializer.
14 2. Let rval be GetValue(rhs).
15 3. ReturnIfAbrupt(rval).
16 4. Return the result of performing BindingInitialization for
17 BindingPattern passing rval and undefined as arguments.
18
19 ArrayAssignmentPattern : [ Elisionopt AssignmentRestElement ]
20
21 [...]
22 5. Let result be the result of performing
23 IteratorDestructuringAssignmentEvaluation of AssignmentRestElement with
24 iteratorRecord as the argument
25 6. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
26 result).
27
28 AssignmentRestElement[Yield] : ... DestructuringAssignmentTarget
29
30 [...]
31 4. Repeat while iteratorRecord.[[done]] is false
32 [...]
33 d. If next is false, set iteratorRecord.[[done]] to true.
34 [...]
35 7. Return the result of performing DestructuringAssignmentEvaluation of
36 nestedAssignmentPattern with A as the argument.
37
38 ---*/
39 var nextCount = 0;
40 var returnCount = 0;
41 var iterable = {};
42 var iterator = {
43 next: function() {
44 nextCount += 1;
45 return { done: true };
46 },
47 return: function() {
48 returnCount += 1;
49 }
50 };
51 var thrower = function() {
52 throw new Test262Error();
53 };
54 iterable[Symbol.iterator] = function() {
55 return iterator;
56 };
57
58 assert.throws(Test262Error, function() {
59 0, [...[...{}[thrower()]]] = iterable;
60 });
61
62 assert.sameValue(nextCount, 1);
63 assert.sameValue(returnCount, 0);