Fix current generator templates

This commit is contained in:
Leonardo Balter 2017-03-16 12:58:01 -04:00 committed by Leo Balter
parent 42d993c45a
commit 76001a503f
No known key found for this signature in database
GPG Key ID: 2C75F319D398E36B
12 changed files with 166 additions and 17 deletions

View 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);

View 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);

View File

@ -2,24 +2,24 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/class/gen-method-
name: Generator method as a ClassElement
name: Generator method as a ClassExpression element
esid: prod-GeneratorMethod
info: |
ClassElement[Yield, Await]:
MethodDefinition[?Yield, ?Await]
ClassElement :
MethodDefinition
MethodDefinition[Yield, Await]:
GeneratorMethod[?Yield, ?Await]
MethodDefinition :
GeneratorMethod
14.4 Generator Function Definitions
GeneratorMethod[Yield, Await]:
* PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody }
GeneratorMethod :
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
---*/
var callCount = 0;
class C { *gen() {
var C = class {*gen() {
callCount += 1;
/*{ body }*/
}}

View 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);

View File

@ -2,13 +2,13 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/statements/generators/
name: Generator function declaration
name: Generator Function declaration
esid: prod-GeneratorDeclaration
info: |
14.4 Generator Function Definitions
GeneratorDeclaration[Yield, Await, Default]:
function * BindingIdentifier[?Yield, ?Await] ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
GeneratorDeclaration :
function * BindingIdentifier ( FormalParameters ) { GeneratorBody }
---*/
var callCount = 0;

View 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);

View File

@ -2,13 +2,13 @@
// This code is governed by the BSD license found in the LICENSE file.
/*---
path: language/expressions/generators/
name: Generator expression
name: Unnamed generator expression
esid: prod-GeneratorExpression
info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier[+Yield, ~Await]opt ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
---*/
var callCount = 0;

View File

@ -1,7 +1,7 @@
// 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/generator-
path: language/expressions/object/method-definition/gen-
name: Generator method
esid: prod-GeneratorMethod
info: |

View 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);

View File

@ -8,7 +8,7 @@ info: |
14.4 Generator Function Definitions
GeneratorExpression:
function * BindingIdentifier[+Yield, ~Await]opt ( FormalParameters[+Yield, ~Await] ) { GeneratorBody }
function * BindingIdentifier opt ( FormalParameters ) { GeneratorBody }
---*/
var callCount = 0;

View File

@ -1,14 +1,14 @@
// 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/generator-
path: language/expressions/object/method-definition/gen-
name: Generator method - valid for non-strict only cases
esid: prod-GeneratorMethod
info: |
14.4 Generator Function Definitions
GeneratorMethod[Yield, Await]:
* PropertyName[?Yield, ?Await] ( UniqueFormalParameters[+Yield, ~Await] ) { GeneratorBody }
* PropertyName ( UniqueFormalParameters ) { GeneratorBody }
---*/
var callCount = 0;