Skip to content
Snippets Groups Projects
Commit 44e19a0f authored by Rick Waldron's avatar Rick Waldron
Browse files

Throw away tests

parent ff34bf5c
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 1110 deletions
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-init-assignment.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: If the Initializer is present and v is undefined, the Initializer should be evaluated and the result assigned to the target reference. (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [destructuring-binding, async-iteration]
flags: [generated, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
---*/
var v2, vNull, vHole, vUndefined, vOob;
var counter = 0;
async function fn() {
for await ([v2 = 10, vNull = 11, vHole = 12, vUndefined = 13, vOob = 14] of [[2, null, , undefined]]) {
assert.sameValue(v2, 2);
assert.sameValue(vNull, null);
assert.sameValue(vHole, 12);
assert.sameValue(vUndefined, 13);
assert.sameValue(vOob, 14);
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-init-evaluation.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: The Initializer should only be evaluated if v is undefined. (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [destructuring-binding, async-iteration]
flags: [generated, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
---*/
var flag1 = false, flag2 = false;
var _;
var counter = 0;
async function fn() {
for await ([ _ = flag1 = true, _ = flag2 = true ] of [[14]]) {
assert.sameValue(flag1, false);
assert.sameValue(flag2, true);
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-init-fn-name-arrow.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: Assignment of function `name` attribute (ArrowFunction) (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [destructuring-binding, async-iteration]
flags: [generated, async]
includes: [propertyHelper.js]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
[...] 7. If Initializer is present and value is undefined and
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
DestructuringAssignmentTarget are both true, then
a. Let hasNameProperty be HasOwnProperty(v, "name").
b. ReturnIfAbrupt(hasNameProperty).
c. If hasNameProperty is false, perform SetFunctionName(v,
GetReferencedName(lref)).
---*/
var arrow;
var counter = 0;
async function fn() {
for await ([ arrow = () => {} ] of [[]]) {
assert.sameValue(arrow.name, 'arrow');
verifyNotEnumerable(arrow, 'name');
verifyNotWritable(arrow, 'name');
verifyConfigurable(arrow, 'name');
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-init-fn-name-class.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: Assignment of function `name` attribute (ClassExpression) (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [class, destructuring-binding, async-iteration]
flags: [generated, async]
includes: [propertyHelper.js]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
[...] 7. If Initializer is present and value is undefined and
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
DestructuringAssignmentTarget are both true, then
a. Let hasNameProperty be HasOwnProperty(v, "name").
b. ReturnIfAbrupt(hasNameProperty).
c. If hasNameProperty is false, perform SetFunctionName(v,
GetReferencedName(lref)).
---*/
var xCls, cls, xCls2;
var counter = 0;
async function fn() {
for await ([ xCls = class x {}, cls = class {}, xCls2 = class { static name() {} } ] of [[]]) {
assert(xCls.name !== 'xCls');
assert(xCls2.name !== 'xCls2');
assert.sameValue(cls.name, 'cls');
verifyNotEnumerable(cls, 'name');
verifyNotWritable(cls, 'name');
verifyConfigurable(cls, 'name');
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-init-fn-name-cover.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: Assignment of function `name` attribute (CoverParenthesizedExpression) (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [destructuring-binding, async-iteration]
flags: [generated, async]
includes: [propertyHelper.js]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
[...] 7. If Initializer is present and value is undefined and
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
DestructuringAssignmentTarget are both true, then
a. Let hasNameProperty be HasOwnProperty(v, "name").
b. ReturnIfAbrupt(hasNameProperty).
c. If hasNameProperty is false, perform SetFunctionName(v,
GetReferencedName(lref)).
---*/
var xCover, cover;
var counter = 0;
async function fn() {
for await ([ xCover = (0, function() {}), cover = (function() {}) ] of [[]]) {
assert(xCover.name !== 'xCover');
assert.sameValue(cover.name, 'cover');
verifyNotEnumerable(cover, 'name');
verifyNotWritable(cover, 'name');
verifyConfigurable(cover, 'name');
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-init-fn-name-fn.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: Assignment of function `name` attribute (FunctionExpression) (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [class, destructuring-binding, async-iteration]
flags: [generated, async]
includes: [propertyHelper.js]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
[...] 7. If Initializer is present and value is undefined and
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
DestructuringAssignmentTarget are both true, then
a. Let hasNameProperty be HasOwnProperty(v, "name").
b. ReturnIfAbrupt(hasNameProperty).
c. If hasNameProperty is false, perform SetFunctionName(v,
GetReferencedName(lref)).
---*/
var xFn, fn;
var counter = 0;
async function fn() {
for await ([ xFn = function x() {}, fn = function() {} ] of [[]]) {
assert(xFn.name !== 'xFn');
assert.sameValue(fn.name, 'fn');
verifyNotEnumerable(fn, 'name');
verifyNotWritable(fn, 'name');
verifyConfigurable(fn, 'name');
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-init-fn-name-gen.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: Assignment of function `name` attribute (GeneratorExpression) (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [generators, destructuring-binding, async-iteration]
flags: [generated, async]
includes: [propertyHelper.js]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
AssignmentElement[Yield] : DestructuringAssignmentTarget Initializeropt
[...] 7. If Initializer is present and value is undefined and
IsAnonymousFunctionDefinition(Initializer) and IsIdentifierRef of
DestructuringAssignmentTarget are both true, then
a. Let hasNameProperty be HasOwnProperty(v, "name").
b. ReturnIfAbrupt(hasNameProperty).
c. If hasNameProperty is false, perform SetFunctionName(v,
GetReferencedName(lref)).
---*/
var xGen, gen;
var counter = 0;
async function fn() {
for await ([ xGen = function* x() {}, gen = function*() {} ] of [[]]) {
assert.notSameValue(xGen.name, 'xGen');
assert.sameValue(gen.name, 'gen');
verifyNotEnumerable(gen, 'name');
verifyNotWritable(gen, 'name');
verifyConfigurable(gen, 'name');
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-init-in.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: The Initializer in an AssignmentElement may be an `in` expression. (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [destructuring-binding, async-iteration]
flags: [generated, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
---*/
var x;
var counter = 0;
async function fn() {
for await ([ x = 'x' in {} ] of [[]]) {
assert.sameValue(x, false);
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-init-order.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: Initializer values should be assigned in left-to-right order. (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [destructuring-binding, async-iteration]
flags: [generated, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
---*/
var x = 0;
var a, b;
var counter = 0;
async function fn() {
for await ([ a = x += 1, b = x *= 2 ] of [[]]) {
assert.sameValue(a, 1);
assert.sameValue(b, 2);
assert.sameValue(x, 2);
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-init-simple-no-strict.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: Identifiers that appear as the DestructuringAssignmentTarget in an AssignmentElement should take on the iterated value corresponding to their position in the ArrayAssignmentPattern. (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [destructuring-binding, async-iteration]
flags: [generated, noStrict, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
---*/
var argument, eval;
var counter = 0;
async function fn() {
for await ([arguments = 4, eval = 5] of [[]]) {
assert.sameValue(arguments, 4);
assert.sameValue(eval, 5);
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-init-yield-expr.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: When a `yield` token appears within the Initializer of an AssignmentElement within a generator function body, it behaves as a YieldExpression. (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [generators, destructuring-binding, async-iteration]
flags: [generated, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
---*/
var value = [];
var iterationResult, iter, x;
iter = (function*() {
var counter = 0;
async function fn() {
for await ([ x = yield ] of [[]]) {
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
})();
iterationResult = iter.next();
assert.sameValue(iterationResult.value, undefined);
assert.sameValue(iterationResult.done, false);
assert.sameValue(x, undefined);
iterationResult = iter.next(86);
assert.sameValue(iterationResult.value, undefined);
assert.sameValue(iterationResult.done, true);
assert.sameValue(x, 86);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-init-yield-ident-valid.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: When a `yield` token appears within the Initializer of an AssignmentElement outside of a generator function body, it behaves as an IdentifierReference. (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [destructuring-binding, async-iteration]
flags: [generated, noStrict, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
---*/
var yield = 4;
var x;
var counter = 0;
async function fn() {
for await ([ x = yield ] of [[]]) {
assert.sameValue(x, 4);
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-iter-nrml-close-skip.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: IteratorClose is not called when assignment evaluation has exhausted the iterator (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [Symbol.iterator, destructuring-binding, async-iteration]
flags: [generated, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
ArrayAssignmentPattern : [ AssignmentElementList ]
[...]
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator, result).
6. Return result.
---*/
var nextCount = 0;
var returnCount = 0;
var _;
var iterable = {};
var iterator = {
next: function() {
nextCount += 1;
return { done: true };
},
return: function() {
returnCount += 1;
return {};
}
};
iterable[Symbol.iterator] = function() {
return iterator;
};
var counter = 0;
async function fn() {
for await ([ _ ] of [iterable]) {
assert.sameValue(nextCount, 1);
assert.sameValue(returnCount, 0);
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-iter-nrml-close.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: IteratorClose is called when assignment evaluation has not exhausted the iterator (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [Symbol.iterator, destructuring-binding, async-iteration]
flags: [generated, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
ArrayAssignmentPattern : [ AssignmentElementList ]
[...]
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
result).
6. Return result.
7.4.6 IteratorClose( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
[...]
---*/
var nextCount = 0;
var returnCount = 0;
var thisValue = null;
var args = null;
var _;
var iterable = {};
var iterator = {
next: function() {
nextCount += 1;
// Set an upper-bound to limit unnecessary iteration in non-conformant
// implementations
return { done: nextCount > 10 };
},
return: function() {
returnCount += 1;
thisValue = this;
args = arguments;
return {};
}
};
iterable[Symbol.iterator] = function() {
return iterator;
};
var counter = 0;
async function fn() {
for await ([ _ ] of [iterable]) {
assert.sameValue(nextCount, 1);
assert.sameValue(returnCount, 1);
assert.sameValue(thisValue, iterator, 'correct `this` value');
assert(!!args, 'arguments object provided');
assert.sameValue(args.length, 0, 'zero arguments specified');
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-iter-rtrn-close-err.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: IteratorClose is called when reference evaluation produces a "return" completion (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [Symbol.iterator, generators, destructuring-binding, async-iteration]
flags: [generated, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
ArrayAssignmentPattern : [ AssignmentElementList ]
[...]
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
result).
6. Return result.
7.4.6 IteratorClose( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
7. If completion.[[type]] is throw, return Completion(completion).
8. If innerResult.[[type]] is throw, return Completion(innerResult).
---*/
var returnCount = 0;
var unreachable = 0;
var iterable = {};
var iterator = {
return: function() {
returnCount += 1;
throw new Test262Error();
}
};
var iter;
iterable[Symbol.iterator] = function() {
return iterator;
};
function* g() {
var counter = 0;
async function fn() {
for await ([ {}[ yield ] ] of [iterable]) {
unreachable += 1;
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
}
iter = g();
iter.next();
assert.throws(Test262Error, function() {
iter.return();
});
assert.sameValue(returnCount, 1);
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-iter-rtrn-close-null.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: IteratorClose throws a TypeError when `return` returns a non-Object value (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [Symbol.iterator, generators, destructuring-binding, async-iteration]
flags: [generated, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
ArrayAssignmentPattern : [ AssignmentElementList ]
[...]
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
result).
6. Return result.
7.4.6 IteratorClose( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
7. If completion.[[type]] is throw, return Completion(completion).
8. If innerResult.[[type]] is throw, return Completion(innerResult).
9. If Type(innerResult.[[value]]) is not Object, throw a TypeError
exception.
---*/
var iterable = {};
var iterator = {
return: function() {
return null;
}
};
var iter;
iterable[Symbol.iterator] = function() {
return iterator;
};
function* g() {
var counter = 0;
async function fn() {
for await ([ {}[yield] ] of [iterable]) {
unreachable += 1;
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
}
iter = g();
iter.next();
assert.throws(TypeError, function() {
iter.return();
});
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-iter-rtrn-close.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: IteratorClose is called when reference evaluation produces a "return" completion (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [Symbol.iterator, generators, destructuring-binding, async-iteration]
flags: [generated, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
ArrayAssignmentPattern : [ AssignmentElementList ]
[...]
5. If iteratorRecord.[[done]] is false, return IteratorClose(iterator,
result).
6. Return result.
7.4.6 IteratorClose( iterator, completion )
[...]
6. Let innerResult be Call(return, iterator, « »).
7. If completion.[[type]] is throw, return Completion(completion).
8. If innerResult.[[type]] is throw, return Completion(innerResult).
---*/
var returnCount = 0;
var unreachable = 0;
var thisValue = null;
var args = null;
var iterable = {};
var iterator = {
return: function() {
returnCount += 1;
thisValue = this;
args = arguments;
return {};
}
};
var iter, result;
iterable[Symbol.iterator] = function() {
return iterator;
};
function* g() {
var counter = 0;
async function fn() {
for await ([ {}[yield] ] of [iterable]) {
unreachable += 1;
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
}
iter = g();
iter.next();
result = iter.return(777);
assert.sameValue(returnCount, 1);
assert.sameValue(unreachable, 0, 'Unreachable statement was not executed');
assert.sameValue(result.value, 777);
assert(result.done, 'Iterator correctly closed');
assert.sameValue(thisValue, iterator, 'correct `this` value');
assert(!!args, 'arguments object provided');
assert.sameValue(args.length, 0, 'zero arguments specified');
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-nested-array-yield-expr.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment and within a generator function body, it behaves as a YieldExpression. (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [generators, destructuring-binding, async-iteration]
flags: [generated, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
---*/
var value = [[22]];
var x = {};
var iterationResult, iter;
iter = (function*() {
var counter = 0;
async function fn() {
for await ([[x[yield]]] of [value]) {
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
}());
iterationResult = iter.next();
assert.sameValue(iterationResult.value, undefined);
assert.sameValue(iterationResult.done, false);
assert.sameValue(x.prop, undefined);
iterationResult = iter.next('prop');
assert.sameValue(iterationResult.value, undefined);
assert.sameValue(iterationResult.done, true);
assert.sameValue(x.prop, 22);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-nested-array-yield-ident-valid.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: When a `yield` token appears within the DestructuringAssignmentTarget of a nested destructuring assignment outside of strict mode, it behaves as an IdentifierReference. (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [destructuring-binding, async-iteration]
flags: [generated, noStrict, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
---*/
var yield = 'prop';
var x = {};
var counter = 0;
async function fn() {
for await ([[x[yield]]] of [[[22]]]) {
assert.sameValue(x.prop, 22);
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-assignment/array-elem-nested-array.case
// - src/dstr-assignment/default/for-await-of.template
/*---
description: When DestructuringAssignmentTarget is an array literal, it should be parsed parsed as a DestructuringAssignmentPattern and evaluated as a destructuring assignment. (for-await-of statement)
esid: sec-for-in-and-for-of-statements-runtime-semantics-labelledevaluation
features: [destructuring-binding, async-iteration]
flags: [generated, async]
info: |
IterationStatement :
for await ( LeftHandSideExpression of AssignmentExpression ) Statement
1. Let keyResult be the result of performing ? ForIn/OfHeadEvaluation(« »,
AssignmentExpression, iterate).
2. Return ? ForIn/OfBodyEvaluation(LeftHandSideExpression, Statement,
keyResult, assignment, labelSet).
13.7.5.13 Runtime Semantics: ForIn/OfBodyEvaluation
[...]
5. If destructuring is true and if lhsKind is assignment, then
a. Assert: lhs is a LeftHandSideExpression.
b. Let assignmentPattern be the parse of the source text corresponding to
lhs using AssignmentPattern as the goal symbol.
[...]
---*/
var x;
var counter = 0;
async function fn() {
for await ([[x]] of [[[1]]]) {
assert.sameValue(x, 1);
counter += 1;
}
}
fn()
.then(() => assert.sameValue(counter, 1, 'iteration occurred as expected'), $DONE)
.then($DONE, $DONE);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment