Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/assignment/dstr-array-rest-elision-iter-abpt.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-assignment/array-rest-elision-iter-abpt.case
3 // - src/dstr-assignment/error/assignment-expr.template
4 /*---
5 description: IteratorClose is not called when assignment 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 4. If Elision is present, then
23 a. Let status be the result of performing
24 IteratorDestructuringAssignmentEvaluation of Elision with
25 iteratorRecord as the argument.
26 b. If status is an abrupt completion, then
27 i. If iteratorRecord.[[done]] is false, return
28 IteratorClose(iterator, status).
29 ii. Return Completion(status).
30
31 ---*/
32 var nextCount = 0;
33 var returnCount = 0;
34 var iterable = {};
35 var iterator = {
36 next: function() {
37 nextCount += 1;
38 throw new Test262Error();
39 },
40 return: function() {
41 returnCount += 1;
42 }
43 };
44 iterable[Symbol.iterator] = function() {
45 return iterator;
46 };
47 var x;
48
49 assert.throws(Test262Error, function() {
50 0, [ , ...x] = iterable;
51 });
52
53 assert.sameValue(nextCount, 1);
54 assert.sameValue(returnCount, 0);