blob: 7d0474d4fc717867f73631f6737e2ad297c9280a [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// This file was procedurally generated from the following sources:
2// - src/dstr-binding/ary-init-iter-no-close.case
3// - src/dstr-binding/default/const-stmt.template
4/*---
5description: Iterator is not closed when exhausted by pattern evaluation (`const` statement)
6esid: sec-let-and-const-declarations-runtime-semantics-evaluation
7es6id: 13.3.1.4
8features: [Symbol.iterator, destructuring-binding]
9flags: [generated]
10info: |
11 LexicalBinding : BindingPattern Initializer
12
13 1. Let rhs be the result of evaluating Initializer.
14 2. Let value be GetValue(rhs).
15 3. ReturnIfAbrupt(value).
16 4. Let env be the running execution context's LexicalEnvironment.
17 5. Return the result of performing BindingInitialization for BindingPattern
18 using value and env as the arguments.
19
20 13.3.3.5 Runtime Semantics: BindingInitialization
21
22 BindingPattern : ArrayBindingPattern
23
24 [...]
25 4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator,
26 result).
27 [...]
28
29---*/
30var doneCallCount = 0;
31var iter = {};
32iter[Symbol.iterator] = function() {
33 return {
34 next: function() {
35 return { value: null, done: true };
36 },
37 return: function() {
38 doneCallCount += 1;
39 return {};
40 }
41 };
42};
43
44const [x] = iter;
45
46assert.sameValue(doneCallCount, 0);