diff --git a/src/generators/default/class-decl-method.template b/src/generators/default/class-decl-method.template new file mode 100644 index 0000000000000000000000000000000000000000..ad4959030724a7d7c8fe975beb8ba21650cbf126 --- /dev/null +++ b/src/generators/default/class-decl-method.template @@ -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); diff --git a/src/generators/default/class-decl-static-method.template b/src/generators/default/class-decl-static-method.template new file mode 100644 index 0000000000000000000000000000000000000000..dcd8f4e68c8c60a0db1a2b9a7073edde58b51a0c --- /dev/null +++ b/src/generators/default/class-decl-static-method.template @@ -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); diff --git a/src/generators/default/class-method-definition.template b/src/generators/default/class-expr-method.template similarity index 56% rename from src/generators/default/class-method-definition.template rename to src/generators/default/class-expr-method.template index 4515d51ef532e258330489ef945eec2743a98ed9..8580bb939187bd8390f0c66ae8c86b49b47ee534 100644 --- a/src/generators/default/class-method-definition.template +++ b/src/generators/default/class-expr-method.template @@ -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 }*/ }} diff --git a/src/generators/default/class-expr-static-method.template b/src/generators/default/class-expr-static-method.template new file mode 100644 index 0000000000000000000000000000000000000000..dd6e4ef0f72dc1667c4902759deb49b62748c11a --- /dev/null +++ b/src/generators/default/class-expr-static-method.template @@ -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); diff --git a/src/generators/default/statement.template b/src/generators/default/declaration.template similarity index 68% rename from src/generators/default/statement.template rename to src/generators/default/declaration.template index d70481d62f4c369d558e3fa0a08d04c3562cc363..c9454f69210e800deb95a86e57e2720e50e5709e 100644 --- a/src/generators/default/statement.template +++ b/src/generators/default/declaration.template @@ -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; diff --git a/src/generators/default/expression-named.template b/src/generators/default/expression-named.template new file mode 100644 index 0000000000000000000000000000000000000000..1a2ad892d909733e3f3a679091fb748b8adf8ed6 --- /dev/null +++ b/src/generators/default/expression-named.template @@ -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); diff --git a/src/generators/default/expression.template b/src/generators/default/expression.template index ddead781f517d013651f518821dec6641003e14e..f66994b8b16ec8b04076525c7e019718f98a3e7f 100644 --- a/src/generators/default/expression.template +++ b/src/generators/default/expression.template @@ -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; diff --git a/src/generators/default/method-definition.template b/src/generators/default/obj-method.template similarity index 89% rename from src/generators/default/method-definition.template rename to src/generators/default/obj-method.template index d075f36830b4e1f0bab40ef2db1b081da0aea120..d909462bc74d0ff42d8a29af29e83cc9f83c738b 100644 --- a/src/generators/default/method-definition.template +++ b/src/generators/default/obj-method.template @@ -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: | diff --git a/src/generators/non-strict/statement.template b/src/generators/non-strict/declaration.template similarity index 100% rename from src/generators/non-strict/statement.template rename to src/generators/non-strict/declaration.template diff --git a/src/generators/non-strict/expression-named.template b/src/generators/non-strict/expression-named.template new file mode 100644 index 0000000000000000000000000000000000000000..43448e09632847da7052c6e84eb559c12ea32881 --- /dev/null +++ b/src/generators/non-strict/expression-named.template @@ -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); diff --git a/src/generators/non-strict/expression.template b/src/generators/non-strict/expression.template index 1237f25f660722248b0ad12fde8cf89efa791144..285a84b75be02504454d83d3e89d74f17ff62e99 100644 --- a/src/generators/non-strict/expression.template +++ b/src/generators/non-strict/expression.template @@ -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; diff --git a/src/generators/non-strict/method-definition.template b/src/generators/non-strict/obj-method.template similarity index 75% rename from src/generators/non-strict/method-definition.template rename to src/generators/non-strict/obj-method.template index 84cee1cfd1d7d968f78c0e2cc8c9274134b6acb6..67b6e23377e91f363748b71bd32e2632d95e2900 100644 --- a/src/generators/non-strict/method-definition.template +++ b/src/generators/non-strict/obj-method.template @@ -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;