mirror of https://github.com/tc39/test262.git
Assert iterators are consumed - and closed - in dstr patterns
Ref https://bugzilla.mozilla.org/show_bug.cgi?id=1364608
This commit is contained in:
parent
17b13b9d01
commit
59d9d0b6d8
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
template: iter-close
|
||||||
|
desc: >
|
||||||
|
The iterator is properly consumed by the destructuring pattern
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
const iter = (function* () {
|
||||||
|
yield;
|
||||||
|
yield;
|
||||||
|
})();
|
||||||
|
|
||||||
|
//- elems
|
||||||
|
[,]
|
||||||
|
//- iter
|
||||||
|
iter
|
||||||
|
//- assertions
|
||||||
|
assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
|
|
@ -0,0 +1,21 @@
|
||||||
|
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
template: iter-close
|
||||||
|
desc: >
|
||||||
|
The iterator is properly consumed by the destructuring pattern
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
const iter = (function* () {
|
||||||
|
yield;
|
||||||
|
yield;
|
||||||
|
})();
|
||||||
|
|
||||||
|
//- elems
|
||||||
|
[...x]
|
||||||
|
//- iter
|
||||||
|
iter
|
||||||
|
//- assertions
|
||||||
|
assert.sameValue(iter.next().done, true, 'iteration occurred as expected');
|
|
@ -0,0 +1,50 @@
|
||||||
|
// Copyright (C) 2017 Mozilla Corporation. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
path: language/statements/for-await-of/async-func-dstr-const-
|
||||||
|
name: for-await-of statement in an async function
|
||||||
|
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
|
||||||
|
features: [destructuring-binding, async-iteration]
|
||||||
|
flags: [async]
|
||||||
|
info: |
|
||||||
|
IterationStatement :
|
||||||
|
for await ( ForDeclaration of AssignmentExpression ) Statement
|
||||||
|
|
||||||
|
[...]
|
||||||
|
2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
|
||||||
|
lexicalBinding, labelSet, async).
|
||||||
|
|
||||||
|
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
|
||||||
|
|
||||||
|
[...]
|
||||||
|
4. Let destructuring be IsDestructuring of lhs.
|
||||||
|
[...]
|
||||||
|
6. Repeat
|
||||||
|
[...]
|
||||||
|
j. If destructuring is false, then
|
||||||
|
[...]
|
||||||
|
k. Else
|
||||||
|
i. If lhsKind is assignment, then
|
||||||
|
[...]
|
||||||
|
ii. Else if lhsKind is varBinding, then
|
||||||
|
[...]
|
||||||
|
iii. Else,
|
||||||
|
1. Assert: lhsKind is lexicalBinding.
|
||||||
|
2. Assert: lhs is a ForDeclaration.
|
||||||
|
3. Let status be the result of performing BindingInitialization
|
||||||
|
for lhs passing nextValue and iterationEnv as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
for await (const /*{ elems }*/ of [/*{ iter }*/]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn()
|
||||||
|
.then(() => {
|
||||||
|
/*{ assertions }*/
|
||||||
|
})
|
||||||
|
.then($DONE, $DONE);
|
|
@ -0,0 +1,50 @@
|
||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
path: language/statements/for-await-of/async-func-dstr-let-
|
||||||
|
name: for-await-of statement
|
||||||
|
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
|
||||||
|
features: [destructuring-binding, async-iteration]
|
||||||
|
flags: [async]
|
||||||
|
info: |
|
||||||
|
IterationStatement :
|
||||||
|
for await ( ForDeclaration of AssignmentExpression ) Statement
|
||||||
|
|
||||||
|
[...]
|
||||||
|
2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
|
||||||
|
lexicalBinding, labelSet, async).
|
||||||
|
|
||||||
|
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
|
||||||
|
|
||||||
|
[...]
|
||||||
|
4. Let destructuring be IsDestructuring of lhs.
|
||||||
|
[...]
|
||||||
|
6. Repeat
|
||||||
|
[...]
|
||||||
|
j. If destructuring is false, then
|
||||||
|
[...]
|
||||||
|
k. Else
|
||||||
|
i. If lhsKind is assignment, then
|
||||||
|
[...]
|
||||||
|
ii. Else if lhsKind is varBinding, then
|
||||||
|
[...]
|
||||||
|
iii. Else,
|
||||||
|
1. Assert: lhsKind is lexicalBinding.
|
||||||
|
2. Assert: lhs is a ForDeclaration.
|
||||||
|
3. Let status be the result of performing BindingInitialization
|
||||||
|
for lhs passing nextValue and iterationEnv as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
for await (let /*{ elems }*/ of [/*{ iter }*/]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn()
|
||||||
|
.then(() => {
|
||||||
|
/*{ assertions }*/
|
||||||
|
})
|
||||||
|
.then($DONE, $DONE);
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
path: language/statements/for-await-of/async-func-dstr-var-
|
||||||
|
name: for-await-of statement
|
||||||
|
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
|
||||||
|
features: [destructuring-binding, async-iteration]
|
||||||
|
flags: [async]
|
||||||
|
info: |
|
||||||
|
IterationStatement :
|
||||||
|
for await ( var ForBinding of AssignmentExpression ) Statement
|
||||||
|
|
||||||
|
[...]
|
||||||
|
2. Return ? ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
|
||||||
|
varBinding, labelSet, async).
|
||||||
|
|
||||||
|
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
|
||||||
|
|
||||||
|
[...]
|
||||||
|
4. Let destructuring be IsDestructuring of lhs.
|
||||||
|
[...]
|
||||||
|
6. Repeat
|
||||||
|
[...]
|
||||||
|
j. If destructuring is false, then
|
||||||
|
[...]
|
||||||
|
k. Else
|
||||||
|
i. If lhsKind is assignment, then
|
||||||
|
[...]
|
||||||
|
ii. Else if lhsKind is varBinding, then
|
||||||
|
1. Assert: lhs is a ForBinding.
|
||||||
|
2. Let status be the result of performing BindingInitialization
|
||||||
|
for lhs passing nextValue and undefined as the arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
async function fn() {
|
||||||
|
for await (var /*{ elems }*/ of [/*{ iter }*/]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn()
|
||||||
|
.then(() => {
|
||||||
|
/*{ assertions }*/
|
||||||
|
})
|
||||||
|
.then($DONE, $DONE);
|
|
@ -0,0 +1,50 @@
|
||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
path: language/statements/for-await-of/async-gen-dstr-const-
|
||||||
|
name: for-await-of statement
|
||||||
|
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
|
||||||
|
features: [destructuring-binding, async-iteration]
|
||||||
|
flags: [async]
|
||||||
|
info: |
|
||||||
|
IterationStatement :
|
||||||
|
for await ( ForDeclaration of AssignmentExpression ) Statement
|
||||||
|
|
||||||
|
[...]
|
||||||
|
2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
|
||||||
|
lexicalBinding, labelSet, async).
|
||||||
|
|
||||||
|
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
|
||||||
|
|
||||||
|
[...]
|
||||||
|
4. Let destructuring be IsDestructuring of lhs.
|
||||||
|
[...]
|
||||||
|
6. Repeat
|
||||||
|
[...]
|
||||||
|
j. If destructuring is false, then
|
||||||
|
[...]
|
||||||
|
k. Else
|
||||||
|
i. If lhsKind is assignment, then
|
||||||
|
[...]
|
||||||
|
ii. Else if lhsKind is varBinding, then
|
||||||
|
[...]
|
||||||
|
iii. Else,
|
||||||
|
1. Assert: lhsKind is lexicalBinding.
|
||||||
|
2. Assert: lhs is a ForDeclaration.
|
||||||
|
3. Let status be the result of performing BindingInitialization
|
||||||
|
for lhs passing nextValue and iterationEnv as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
async function* fn() {
|
||||||
|
for await (const /*{ elems }*/ of [/*{ iter }*/]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn()
|
||||||
|
.next()
|
||||||
|
.then(() => {
|
||||||
|
/*{ assertions }*/
|
||||||
|
})
|
||||||
|
.then($DONE, $DONE);
|
|
@ -0,0 +1,50 @@
|
||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
path: language/statements/for-await-of/async-gen-dstr-let-
|
||||||
|
name: for-await-of statement
|
||||||
|
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
|
||||||
|
features: [destructuring-binding, async-iteration]
|
||||||
|
flags: [async]
|
||||||
|
info: |
|
||||||
|
IterationStatement :
|
||||||
|
for await ( ForDeclaration of AssignmentExpression ) Statement
|
||||||
|
|
||||||
|
[...]
|
||||||
|
2. Return ? ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
|
||||||
|
lexicalBinding, labelSet, async).
|
||||||
|
|
||||||
|
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
|
||||||
|
|
||||||
|
[...]
|
||||||
|
4. Let destructuring be IsDestructuring of lhs.
|
||||||
|
[...]
|
||||||
|
6. Repeat
|
||||||
|
[...]
|
||||||
|
j. If destructuring is false, then
|
||||||
|
[...]
|
||||||
|
k. Else
|
||||||
|
i. If lhsKind is assignment, then
|
||||||
|
[...]
|
||||||
|
ii. Else if lhsKind is varBinding, then
|
||||||
|
[...]
|
||||||
|
iii. Else,
|
||||||
|
1. Assert: lhsKind is lexicalBinding.
|
||||||
|
2. Assert: lhs is a ForDeclaration.
|
||||||
|
3. Let status be the result of performing BindingInitialization
|
||||||
|
for lhs passing nextValue and iterationEnv as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
async function* fn() {
|
||||||
|
for await (let /*{ elems }*/ of [/*{ iter }*/]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn()
|
||||||
|
.next()
|
||||||
|
.then(() => {
|
||||||
|
/*{ assertions }*/
|
||||||
|
})
|
||||||
|
.then($DONE, $DONE);
|
|
@ -0,0 +1,47 @@
|
||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
path: language/statements/for-await-of/async-gen-dstr-var-
|
||||||
|
name: for-await-of statement
|
||||||
|
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
|
||||||
|
features: [destructuring-binding, async-iteration]
|
||||||
|
flags: [async]
|
||||||
|
info: |
|
||||||
|
IterationStatement :
|
||||||
|
for await ( var ForBinding of AssignmentExpression ) Statement
|
||||||
|
|
||||||
|
[...]
|
||||||
|
2. Return ? ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
|
||||||
|
varBinding, labelSet, async).
|
||||||
|
|
||||||
|
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
|
||||||
|
|
||||||
|
[...]
|
||||||
|
4. Let destructuring be IsDestructuring of lhs.
|
||||||
|
[...]
|
||||||
|
6. Repeat
|
||||||
|
[...]
|
||||||
|
j. If destructuring is false, then
|
||||||
|
[...]
|
||||||
|
k. Else
|
||||||
|
i. If lhsKind is assignment, then
|
||||||
|
[...]
|
||||||
|
ii. Else if lhsKind is varBinding, then
|
||||||
|
1. Assert: lhs is a ForBinding.
|
||||||
|
2. Let status be the result of performing BindingInitialization
|
||||||
|
for lhs passing nextValue and undefined as the arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
async function* fn() {
|
||||||
|
for await (var /*{ elems }*/ of [/*{ iter }*/]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn()
|
||||||
|
.next()
|
||||||
|
.then(() => {
|
||||||
|
/*{ assertions }*/
|
||||||
|
})
|
||||||
|
.then($DONE, $DONE);
|
|
@ -0,0 +1,47 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
path: language/statements/for/dstr-const-
|
||||||
|
name: for statement
|
||||||
|
esid: sec-for-statement-runtime-semantics-labelledevaluation
|
||||||
|
es6id: 13.7.4.7
|
||||||
|
features: [destructuring-binding]
|
||||||
|
info: |
|
||||||
|
IterationStatement :
|
||||||
|
for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
|
||||||
|
|
||||||
|
[...]
|
||||||
|
7. Let forDcl be the result of evaluating LexicalDeclaration.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
LexicalDeclaration : LetOrConst BindingList ;
|
||||||
|
|
||||||
|
1. Let next be the result of evaluating BindingList.
|
||||||
|
2. ReturnIfAbrupt(next).
|
||||||
|
3. Return NormalCompletion(empty).
|
||||||
|
|
||||||
|
BindingList : BindingList , LexicalBinding
|
||||||
|
|
||||||
|
1. Let next be the result of evaluating BindingList.
|
||||||
|
2. ReturnIfAbrupt(next).
|
||||||
|
3. Return the result of evaluating LexicalBinding.
|
||||||
|
|
||||||
|
LexicalBinding : BindingPattern Initializer
|
||||||
|
|
||||||
|
1. Let rhs be the result of evaluating Initializer.
|
||||||
|
2. Let value be GetValue(rhs).
|
||||||
|
3. ReturnIfAbrupt(value).
|
||||||
|
4. Let env be the running execution context’s LexicalEnvironment.
|
||||||
|
5. Return the result of performing BindingInitialization for BindingPattern
|
||||||
|
using value and env as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function fn() {
|
||||||
|
for (const /*{ elems }*/ = /*{ iter }*/; ; ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
|
@ -0,0 +1,47 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
path: language/statements/for/dstr-let-
|
||||||
|
name: for statement
|
||||||
|
esid: sec-for-statement-runtime-semantics-labelledevaluation
|
||||||
|
es6id: 13.7.4.7
|
||||||
|
features: [destructuring-binding]
|
||||||
|
info: |
|
||||||
|
IterationStatement :
|
||||||
|
for ( LexicalDeclaration Expressionopt ; Expressionopt ) Statement
|
||||||
|
|
||||||
|
[...]
|
||||||
|
7. Let forDcl be the result of evaluating LexicalDeclaration.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
LexicalDeclaration : LetOrConst BindingList ;
|
||||||
|
|
||||||
|
1. Let next be the result of evaluating BindingList.
|
||||||
|
2. ReturnIfAbrupt(next).
|
||||||
|
3. Return NormalCompletion(empty).
|
||||||
|
|
||||||
|
BindingList : BindingList , LexicalBinding
|
||||||
|
|
||||||
|
1. Let next be the result of evaluating BindingList.
|
||||||
|
2. ReturnIfAbrupt(next).
|
||||||
|
3. Return the result of evaluating LexicalBinding.
|
||||||
|
|
||||||
|
LexicalBinding : BindingPattern Initializer
|
||||||
|
|
||||||
|
1. Let rhs be the result of evaluating Initializer.
|
||||||
|
2. Let value be GetValue(rhs).
|
||||||
|
3. ReturnIfAbrupt(value).
|
||||||
|
4. Let env be the running execution context’s LexicalEnvironment.
|
||||||
|
5. Return the result of performing BindingInitialization for BindingPattern
|
||||||
|
using value and env as the arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function fn() {
|
||||||
|
for (let /*{ elems }*/ = /*{ iter }*/; ; ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
|
@ -0,0 +1,47 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
path: language/statements/for-of/dstr-const-
|
||||||
|
name: for-of statement
|
||||||
|
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
|
||||||
|
es6id: 13.7.5.11
|
||||||
|
features: [destructuring-binding]
|
||||||
|
info: |
|
||||||
|
IterationStatement :
|
||||||
|
for ( ForDeclaration of AssignmentExpression ) Statement
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
|
||||||
|
lexicalBinding, labelSet).
|
||||||
|
|
||||||
|
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let destructuring be IsDestructuring of lhs.
|
||||||
|
[...]
|
||||||
|
5. Repeat
|
||||||
|
[...]
|
||||||
|
h. If destructuring is false, then
|
||||||
|
[...]
|
||||||
|
i. Else
|
||||||
|
i. If lhsKind is assignment, then
|
||||||
|
[...]
|
||||||
|
ii. Else if lhsKind is varBinding, then
|
||||||
|
[...]
|
||||||
|
iii. Else,
|
||||||
|
1. Assert: lhsKind is lexicalBinding.
|
||||||
|
2. Assert: lhs is a ForDeclaration.
|
||||||
|
3. Let status be the result of performing BindingInitialization
|
||||||
|
for lhs passing nextValue and iterationEnv as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function fn() {
|
||||||
|
for (const /*{ elems }*/ of [/*{ iter }*/]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
|
@ -0,0 +1,48 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
path: language/statements/for-of/dstr-let-
|
||||||
|
name: for-of statement
|
||||||
|
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
|
||||||
|
es6id: 13.7.5.11
|
||||||
|
features: [destructuring-binding]
|
||||||
|
info: |
|
||||||
|
IterationStatement :
|
||||||
|
for ( ForDeclaration of AssignmentExpression ) Statement
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Return ForIn/OfBodyEvaluation(ForDeclaration, Statement, keyResult,
|
||||||
|
lexicalBinding, labelSet).
|
||||||
|
|
||||||
|
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let destructuring be IsDestructuring of lhs.
|
||||||
|
[...]
|
||||||
|
5. Repeat
|
||||||
|
[...]
|
||||||
|
h. If destructuring is false, then
|
||||||
|
[...]
|
||||||
|
i. Else
|
||||||
|
i. If lhsKind is assignment, then
|
||||||
|
[...]
|
||||||
|
ii. Else if lhsKind is varBinding, then
|
||||||
|
[...]
|
||||||
|
iii. Else,
|
||||||
|
1. Assert: lhsKind is lexicalBinding.
|
||||||
|
2. Assert: lhs is a ForDeclaration.
|
||||||
|
3. Let status be the result of performing BindingInitialization
|
||||||
|
for lhs passing nextValue and iterationEnv as arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function fn() {
|
||||||
|
for (let /*{ elems }*/ of [/*{ iter }*/]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
path: language/statements/for-of/dstr-var-
|
||||||
|
name: for-of statement
|
||||||
|
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
|
||||||
|
es6id: 13.7.5.11
|
||||||
|
features: [destructuring-binding]
|
||||||
|
info: |
|
||||||
|
IterationStatement :
|
||||||
|
for ( var ForBinding of AssignmentExpression ) Statement
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Return ForIn/OfBodyEvaluation(ForBinding, Statement, keyResult,
|
||||||
|
varBinding, labelSet).
|
||||||
|
|
||||||
|
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
|
||||||
|
|
||||||
|
[...]
|
||||||
|
3. Let destructuring be IsDestructuring of lhs.
|
||||||
|
[...]
|
||||||
|
5. Repeat
|
||||||
|
[...]
|
||||||
|
h. If destructuring is false, then
|
||||||
|
[...]
|
||||||
|
i. Else
|
||||||
|
i. If lhsKind is assignment, then
|
||||||
|
[...]
|
||||||
|
ii. Else if lhsKind is varBinding, then
|
||||||
|
1. Assert: lhs is a ForBinding.
|
||||||
|
2. Let status be the result of performing BindingInitialization
|
||||||
|
for lhs passing nextValue and undefined as the arguments.
|
||||||
|
[...]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function fn() {
|
||||||
|
for (var /*{ elems }*/ of [/*{ iter }*/]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
// Copyright (C) 2016 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
/*---
|
||||||
|
path: language/statements/for/dstr-var-
|
||||||
|
name: for statement
|
||||||
|
esid: sec-for-statement-runtime-semantics-labelledevaluation
|
||||||
|
es6id: 13.7.4.7
|
||||||
|
features: [destructuring-binding]
|
||||||
|
info: |
|
||||||
|
IterationStatement :
|
||||||
|
for ( var VariableDeclarationList ; Expressionopt ; Expressionopt ) Statement
|
||||||
|
|
||||||
|
1. Let varDcl be the result of evaluating VariableDeclarationList.
|
||||||
|
[...]
|
||||||
|
|
||||||
|
13.3.2.4 Runtime Semantics: Evaluation
|
||||||
|
|
||||||
|
VariableDeclarationList : VariableDeclarationList , VariableDeclaration
|
||||||
|
|
||||||
|
1. Let next be the result of evaluating VariableDeclarationList.
|
||||||
|
2. ReturnIfAbrupt(next).
|
||||||
|
3. Return the result of evaluating VariableDeclaration.
|
||||||
|
|
||||||
|
VariableDeclaration : BindingPattern Initializer
|
||||||
|
|
||||||
|
1. Let rhs be the result of evaluating Initializer.
|
||||||
|
2. Let rval be GetValue(rhs).
|
||||||
|
3. ReturnIfAbrupt(rval).
|
||||||
|
4. Return the result of performing BindingInitialization for BindingPattern
|
||||||
|
passing rval and undefined as arguments.
|
||||||
|
---*/
|
||||||
|
|
||||||
|
function fn() {
|
||||||
|
for (var /*{ elems }*/ = /*{ iter }*/; ; ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
Loading…
Reference in New Issue