Skip to content
Snippets Groups Projects
Commit b0e921ff authored by Rick Waldron's avatar Rick Waldron Committed by GitHub
Browse files

Merge pull request #921 from leobalter/async-gen-templates-dstr

Add async generator templates for destructing binding
parents 5da6f981 285888ad
No related branches found
No related tags found
No related merge requests found
Showing
with 870 additions and 0 deletions
// 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/async-generator/dstr-dflt-
name: async generator function declaration (default parameter)
esid: sec-asyncgenerator-definitions-instantiatefunctionobject
features: [async-iteration]
info: |
AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
[...]
3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
async function* f(/*{ elems }*/ = /*{ vals }*/) {
/*{ body }*/
callCount = callCount + 1;
};
f().next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/async-generator/dstr-
name: async generator function declaration
esid: sec-asyncgenerator-definitions-instantiatefunctionobject
features: [async-iteration]
info: |
AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
[...]
3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody,
scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
async function* f(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
};
f(/*{ vals }*/).next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/expressions/async-generator/dstr-dflt-
name: async generator function expression (default parameter)
esid: sec-asyncgenerator-definitions-evaluation
features: [async-iteration]
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
AsyncGeneratorBody }
[...]
3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var f;
f = async function*(/*{ elems }*/ = /*{ vals }*/) {
/*{ body }*/
callCount = callCount + 1;
};
f().next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/expressions/async-generator/dstr-
name: async generator function expression
esid: sec-asyncgenerator-definitions-evaluation
features: [async-iteration]
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
AsyncGeneratorBody }
[...]
3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var f;
f = async function*(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
};
f(/*{ vals }*/).next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/expressions/async-generator/dstr-named-dflt-
name: async generator named function expression (default parameter)
esid: sec-asyncgenerator-definitions-evaluation
features: [async-iteration]
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
[...]
7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
AsyncGeneratorBody, funcEnv, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var f;
f = async function* g(/*{ elems }*/ = /*{ vals }*/) {
/*{ body }*/
callCount = callCount + 1;
};
f().next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/expressions/async-generator/dstr-named-
name: async generator named function expression
esid: sec-asyncgenerator-definitions-evaluation
features: [async-iteration]
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier
( FormalParameters ) { AsyncGeneratorBody }
[...]
7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
AsyncGeneratorBody, funcEnv, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var f;
f = async function* g(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
};
f(/*{ vals }*/).next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/expressions/object/dstr-async-gen-meth-
name: async generator method
esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
features: [async-iteration]
info: |
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
Otherwise let strict be false.
4. Let scope be the running execution context's LexicalEnvironment.
5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var obj = {
async *method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
obj.method(/*{ vals }*/).next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/expressions/object/dstr-async-gen-meth-dflt-
name: async generator method (default parameter)
esid: sec-asyncgenerator-definitions-propertydefinitionevaluation
features: [async-iteration]
info: |
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
Otherwise let strict be false.
4. Let scope be the running execution context's LexicalEnvironment.
5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var obj = {
async *method(/*{ elems }*/ = /*{ vals }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
obj.method().next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/class/dstr-async-gen-meth-dflt-
name: class expression async generator method (default parameters)
esid: sec-class-definitions-runtime-semantics-evaluation
features: [async-iteration]
info: |
ClassDeclaration : class BindingIdentifier ClassTail
1. Let className be StringValue of BindingIdentifier.
2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing
PropertyDefinitionEvaluation for m with arguments proto and
false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
Otherwise let strict be false.
4. Let scope be the running execution context's LexicalEnvironment.
5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
class C {
async *method(/*{ elems }*/ = /*{ vals }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
new C().method().next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/class/dstr-async-gen-meth-static-dflt-
name: static class expression async generator method (default parameter)
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
features: [async-iteration]
info: |
ClassDeclaration : class BindingIdentifier ClassTail
1. Let className be StringValue of BindingIdentifier.
2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
b. Else,
Let status be the result of performing PropertyDefinitionEvaluation for
m with arguments F and false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
Otherwise let strict be false.
4. Let scope be the running execution context's LexicalEnvironment.
5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
class C {
static async *method(/*{ elems }*/ = /*{ vals }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
C.method().next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/class/dstr-async-gen-meth-static-
name: static class expression async generator method
esid: sec-runtime-semantics-bindingclassdeclarationevaluation
features: [async-iteration]
info: |
ClassDeclaration : class BindingIdentifier ClassTail
1. Let className be StringValue of BindingIdentifier.
2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
b. Else,
Let status be the result of performing PropertyDefinitionEvaluation for
m with arguments F and false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
Otherwise let strict be false.
4. Let scope be the running execution context's LexicalEnvironment.
5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
class C {
static async *method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
C.method(/*{ vals }*/).next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/class/dstr-async-gen-meth-
name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation
features: [async-iteration]
info: |
ClassDeclaration : class BindingIdentifier ClassTail
1. Let className be StringValue of BindingIdentifier.
2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing
PropertyDefinitionEvaluation for m with arguments proto and
false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
Otherwise let strict be false.
4. Let scope be the running execution context's LexicalEnvironment.
5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
class C {
async *method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
new C().method(/*{ vals }*/).then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/expressions/class/dstr-async-gen-meth-dflt-
name: class expression async generator method (default parameter)
esid: sec-class-definitions-runtime-semantics-evaluation
features: [async-iteration]
info: |
ClassExpression : class BindingIdentifieropt ClassTail
1. If BindingIdentifieropt is not present, let className be undefined.
2. Else, let className be StringValue of BindingIdentifier.
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
with argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing
PropertyDefinitionEvaluation for m with arguments proto and
false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
Otherwise let strict be false.
4. Let scope be the running execution context's LexicalEnvironment.
5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var C = class {
async *method(/*{ elems }*/ = /*{ vals }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
new C().method().next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/expressions/class/dstr-async-gen-meth-static-dflt-
name: static class expression async generator method (default parameter)
esid: sec-class-definitions-runtime-semantics-evaluation
features: [async-iteration]
info: |
ClassExpression : class BindingIdentifieropt ClassTail
1. If BindingIdentifieropt is not present, let className be undefined.
2. Else, let className be StringValue of BindingIdentifier.
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
with argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
b. Else,
Let status be the result of performing PropertyDefinitionEvaluation
for m with arguments F and false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
Otherwise let strict be false.
4. Let scope be the running execution context's LexicalEnvironment.
5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var C = class {
static async *method(/*{ elems }*/ = /*{ vals }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
C.method().next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/expressions/class/dstr-async-gen-meth-static-
name: static class expression async generator method
esid: sec-class-definitions-runtime-semantics-evaluation
features: [async-iteration]
info: |
ClassExpression : class BindingIdentifieropt ClassTail
1. If BindingIdentifieropt is not present, let className be undefined.
2. Else, let className be StringValue of BindingIdentifier.
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
with argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
b. Else,
Let status be the result of performing PropertyDefinitionEvaluation
for m with arguments F and false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
Otherwise let strict be false.
4. Let scope be the running execution context's LexicalEnvironment.
5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var C = class {
static async *method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
C.method(/*{ vals }*/).next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// 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/expressions/class/dstr-async-gen-meth-
name: class expression method
esid: sec-class-definitions-runtime-semantics-evaluation
features: [async-iteration]
info: |
ClassExpression : class BindingIdentifieropt ClassTail
1. If BindingIdentifieropt is not present, let className be undefined.
2. Else, let className be StringValue of BindingIdentifier.
3. Let value be the result of ClassDefinitionEvaluation of ClassTail
with argument className.
[...]
14.5.14 Runtime Semantics: ClassDefinitionEvaluation
21. For each ClassElement m in order from methods
a. If IsStatic of m is false, then
i. Let status be the result of performing
PropertyDefinitionEvaluation for m with arguments proto and
false.
[...]
Runtime Semantics: PropertyDefinitionEvaluation
AsyncGeneratorMethod :
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters )
{ AsyncGeneratorBody }
1. Let propKey be the result of evaluating PropertyName.
2. ReturnIfAbrupt(propKey).
3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true.
Otherwise let strict be false.
4. Let scope be the running execution context's LexicalEnvironment.
5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
flags: [async]
---*/
var callCount = 0;
var C = class {
async *method(/*{ elems }*/) {
/*{ body }*/
callCount = callCount + 1;
}
};
new C().method(/*{ vals }*/).next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-init-iter-close.case
// - src/dstr-binding/default/async-gen-func-expr.template
/*---
description: Iterator is closed when not exhausted by pattern evaluation (async generator function expression)
esid: sec-asyncgenerator-definitions-evaluation
features: [Symbol.iterator, async-iteration]
flags: [generated, async]
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
AsyncGeneratorBody }
[...]
3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
13.3.3.5 Runtime Semantics: BindingInitialization
BindingPattern : ArrayBindingPattern
[...]
4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator,
result).
[...]
---*/
var doneCallCount = 0;
var iter = {};
iter[Symbol.iterator] = function() {
return {
next: function() {
return { value: null, done: false };
},
return: function() {
doneCallCount += 1;
return {};
}
};
};
var callCount = 0;
var f;
f = async function*([x]) {
assert.sameValue(doneCallCount, 1);
callCount = callCount + 1;
};
f(iter).next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-init-iter-no-close.case
// - src/dstr-binding/default/async-gen-func-expr.template
/*---
description: Iterator is not closed when exhausted by pattern evaluation (async generator function expression)
esid: sec-asyncgenerator-definitions-evaluation
features: [Symbol.iterator, async-iteration]
flags: [generated, async]
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
AsyncGeneratorBody }
[...]
3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
13.3.3.5 Runtime Semantics: BindingInitialization
BindingPattern : ArrayBindingPattern
[...]
4. If iteratorRecord.[[done]] is false, return ? IteratorClose(iterator,
result).
[...]
---*/
var doneCallCount = 0;
var iter = {};
iter[Symbol.iterator] = function() {
return {
next: function() {
return { value: null, done: true };
},
return: function() {
doneCallCount += 1;
return {};
}
};
};
var callCount = 0;
var f;
f = async function*([x]) {
assert.sameValue(doneCallCount, 0);
callCount = callCount + 1;
};
f(iter).next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-name-iter-val.case
// - src/dstr-binding/default/async-gen-func-expr.template
/*---
description: SingleNameBinding with normal value iteration (async generator function expression)
esid: sec-asyncgenerator-definitions-evaluation
features: [async-iteration]
flags: [generated, async]
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
AsyncGeneratorBody }
[...]
3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
SingleNameBinding : BindingIdentifier Initializeropt
[...]
4. If iteratorRecord.[[done]] is false, then
a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
c. ReturnIfAbrupt(next).
d. If next is false, set iteratorRecord.[[done]] to true.
e. Else,
[...]
i. Let v be IteratorValue(next).
ii. If v is an abrupt completion, set
iteratorRecord.[[done]] to true.
iii. ReturnIfAbrupt(v).
5. If iteratorRecord.[[done]] is true, let v be undefined.
[...]
8. Return InitializeReferencedBinding(lhs, v).
---*/
var callCount = 0;
var f;
f = async function*([x, y, z]) {
assert.sameValue(x, 1);
assert.sameValue(y, 2);
assert.sameValue(z, 3);
callCount = callCount + 1;
};
f([1, 2, 3]).next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).then($DONE, $DONE);
// This file was procedurally generated from the following sources:
// - src/dstr-binding/ary-ptrn-elem-ary-elem-init.case
// - src/dstr-binding/default/async-gen-func-expr.template
/*---
description: BindingElement with array binding pattern and initializer is used (async generator function expression)
esid: sec-asyncgenerator-definitions-evaluation
features: [async-iteration]
flags: [generated, async]
info: |
AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) {
AsyncGeneratorBody }
[...]
3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters,
AsyncGeneratorBody, scope, strict).
[...]
13.3.3.6 Runtime Semantics: IteratorBindingInitialization
BindingElement : BindingPatternInitializer opt
[...]
2. If iteratorRecord.[[done]] is true, let v be undefined.
3. If Initializer is present and v is undefined, then
a. Let defaultValue be the result of evaluating Initializer.
b. Let v be ? GetValue(defaultValue).
4. Return the result of performing BindingInitialization of BindingPattern
with v and environment as the arguments.
---*/
var callCount = 0;
var f;
f = async function*([[x, y, z] = [4, 5, 6]]) {
assert.sameValue(x, 4);
assert.sameValue(y, 5);
assert.sameValue(z, 6);
callCount = callCount + 1;
};
f([]).next().then(() => {
assert.sameValue(callCount, 1, 'invoked exactly once');
}).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