mirror of
https://github.com/tc39/test262.git
synced 2025-07-27 07:54:41 +02:00
Merge pull request #918 from leobalter/async-gen-templates
Add async generator templates
This commit is contained in:
commit
54922174eb
@ -0,0 +1,35 @@
|
|||||||
|
// 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/async-gen-method-
|
||||||
|
name: Async Generator method as a ClassDeclaration element
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
class C { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,35 @@
|
|||||||
|
// 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/async-gen-method-static-
|
||||||
|
name: Static async generator method as a ClassDeclaration element
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
class C { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,35 @@
|
|||||||
|
// 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/async-gen-method-
|
||||||
|
name: Async generator method as a ClassExpression element
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,35 @@
|
|||||||
|
// 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/async-gen-method-static-
|
||||||
|
name: Static async generator method as a ClassExpression element
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
28
src/async-generators/default/async-declaration.template
Normal file
28
src/async-generators/default/async-declaration.template
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// 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/
|
||||||
|
name: Async generator Function declaration
|
||||||
|
esid: prod-AsyncGeneratorDeclaration
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorDeclaration:
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
async function *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
}
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
28
src/async-generators/default/async-expression-named.template
Normal file
28
src/async-generators/default/async-expression-named.template
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// 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/named-
|
||||||
|
name: Named async generator expression
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
28
src/async-generators/default/async-expression.template
Normal file
28
src/async-generators/default/async-expression.template
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// 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/
|
||||||
|
name: Unnamed async generator expression
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
28
src/async-generators/default/async-obj-method.template
Normal file
28
src/async-generators/default/async-obj-method.template
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// 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/method-definition/async-gen-
|
||||||
|
name: Async generator method
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
28
src/async-generators/non-strict/async-declaration.template
Normal file
28
src/async-generators/non-strict/async-declaration.template
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// 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/
|
||||||
|
name: Async generator function declaration - valid for non-strict only cases
|
||||||
|
esid: prod-AsyncGeneratorDeclaration
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorDeclaration:
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
async function *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
}
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,28 @@
|
|||||||
|
// 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/named-
|
||||||
|
name: Async generator named expression - valid for non-strict only cases
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
28
src/async-generators/non-strict/async-expression.template
Normal file
28
src/async-generators/non-strict/async-expression.template
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// 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/
|
||||||
|
name: Async generator expression - valid for non-strict only cases
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
29
src/async-generators/non-strict/async-obj-method.template
Normal file
29
src/async-generators/non-strict/async-obj-method.template
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// 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/method-definition/async-gen-
|
||||||
|
name: Generator method - valid for non-strict only cases
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
features: [async-iteration]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = {
|
||||||
|
async *method() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
}
|
||||||
|
}.method;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
30
src/async-generators/yield-identifier-non-strict.case
Normal file
30
src/async-generators/yield-identifier-non-strict.case
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: >
|
||||||
|
Use of yield as a valid identifier in a function body inside a generator body
|
||||||
|
in non strict mode
|
||||||
|
template: non-strict
|
||||||
|
flags: [noStrict, async]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- body
|
||||||
|
return (function(arg) {
|
||||||
|
var yield = arg + 1;
|
||||||
|
return yield;
|
||||||
|
}(yield))
|
||||||
|
//- assertions
|
||||||
|
var item = iter.next();
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
assert.sameValue(value, undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
item = iter.next(42);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true);
|
||||||
|
assert.sameValue(value, 43);
|
||||||
|
}).then($DONE, $DONE);
|
49
src/async-generators/yield-identifier-spread-non-strict.case
Normal file
49
src/async-generators/yield-identifier-spread-non-strict.case
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: >
|
||||||
|
Mixed use of object spread and yield as a valid identifier in a function body
|
||||||
|
inside a generator body in non strict mode
|
||||||
|
template: non-strict
|
||||||
|
info: |
|
||||||
|
Spread Properties
|
||||||
|
|
||||||
|
PropertyDefinition[Yield]:
|
||||||
|
(...)
|
||||||
|
...AssignmentExpression[In, ?Yield]
|
||||||
|
features: [object-spread]
|
||||||
|
flags: [noStrict, async]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var s = Symbol('s');
|
||||||
|
//- body
|
||||||
|
yield {
|
||||||
|
...yield yield,
|
||||||
|
...(function(arg) {
|
||||||
|
var yield = arg;
|
||||||
|
return {...yield};
|
||||||
|
}(yield)),
|
||||||
|
...yield,
|
||||||
|
}
|
||||||
|
//- assertions
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next();
|
||||||
|
iter.next();
|
||||||
|
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
|
||||||
|
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
|
||||||
|
var item = iter.next({ z: 30, b: 2 });
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
assert.sameValue(value.x, 10);
|
||||||
|
assert.sameValue(value.y, 20);
|
||||||
|
assert.sameValue(value.z, 30);
|
||||||
|
assert.sameValue(value.a, 1);
|
||||||
|
assert.sameValue(value.b, 2);
|
||||||
|
assert.sameValue(value[s], 42);
|
||||||
|
assert.sameValue(Object.keys(value).length, 5);
|
||||||
|
assert(Object.hasOwnProperty.call(value, s));
|
||||||
|
}).then($DONE, $DONE);
|
28
src/async-generators/yield-identifier-spread-strict.case
Normal file
28
src/async-generators/yield-identifier-spread-strict.case
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: >
|
||||||
|
It's an early error if the AssignmentExpression is a function body with yield
|
||||||
|
as an identifier in strict mode.
|
||||||
|
template: default
|
||||||
|
info: |
|
||||||
|
Spread Properties
|
||||||
|
|
||||||
|
PropertyDefinition[Yield]:
|
||||||
|
(...)
|
||||||
|
...AssignmentExpression[In, ?Yield]
|
||||||
|
features: [object-spread]
|
||||||
|
flags: [onlyStrict]
|
||||||
|
negative:
|
||||||
|
phase: early
|
||||||
|
type: SyntaxError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- body
|
||||||
|
return {
|
||||||
|
...(function() {
|
||||||
|
var yield;
|
||||||
|
throw new Test262Error();
|
||||||
|
}()),
|
||||||
|
}
|
19
src/async-generators/yield-identifier-strict.case
Normal file
19
src/async-generators/yield-identifier-strict.case
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: >
|
||||||
|
It's an early error if the generator body has another function body with
|
||||||
|
yield as an identifier in strict mode.
|
||||||
|
template: default
|
||||||
|
flags: [onlyStrict]
|
||||||
|
negative:
|
||||||
|
phase: early
|
||||||
|
type: SyntaxError
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- body
|
||||||
|
(function() {
|
||||||
|
var yield;
|
||||||
|
throw new Test262Error();
|
||||||
|
}())
|
33
src/async-generators/yield-spread-arr-multiple.case
Normal file
33
src/async-generators/yield-spread-arr-multiple.case
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Use yield value in a array spread position
|
||||||
|
template: default
|
||||||
|
info: |
|
||||||
|
Array Initializer
|
||||||
|
|
||||||
|
SpreadElement[Yield, Await]:
|
||||||
|
...AssignmentExpression[+In, ?Yield, ?Await]
|
||||||
|
includes:
|
||||||
|
- compareArray.js
|
||||||
|
flags: [async]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var arr = ['a', 'b', 'c'];
|
||||||
|
var item;
|
||||||
|
//- body
|
||||||
|
yield [...yield yield];
|
||||||
|
//- assertions
|
||||||
|
iter.next(false);
|
||||||
|
item = iter.next(['a', 'b', 'c']);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
item = iter.next(value);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert(compareArray(value, arr));
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
31
src/async-generators/yield-spread-arr-single.case
Normal file
31
src/async-generators/yield-spread-arr-single.case
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Use yield value in a array spread position
|
||||||
|
template: default
|
||||||
|
info: |
|
||||||
|
Array Initializer
|
||||||
|
|
||||||
|
SpreadElement[Yield, Await]:
|
||||||
|
...AssignmentExpression[+In, ?Yield, ?Await]
|
||||||
|
flags: [async]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var arr = ['a', 'b', 'c'];
|
||||||
|
//- body
|
||||||
|
yield [...yield];
|
||||||
|
//- assertions
|
||||||
|
iter.next(false);
|
||||||
|
var item = iter.next(arr);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.notSameValue(value, arr, 'value is a new array');
|
||||||
|
assert(Array.isArray(value), 'value is an Array exotic object');
|
||||||
|
assert.sameValue(value.length, 3)
|
||||||
|
assert.sameValue(value[0], 'a');
|
||||||
|
assert.sameValue(value[1], 'b');
|
||||||
|
assert.sameValue(value[2], 'c');
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
36
src/async-generators/yield-spread-obj.case
Normal file
36
src/async-generators/yield-spread-obj.case
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
|
|
||||||
|
/*---
|
||||||
|
desc: Use yield value in a object spread position
|
||||||
|
template: default
|
||||||
|
info: |
|
||||||
|
Spread Properties
|
||||||
|
|
||||||
|
PropertyDefinition[Yield]:
|
||||||
|
(...)
|
||||||
|
...AssignmentExpression[In, ?Yield]
|
||||||
|
features: [object-spread]
|
||||||
|
includes:
|
||||||
|
- compareArray.js
|
||||||
|
flags: [async]
|
||||||
|
---*/
|
||||||
|
|
||||||
|
//- body
|
||||||
|
yield {
|
||||||
|
...yield,
|
||||||
|
y: 1,
|
||||||
|
...yield yield,
|
||||||
|
};
|
||||||
|
//- assertions
|
||||||
|
iter.next();
|
||||||
|
iter.next({ x: 42 });
|
||||||
|
iter.next({ x: 'lol' });
|
||||||
|
var item = iter.next({ y: 39 });
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(value.x, 42);
|
||||||
|
assert.sameValue(value.y, 39);
|
||||||
|
assert.sameValue(Object.keys(value).length, 2);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
33
src/generators/default/class-decl-method.template
Normal file
33
src/generators/default/class-decl-method.template
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// 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/gen-method-
|
||||||
|
name: Geenerator method as a ClassDeclaration element
|
||||||
|
esid: prod-GeneratorMethod
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
GeneratorMethod
|
||||||
|
|
||||||
|
14.4 Generator Function Definitions
|
||||||
|
|
||||||
|
GeneratorMethod :
|
||||||
|
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
class C { *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
33
src/generators/default/class-decl-static-method.template
Normal file
33
src/generators/default/class-decl-static-method.template
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// 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/gen-method-static-
|
||||||
|
name: Static generator method as a ClassDeclaration element
|
||||||
|
esid: prod-GeneratorMethod
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
GeneratorMethod
|
||||||
|
|
||||||
|
14.4 Generator Function Definitions
|
||||||
|
|
||||||
|
GeneratorMethod :
|
||||||
|
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
class C {static *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -2,24 +2,24 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
path: language/expressions/class/gen-method-
|
path: language/expressions/class/gen-method-
|
||||||
name: Generator method as a ClassElement
|
name: Generator method as a ClassExpression element
|
||||||
esid: prod-GeneratorMethod
|
esid: prod-GeneratorMethod
|
||||||
info: |
|
info: |
|
||||||
ClassElement[Yield, Await]:
|
ClassElement :
|
||||||
MethodDefinition[?Yield, ?Await]
|
MethodDefinition
|
||||||
|
|
||||||
MethodDefinition[Yield, Await]:
|
MethodDefinition :
|
||||||
GeneratorMethod[?Yield, ?Await]
|
GeneratorMethod
|
||||||
|
|
||||||
14.4 Generator Function Definitions
|
14.4 Generator Function Definitions
|
||||||
|
|
||||||
GeneratorMethod[Yield, Await]:
|
GeneratorMethod :
|
||||||
* PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody }
|
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var callCount = 0;
|
var callCount = 0;
|
||||||
|
|
||||||
class C { *gen() {
|
var C = class {*gen() {
|
||||||
callCount += 1;
|
callCount += 1;
|
||||||
/*{ body }*/
|
/*{ body }*/
|
||||||
}}
|
}}
|
33
src/generators/default/class-expr-static-method.template
Normal file
33
src/generators/default/class-expr-static-method.template
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
// 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/gen-method-static-
|
||||||
|
name: Static generator method as a ClassExpression element
|
||||||
|
esid: prod-GeneratorMethod
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
GeneratorMethod
|
||||||
|
|
||||||
|
14.4 Generator Function Definitions
|
||||||
|
|
||||||
|
GeneratorMethod :
|
||||||
|
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -2,13 +2,13 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
path: language/statements/generators/
|
path: language/statements/generators/
|
||||||
name: Generator function declaration
|
name: Generator Function declaration
|
||||||
esid: prod-GeneratorDeclaration
|
esid: prod-GeneratorDeclaration
|
||||||
info: |
|
info: |
|
||||||
14.4 Generator Function Definitions
|
14.4 Generator Function Definitions
|
||||||
|
|
||||||
GeneratorDeclaration[Yield, Await, Default]:
|
GeneratorDeclaration :
|
||||||
function * BindingIdentifier[?Yield, ?Await] ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
|
function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var callCount = 0;
|
var callCount = 0;
|
25
src/generators/default/expression-named.template
Normal file
25
src/generators/default/expression-named.template
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// 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/generators/named-
|
||||||
|
name: Named generator expression
|
||||||
|
esid: prod-GeneratorExpression
|
||||||
|
info: |
|
||||||
|
14.4 Generator Function Definitions
|
||||||
|
|
||||||
|
GeneratorExpression:
|
||||||
|
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -2,13 +2,13 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
path: language/expressions/generators/
|
path: language/expressions/generators/
|
||||||
name: Generator expression
|
name: Unnamed generator expression
|
||||||
esid: prod-GeneratorExpression
|
esid: prod-GeneratorExpression
|
||||||
info: |
|
info: |
|
||||||
14.4 Generator Function Definitions
|
14.4 Generator Function Definitions
|
||||||
|
|
||||||
GeneratorExpression:
|
GeneratorExpression:
|
||||||
function * BindingIdentifier[+Yield, ~Await]opt ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
|
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var callCount = 0;
|
var callCount = 0;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
path: language/expressions/object/method-definition/generator-
|
path: language/expressions/object/method-definition/gen-
|
||||||
name: Generator method
|
name: Generator method
|
||||||
esid: prod-GeneratorMethod
|
esid: prod-GeneratorMethod
|
||||||
info: |
|
info: |
|
25
src/generators/non-strict/expression-named.template
Normal file
25
src/generators/non-strict/expression-named.template
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// 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/generators/named-
|
||||||
|
name: Generator named expression - valid for non-strict only cases
|
||||||
|
esid: prod-GeneratorExpression
|
||||||
|
info: |
|
||||||
|
14.4 Generator Function Definitions
|
||||||
|
|
||||||
|
GeneratorExpression:
|
||||||
|
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
|
||||||
|
---*/
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
/*{ body }*/
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
/*{ assertions }*/
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -8,7 +8,7 @@ info: |
|
|||||||
14.4 Generator Function Definitions
|
14.4 Generator Function Definitions
|
||||||
|
|
||||||
GeneratorExpression:
|
GeneratorExpression:
|
||||||
function * BindingIdentifier[+Yield, ~Await]opt ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
|
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var callCount = 0;
|
var callCount = 0;
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
// Copyright (C) 2017 the V8 project authors. All rights reserved.
|
||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
path: language/expressions/object/method-definition/generator-
|
path: language/expressions/object/method-definition/gen-
|
||||||
name: Generator method - valid for non-strict only cases
|
name: Generator method - valid for non-strict only cases
|
||||||
esid: prod-GeneratorMethod
|
esid: prod-GeneratorMethod
|
||||||
info: |
|
info: |
|
||||||
14.4 Generator Function Definitions
|
14.4 Generator Function Definitions
|
||||||
|
|
||||||
GeneratorMethod[Yield, Await]:
|
GeneratorMethod[Yield, Await]:
|
||||||
* PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody }
|
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var callCount = 0;
|
var callCount = 0;
|
@ -16,6 +16,8 @@ features: [object-spread]
|
|||||||
flags: [noStrict]
|
flags: [noStrict]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
|
//- setup
|
||||||
|
var s = Symbol('s');
|
||||||
//- body
|
//- body
|
||||||
yield {
|
yield {
|
||||||
...yield yield,
|
...yield yield,
|
||||||
@ -30,14 +32,18 @@ var iter = gen();
|
|||||||
|
|
||||||
iter.next();
|
iter.next();
|
||||||
iter.next();
|
iter.next();
|
||||||
iter.next({ x: 10, a: 0, b: 0 });
|
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
|
||||||
iter.next({ y: 20, a: 1, b: 1 });
|
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
|
||||||
var item = iter.next({ z: 30, b: 2 });
|
var item = iter.next({ z: 30, b: 2 });
|
||||||
|
|
||||||
|
var value = item.value;
|
||||||
|
|
||||||
assert.sameValue(item.done, false);
|
assert.sameValue(item.done, false);
|
||||||
assert.sameValue(item.value.x, 10);
|
assert.sameValue(value.x, 10);
|
||||||
assert.sameValue(item.value.y, 20);
|
assert.sameValue(value.y, 20);
|
||||||
assert.sameValue(item.value.z, 30);
|
assert.sameValue(value.z, 30);
|
||||||
assert.sameValue(item.value.a, 1);
|
assert.sameValue(value.a, 1);
|
||||||
assert.sameValue(item.value.b, 2);
|
assert.sameValue(value.b, 2);
|
||||||
assert.sameValue(Object.keys(item.value).length, 5);
|
assert.sameValue(value[s], 42);
|
||||||
|
assert(Object.hasOwnProperty.call(value, s));
|
||||||
|
assert.sameValue(Object.keys(value).length, 5);
|
||||||
|
@ -9,8 +9,6 @@ info: |
|
|||||||
|
|
||||||
SpreadElement[Yield, Await]:
|
SpreadElement[Yield, Await]:
|
||||||
...AssignmentExpression[+In, ?Yield, ?Await]
|
...AssignmentExpression[+In, ?Yield, ?Await]
|
||||||
includes:
|
|
||||||
- compareArray.js
|
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
//- setup
|
//- setup
|
||||||
@ -19,7 +17,13 @@ var arr = ['a', 'b', 'c'];
|
|||||||
yield [...yield];
|
yield [...yield];
|
||||||
//- assertions
|
//- assertions
|
||||||
iter.next(false);
|
iter.next(false);
|
||||||
var item = iter.next(['a', 'b', 'c']);
|
var item = iter.next(arr);
|
||||||
|
var value = item.value;
|
||||||
|
|
||||||
assert(compareArray(item.value, arr));
|
assert.notSameValue(value, arr, 'value is a new array');
|
||||||
|
assert(Array.isArray(value), 'value is an Array exotic object');
|
||||||
|
assert.sameValue(value.length, 3)
|
||||||
|
assert.sameValue(value[0], 'a');
|
||||||
|
assert.sameValue(value[1], 'b');
|
||||||
|
assert.sameValue(value[2], 'c');
|
||||||
assert.sameValue(item.done, false);
|
assert.sameValue(item.done, false);
|
||||||
|
@ -29,6 +29,7 @@ obj
|
|||||||
//- body
|
//- body
|
||||||
|
|
||||||
assert.sameValue(obj[symbol], 1);
|
assert.sameValue(obj[symbol], 1);
|
||||||
|
assert(Object.hasOwnProperty.call(obj, symbol));
|
||||||
assert.sameValue(obj.c, 4);
|
assert.sameValue(obj.c, 4);
|
||||||
assert.sameValue(obj.d, 5);
|
assert.sameValue(obj.d, 5);
|
||||||
assert.sameValue(Object.keys(obj).length, 2);
|
assert.sameValue(Object.keys(obj).length, 2);
|
||||||
|
@ -41,6 +41,7 @@ var callCount = 0;
|
|||||||
|
|
||||||
(function(obj) {
|
(function(obj) {
|
||||||
assert.sameValue(obj[symbol], 1);
|
assert.sameValue(obj[symbol], 1);
|
||||||
|
assert(Object.hasOwnProperty.call(obj, symbol));
|
||||||
assert.sameValue(obj.c, 4);
|
assert.sameValue(obj.c, 4);
|
||||||
assert.sameValue(obj.d, 5);
|
assert.sameValue(obj.d, 5);
|
||||||
assert.sameValue(Object.keys(obj).length, 2);
|
assert.sameValue(Object.keys(obj).length, 2);
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-identifier-non-strict.case
|
||||||
|
// - src/async-generators/non-strict/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Async generator named expression - valid for non-strict only cases)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [async-iteration]
|
||||||
|
flags: [generated, noStrict, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
return (function(arg) {
|
||||||
|
var yield = arg + 1;
|
||||||
|
return yield;
|
||||||
|
}(yield))
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
var item = iter.next();
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
assert.sameValue(value, undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
item = iter.next(42);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true);
|
||||||
|
assert.sameValue(value, 43);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,63 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-identifier-spread-non-strict.case
|
||||||
|
// - src/async-generators/non-strict/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Async generator named expression - valid for non-strict only cases)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [object-spread, async-iteration]
|
||||||
|
flags: [generated, noStrict, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Spread Properties
|
||||||
|
|
||||||
|
PropertyDefinition[Yield]:
|
||||||
|
(...)
|
||||||
|
...AssignmentExpression[In, ?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var s = Symbol('s');
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield {
|
||||||
|
...yield yield,
|
||||||
|
...(function(arg) {
|
||||||
|
var yield = arg;
|
||||||
|
return {...yield};
|
||||||
|
}(yield)),
|
||||||
|
...yield,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next();
|
||||||
|
iter.next();
|
||||||
|
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
|
||||||
|
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
|
||||||
|
var item = iter.next({ z: 30, b: 2 });
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
assert.sameValue(value.x, 10);
|
||||||
|
assert.sameValue(value.y, 20);
|
||||||
|
assert.sameValue(value.z, 30);
|
||||||
|
assert.sameValue(value.a, 1);
|
||||||
|
assert.sameValue(value.b, 2);
|
||||||
|
assert.sameValue(value[s], 42);
|
||||||
|
assert.sameValue(Object.keys(value).length, 5);
|
||||||
|
assert(Object.hasOwnProperty.call(value, s));
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,45 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-identifier-spread-strict.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [object-spread, async-iteration]
|
||||||
|
flags: [generated, onlyStrict]
|
||||||
|
negative:
|
||||||
|
phase: early
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Spread Properties
|
||||||
|
|
||||||
|
PropertyDefinition[Yield]:
|
||||||
|
(...)
|
||||||
|
...AssignmentExpression[In, ?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
return {
|
||||||
|
...(function() {
|
||||||
|
var yield;
|
||||||
|
throw new Test262Error();
|
||||||
|
}()),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,36 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-identifier-strict.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [async-iteration]
|
||||||
|
flags: [generated, onlyStrict]
|
||||||
|
negative:
|
||||||
|
phase: early
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
(function() {
|
||||||
|
var yield;
|
||||||
|
throw new Test262Error();
|
||||||
|
}())
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,49 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-spread-arr-multiple.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Use yield value in a array spread position (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
includes: [compareArray.js]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Array Initializer
|
||||||
|
|
||||||
|
SpreadElement[Yield, Await]:
|
||||||
|
...AssignmentExpression[+In, ?Yield, ?Await]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var arr = ['a', 'b', 'c'];
|
||||||
|
var item;
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield [...yield yield];
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next(false);
|
||||||
|
item = iter.next(['a', 'b', 'c']);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
item = iter.next(value);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert(compareArray(value, arr));
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,48 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-spread-arr-single.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Use yield value in a array spread position (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Array Initializer
|
||||||
|
|
||||||
|
SpreadElement[Yield, Await]:
|
||||||
|
...AssignmentExpression[+In, ?Yield, ?Await]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var arr = ['a', 'b', 'c'];
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield [...yield];
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next(false);
|
||||||
|
var item = iter.next(arr);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.notSameValue(value, arr, 'value is a new array');
|
||||||
|
assert(Array.isArray(value), 'value is an Array exotic object');
|
||||||
|
assert.sameValue(value.length, 3)
|
||||||
|
assert.sameValue(value[0], 'a');
|
||||||
|
assert.sameValue(value[1], 'b');
|
||||||
|
assert.sameValue(value[2], 'c');
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,52 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-spread-obj.case
|
||||||
|
// - src/async-generators/default/async-expression-named.template
|
||||||
|
/*---
|
||||||
|
description: Use yield value in a object spread position (Named async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [object-spread, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
includes: [compareArray.js]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Spread Properties
|
||||||
|
|
||||||
|
PropertyDefinition[Yield]:
|
||||||
|
(...)
|
||||||
|
...AssignmentExpression[In, ?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *g() {
|
||||||
|
callCount += 1;
|
||||||
|
yield {
|
||||||
|
...yield,
|
||||||
|
y: 1,
|
||||||
|
...yield yield,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next();
|
||||||
|
iter.next({ x: 42 });
|
||||||
|
iter.next({ x: 'lol' });
|
||||||
|
var item = iter.next({ y: 39 });
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(value.x, 42);
|
||||||
|
assert.sameValue(value.y, 39);
|
||||||
|
assert.sameValue(Object.keys(value).length, 2);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,45 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-identifier-non-strict.case
|
||||||
|
// - src/async-generators/non-strict/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Use of yield as a valid identifier in a function body inside a generator body in non strict mode (Async generator expression - valid for non-strict only cases)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [async-iteration]
|
||||||
|
flags: [generated, noStrict, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
return (function(arg) {
|
||||||
|
var yield = arg + 1;
|
||||||
|
return yield;
|
||||||
|
}(yield))
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
var item = iter.next();
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
assert.sameValue(value, undefined);
|
||||||
|
});
|
||||||
|
|
||||||
|
item = iter.next(42);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, true);
|
||||||
|
assert.sameValue(value, 43);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,63 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-identifier-spread-non-strict.case
|
||||||
|
// - src/async-generators/non-strict/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Mixed use of object spread and yield as a valid identifier in a function body inside a generator body in non strict mode (Async generator expression - valid for non-strict only cases)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [object-spread, async-iteration]
|
||||||
|
flags: [generated, noStrict, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Spread Properties
|
||||||
|
|
||||||
|
PropertyDefinition[Yield]:
|
||||||
|
(...)
|
||||||
|
...AssignmentExpression[In, ?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var s = Symbol('s');
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield {
|
||||||
|
...yield yield,
|
||||||
|
...(function(arg) {
|
||||||
|
var yield = arg;
|
||||||
|
return {...yield};
|
||||||
|
}(yield)),
|
||||||
|
...yield,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next();
|
||||||
|
iter.next();
|
||||||
|
iter.next({ x: 10, a: 0, b: 0, [s]: 1 });
|
||||||
|
iter.next({ y: 20, a: 1, b: 1, [s]: 42 });
|
||||||
|
var item = iter.next({ z: 30, b: 2 });
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
assert.sameValue(value.x, 10);
|
||||||
|
assert.sameValue(value.y, 20);
|
||||||
|
assert.sameValue(value.z, 30);
|
||||||
|
assert.sameValue(value.a, 1);
|
||||||
|
assert.sameValue(value.b, 2);
|
||||||
|
assert.sameValue(value[s], 42);
|
||||||
|
assert.sameValue(Object.keys(value).length, 5);
|
||||||
|
assert(Object.hasOwnProperty.call(value, s));
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,45 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-identifier-spread-strict.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [object-spread, async-iteration]
|
||||||
|
flags: [generated, onlyStrict]
|
||||||
|
negative:
|
||||||
|
phase: early
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Spread Properties
|
||||||
|
|
||||||
|
PropertyDefinition[Yield]:
|
||||||
|
(...)
|
||||||
|
...AssignmentExpression[In, ?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
return {
|
||||||
|
...(function() {
|
||||||
|
var yield;
|
||||||
|
throw new Test262Error();
|
||||||
|
}()),
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,36 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-identifier-strict.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [async-iteration]
|
||||||
|
flags: [generated, onlyStrict]
|
||||||
|
negative:
|
||||||
|
phase: early
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
(function() {
|
||||||
|
var yield;
|
||||||
|
throw new Test262Error();
|
||||||
|
}())
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,49 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-spread-arr-multiple.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Use yield value in a array spread position (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
includes: [compareArray.js]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Array Initializer
|
||||||
|
|
||||||
|
SpreadElement[Yield, Await]:
|
||||||
|
...AssignmentExpression[+In, ?Yield, ?Await]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var arr = ['a', 'b', 'c'];
|
||||||
|
var item;
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield [...yield yield];
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next(false);
|
||||||
|
item = iter.next(['a', 'b', 'c']);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
item = iter.next(value);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert(compareArray(value, arr));
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,48 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-spread-arr-single.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Use yield value in a array spread position (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Array Initializer
|
||||||
|
|
||||||
|
SpreadElement[Yield, Await]:
|
||||||
|
...AssignmentExpression[+In, ?Yield, ?Await]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var arr = ['a', 'b', 'c'];
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield [...yield];
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next(false);
|
||||||
|
var item = iter.next(arr);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.notSameValue(value, arr, 'value is a new array');
|
||||||
|
assert(Array.isArray(value), 'value is an Array exotic object');
|
||||||
|
assert.sameValue(value.length, 3)
|
||||||
|
assert.sameValue(value[0], 'a');
|
||||||
|
assert.sameValue(value[1], 'b');
|
||||||
|
assert.sameValue(value[2], 'c');
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,52 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-spread-obj.case
|
||||||
|
// - src/async-generators/default/async-expression.template
|
||||||
|
/*---
|
||||||
|
description: Use yield value in a object spread position (Unnamed async generator expression)
|
||||||
|
esid: prod-AsyncGeneratorExpression
|
||||||
|
features: [object-spread, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
includes: [compareArray.js]
|
||||||
|
info: |
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorExpression :
|
||||||
|
async [no LineTerminator here] function * BindingIdentifier ( FormalParameters ) {
|
||||||
|
AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Spread Properties
|
||||||
|
|
||||||
|
PropertyDefinition[Yield]:
|
||||||
|
(...)
|
||||||
|
...AssignmentExpression[In, ?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var gen = async function *() {
|
||||||
|
callCount += 1;
|
||||||
|
yield {
|
||||||
|
...yield,
|
||||||
|
y: 1,
|
||||||
|
...yield yield,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next();
|
||||||
|
iter.next({ x: 42 });
|
||||||
|
iter.next({ x: 'lol' });
|
||||||
|
var item = iter.next({ y: 39 });
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(value.x, 42);
|
||||||
|
assert.sameValue(value.y, 39);
|
||||||
|
assert.sameValue(Object.keys(value).length, 2);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -39,6 +39,7 @@ var callCount = 0;
|
|||||||
|
|
||||||
(function(obj) {
|
(function(obj) {
|
||||||
assert.sameValue(obj[symbol], 1);
|
assert.sameValue(obj[symbol], 1);
|
||||||
|
assert(Object.hasOwnProperty.call(obj, symbol));
|
||||||
assert.sameValue(obj.c, 4);
|
assert.sameValue(obj.c, 4);
|
||||||
assert.sameValue(obj.d, 5);
|
assert.sameValue(obj.d, 5);
|
||||||
assert.sameValue(Object.keys(obj).length, 2);
|
assert.sameValue(Object.keys(obj).length, 2);
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-identifier-spread-strict.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [object-spread, async-iteration]
|
||||||
|
flags: [generated, onlyStrict]
|
||||||
|
negative:
|
||||||
|
phase: early
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Spread Properties
|
||||||
|
|
||||||
|
PropertyDefinition[Yield]:
|
||||||
|
(...)
|
||||||
|
...AssignmentExpression[In, ?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
return {
|
||||||
|
...(function() {
|
||||||
|
var yield;
|
||||||
|
throw new Test262Error();
|
||||||
|
}()),
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,43 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-identifier-strict.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [async-iteration]
|
||||||
|
flags: [generated, onlyStrict]
|
||||||
|
negative:
|
||||||
|
phase: early
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
(function() {
|
||||||
|
var yield;
|
||||||
|
throw new Test262Error();
|
||||||
|
}())
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,56 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-spread-arr-multiple.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Use yield value in a array spread position (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
includes: [compareArray.js]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Array Initializer
|
||||||
|
|
||||||
|
SpreadElement[Yield, Await]:
|
||||||
|
...AssignmentExpression[+In, ?Yield, ?Await]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var arr = ['a', 'b', 'c'];
|
||||||
|
var item;
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield [...yield yield];
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next(false);
|
||||||
|
item = iter.next(['a', 'b', 'c']);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
item = iter.next(value);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert(compareArray(value, arr));
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
}).catch($DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,55 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-spread-arr-single.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Use yield value in a array spread position (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Array Initializer
|
||||||
|
|
||||||
|
SpreadElement[Yield, Await]:
|
||||||
|
...AssignmentExpression[+In, ?Yield, ?Await]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
var arr = ['a', 'b', 'c'];
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield [...yield];
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next(false);
|
||||||
|
var item = iter.next(arr);
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.notSameValue(value, arr, 'value is a new array');
|
||||||
|
assert(Array.isArray(value), 'value is an Array exotic object');
|
||||||
|
assert.sameValue(value.length, 3)
|
||||||
|
assert.sameValue(value[0], 'a');
|
||||||
|
assert.sameValue(value[1], 'b');
|
||||||
|
assert.sameValue(value[2], 'c');
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,59 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-spread-obj.case
|
||||||
|
// - src/async-generators/default/async-class-expr-static-method.template
|
||||||
|
/*---
|
||||||
|
description: Use yield value in a object spread position (Static async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [object-spread, async-iteration]
|
||||||
|
flags: [generated, async]
|
||||||
|
includes: [compareArray.js]
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
static MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Spread Properties
|
||||||
|
|
||||||
|
PropertyDefinition[Yield]:
|
||||||
|
(...)
|
||||||
|
...AssignmentExpression[In, ?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { static async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
yield {
|
||||||
|
...yield,
|
||||||
|
y: 1,
|
||||||
|
...yield yield,
|
||||||
|
};
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
iter.next();
|
||||||
|
iter.next({ x: 42 });
|
||||||
|
iter.next({ x: 'lol' });
|
||||||
|
var item = iter.next({ y: 39 });
|
||||||
|
|
||||||
|
item.then(({ done, value }) => {
|
||||||
|
assert.sameValue(value.x, 42);
|
||||||
|
assert.sameValue(value.y, 39);
|
||||||
|
assert.sameValue(Object.keys(value).length, 2);
|
||||||
|
assert.sameValue(done, false);
|
||||||
|
}).then($DONE, $DONE);
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,52 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-identifier-spread-strict.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: It's an early error if the AssignmentExpression is a function body with yield as an identifier in strict mode. (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [object-spread, async-iteration]
|
||||||
|
flags: [generated, onlyStrict]
|
||||||
|
negative:
|
||||||
|
phase: early
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
|
||||||
|
Spread Properties
|
||||||
|
|
||||||
|
PropertyDefinition[Yield]:
|
||||||
|
(...)
|
||||||
|
...AssignmentExpression[In, ?Yield]
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
return {
|
||||||
|
...(function() {
|
||||||
|
var yield;
|
||||||
|
throw new Test262Error();
|
||||||
|
}()),
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
@ -0,0 +1,43 @@
|
|||||||
|
// This file was procedurally generated from the following sources:
|
||||||
|
// - src/async-generators/yield-identifier-strict.case
|
||||||
|
// - src/async-generators/default/async-class-expr-method.template
|
||||||
|
/*---
|
||||||
|
description: It's an early error if the generator body has another function body with yield as an identifier in strict mode. (Async generator method as a ClassExpression element)
|
||||||
|
esid: prod-AsyncGeneratorMethod
|
||||||
|
features: [async-iteration]
|
||||||
|
flags: [generated, onlyStrict]
|
||||||
|
negative:
|
||||||
|
phase: early
|
||||||
|
type: SyntaxError
|
||||||
|
info: |
|
||||||
|
ClassElement :
|
||||||
|
MethodDefinition
|
||||||
|
|
||||||
|
MethodDefinition :
|
||||||
|
AsyncGeneratorMethod
|
||||||
|
|
||||||
|
Async Generator Function Definitions
|
||||||
|
|
||||||
|
AsyncGeneratorMethod :
|
||||||
|
async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) { AsyncGeneratorBody }
|
||||||
|
|
||||||
|
---*/
|
||||||
|
|
||||||
|
|
||||||
|
var callCount = 0;
|
||||||
|
|
||||||
|
var C = class { async *gen() {
|
||||||
|
callCount += 1;
|
||||||
|
(function() {
|
||||||
|
var yield;
|
||||||
|
throw new Test262Error();
|
||||||
|
}())
|
||||||
|
}}
|
||||||
|
|
||||||
|
var gen = C.prototype.gen;
|
||||||
|
|
||||||
|
var iter = gen();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
assert.sameValue(callCount, 1);
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user