Skip to content
Snippets Groups Projects
Unverified Commit 76001a50 authored by Leonardo Balter's avatar Leonardo Balter Committed by Leo Balter
Browse files

Fix current generator templates

parent 42d993c4
No related branches found
No related tags found
No related merge requests found
Showing
with 166 additions and 17 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/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);
// 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 @@ ...@@ -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 }*/
}} }}
......
// 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 @@ ...@@ -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;
......
// 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 @@ ...@@ -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;
......
// 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: |
......
// 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: | ...@@ -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;
......
// 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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment