From 6d3f8152fc5544e74f3be1f50ba9cbd62f1ec41b Mon Sep 17 00:00:00 2001 From: Leonardo Balter Date: Fri, 17 Mar 2017 18:12:14 -0400 Subject: [PATCH] Add async gen templates for dstr-binding --- .../default/async-gen-func-decl-dflt.template | 27 ++++++++++ .../default/async-gen-func-decl.template | 27 ++++++++++ .../default/async-gen-func-expr-dflt.template | 29 ++++++++++ .../default/async-gen-func-expr.template | 29 ++++++++++ .../async-gen-func-named-expr-dflt.template | 29 ++++++++++ .../async-gen-func-named-expr.template | 29 ++++++++++ .../default/async-gen-meth.template | 35 ++++++++++++ .../default/async-gen-method-dflt.template | 35 ++++++++++++ .../cls-decl-async-gen-meth-dflt.template | 53 ++++++++++++++++++ ...s-decl-async-gen-meth-static-dflt.template | 53 ++++++++++++++++++ .../cls-decl-async-gen-meth-static.template | 53 ++++++++++++++++++ .../default/cls-decl-async-gen-meth.template | 53 ++++++++++++++++++ .../cls-expr-async-gen-meth-dflt.template | 54 +++++++++++++++++++ ...s-expr-async-gen-meth-static-dflt.template | 54 +++++++++++++++++++ .../cls-expr-async-gen-meth-static.template | 54 +++++++++++++++++++ .../default/cls-expr-async-gen-meth.template | 54 +++++++++++++++++++ 16 files changed, 668 insertions(+) create mode 100644 src/dstr-binding/default/async-gen-func-decl-dflt.template create mode 100644 src/dstr-binding/default/async-gen-func-decl.template create mode 100644 src/dstr-binding/default/async-gen-func-expr-dflt.template create mode 100644 src/dstr-binding/default/async-gen-func-expr.template create mode 100644 src/dstr-binding/default/async-gen-func-named-expr-dflt.template create mode 100644 src/dstr-binding/default/async-gen-func-named-expr.template create mode 100644 src/dstr-binding/default/async-gen-meth.template create mode 100644 src/dstr-binding/default/async-gen-method-dflt.template create mode 100644 src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template create mode 100644 src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template create mode 100644 src/dstr-binding/default/cls-decl-async-gen-meth-static.template create mode 100644 src/dstr-binding/default/cls-decl-async-gen-meth.template create mode 100644 src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template create mode 100644 src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template create mode 100644 src/dstr-binding/default/cls-expr-async-gen-meth-static.template create mode 100644 src/dstr-binding/default/cls-expr-async-gen-meth.template diff --git a/src/dstr-binding/default/async-gen-func-decl-dflt.template b/src/dstr-binding/default/async-gen-func-decl-dflt.template new file mode 100644 index 0000000000..1f7045cd81 --- /dev/null +++ b/src/dstr-binding/default/async-gen-func-decl-dflt.template @@ -0,0 +1,27 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/async-generator/dstr-dflt- +name: async generator function declaration (default parameter) +esid: sec-asyncgenerator-definitions-instantiatefunctionobject +features: [async-iteration] +info: | + AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody, + scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +async function* f(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/async-gen-func-decl.template b/src/dstr-binding/default/async-gen-func-decl.template new file mode 100644 index 0000000000..0eeb3eae20 --- /dev/null +++ b/src/dstr-binding/default/async-gen-func-decl.template @@ -0,0 +1,27 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/async-generator/dstr- +name: async generator function declaration +esid: sec-asyncgenerator-definitions-instantiatefunctionobject +features: [async-iteration] +info: | + AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 3. Let F be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, AsyncGeneratorBody, + scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +async function* f(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; +f(/*{ vals }*/).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/async-gen-func-expr-dflt.template b/src/dstr-binding/default/async-gen-func-expr-dflt.template new file mode 100644 index 0000000000..c514a6aa96 --- /dev/null +++ b/src/dstr-binding/default/async-gen-func-expr-dflt.template @@ -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/async-generator/dstr-dflt- +name: async generator function expression (default parameter) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var f; +f = async function*(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/async-gen-func-expr.template b/src/dstr-binding/default/async-gen-func-expr.template new file mode 100644 index 0000000000..09e743cba2 --- /dev/null +++ b/src/dstr-binding/default/async-gen-func-expr.template @@ -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/async-generator/dstr- +name: async generator function expression +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + + [...] + 3. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var f; +f = async function*(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; + +f(/*{ vals }*/).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/async-gen-func-named-expr-dflt.template b/src/dstr-binding/default/async-gen-func-named-expr-dflt.template new file mode 100644 index 0000000000..e7bec27226 --- /dev/null +++ b/src/dstr-binding/default/async-gen-func-named-expr-dflt.template @@ -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/async-generator/dstr-named-dflt- +name: async generator named function expression (default parameter) +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var f; +f = async function* g(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; + +f().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/async-gen-func-named-expr.template b/src/dstr-binding/default/async-gen-func-named-expr.template new file mode 100644 index 0000000000..8f064343b1 --- /dev/null +++ b/src/dstr-binding/default/async-gen-func-named-expr.template @@ -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/async-generator/dstr-named- +name: async generator named function expression +esid: sec-asyncgenerator-definitions-evaluation +features: [async-iteration] +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + + [...] + 7. Let closure be ! AsyncGeneratorFunctionCreate(Normal, FormalParameters, + AsyncGeneratorBody, funcEnv, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var f; +f = async function* g(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; + +f(/*{ vals }*/).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/async-gen-meth.template b/src/dstr-binding/default/async-gen-meth.template new file mode 100644 index 0000000000..71142977d8 --- /dev/null +++ b/src/dstr-binding/default/async-gen-meth.template @@ -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/object/dstr-async-gen-meth- +name: async generator method +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var obj = { + async *method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +obj.method(/*{ vals }*/).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/async-gen-method-dflt.template b/src/dstr-binding/default/async-gen-method-dflt.template new file mode 100644 index 0000000000..c0c98a853e --- /dev/null +++ b/src/dstr-binding/default/async-gen-method-dflt.template @@ -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/object/dstr-async-gen-meth-dflt- +name: async generator method (default parameter) +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +features: [async-iteration] +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var obj = { + async *method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +obj.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template b/src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template new file mode 100644 index 0000000000..ab50758df8 --- /dev/null +++ b/src/dstr-binding/default/cls-decl-async-gen-meth-dflt.template @@ -0,0 +1,53 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/dstr-async-gen-meth-dflt- +name: class expression async generator method (default parameters) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +class C { + async *method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template b/src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template new file mode 100644 index 0000000000..2fc323229d --- /dev/null +++ b/src/dstr-binding/default/cls-decl-async-gen-meth-static-dflt.template @@ -0,0 +1,53 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/dstr-async-gen-meth-static-dflt- +name: static class expression async generator method (default parameter) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [async-iteration] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +class C { + static async *method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-decl-async-gen-meth-static.template b/src/dstr-binding/default/cls-decl-async-gen-meth-static.template new file mode 100644 index 0000000000..8586b9227c --- /dev/null +++ b/src/dstr-binding/default/cls-decl-async-gen-meth-static.template @@ -0,0 +1,53 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/dstr-async-gen-meth-static- +name: static class expression async generator method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +features: [async-iteration] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation for + m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +class C { + static async *method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method(/*{ vals }*/).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-decl-async-gen-meth.template b/src/dstr-binding/default/cls-decl-async-gen-meth.template new file mode 100644 index 0000000000..d326b878c7 --- /dev/null +++ b/src/dstr-binding/default/cls-decl-async-gen-meth.template @@ -0,0 +1,53 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/dstr-async-gen-meth- +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +info: | + ClassDeclaration : class BindingIdentifier ClassTail + + 1. Let className be StringValue of BindingIdentifier. + 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with + argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +class C { + async *method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +new C().method(/*{ vals }*/).then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template b/src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template new file mode 100644 index 0000000000..4e0acac1ed --- /dev/null +++ b/src/dstr-binding/default/cls-expr-async-gen-meth-dflt.template @@ -0,0 +1,54 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/dstr-async-gen-meth-dflt- +name: class expression async generator method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + async *method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +new C().method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template b/src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template new file mode 100644 index 0000000000..3dbcf59e2a --- /dev/null +++ b/src/dstr-binding/default/cls-expr-async-gen-meth-static-dflt.template @@ -0,0 +1,54 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/dstr-async-gen-meth-static-dflt- +name: static class expression async generator method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + static async *method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method().next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-expr-async-gen-meth-static.template b/src/dstr-binding/default/cls-expr-async-gen-meth-static.template new file mode 100644 index 0000000000..003cd8cb35 --- /dev/null +++ b/src/dstr-binding/default/cls-expr-async-gen-meth-static.template @@ -0,0 +1,54 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/dstr-async-gen-meth-static- +name: static class expression async generator method +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + b. Else, + Let status be the result of performing PropertyDefinitionEvaluation + for m with arguments F and false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + static async *method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method(/*{ vals }*/).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE); diff --git a/src/dstr-binding/default/cls-expr-async-gen-meth.template b/src/dstr-binding/default/cls-expr-async-gen-meth.template new file mode 100644 index 0000000000..5ef3e6228e --- /dev/null +++ b/src/dstr-binding/default/cls-expr-async-gen-meth.template @@ -0,0 +1,54 @@ +// Copyright (C) 2017 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/dstr-async-gen-meth- +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +features: [async-iteration] +info: | + ClassExpression : class BindingIdentifieropt ClassTail + + 1. If BindingIdentifieropt is not present, let className be undefined. + 2. Else, let className be StringValue of BindingIdentifier. + 3. Let value be the result of ClassDefinitionEvaluation of ClassTail + with argument className. + [...] + + 14.5.14 Runtime Semantics: ClassDefinitionEvaluation + + 21. For each ClassElement m in order from methods + a. If IsStatic of m is false, then + i. Let status be the result of performing + PropertyDefinitionEvaluation for m with arguments proto and + false. + [...] + + Runtime Semantics: PropertyDefinitionEvaluation + + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this AsyncGeneratorMethod is strict mode code, let strict be true. + Otherwise let strict be false. + 4. Let scope be the running execution context's LexicalEnvironment. + 5. Let closure be ! AsyncGeneratorFunctionCreate(Method, UniqueFormalParameters, + AsyncGeneratorBody, scope, strict). + [...] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + async *method(/*{ elems }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +new C().method(/*{ vals }*/).next().then(() => { + assert.sameValue(callCount, 1, 'invoked exactly once'); +}).then($DONE, $DONE);