From 6a428b4a40feca6733b47e13b6b719cfe14ecf51 Mon Sep 17 00:00:00 2001 From: Rick Waldron Date: Fri, 18 Sep 2020 16:13:40 -0400 Subject: [PATCH] Coverage: forbidden extensions, bullet 1 & 2. Fixes gh-1749 --- ...dden-ext-direct-access-prop-arguments.case | 19 ++++++++++ ...rbidden-ext-direct-access-prop-caller.case | 19 ++++++++++ ...idden-ext-indirect-access-prop-caller.case | 22 ++++++++++++ .../bullet-one/arrow-function.template | 21 +++++++++++ .../bullet-one/async-arrow-function.template | 34 ++++++++++++++++++ .../bullet-one/async-func-decl.template | 28 +++++++++++++++ .../bullet-one/async-func-expr-named.template | 28 +++++++++++++++ .../async-func-expr-nameless.template | 28 +++++++++++++++ .../bullet-one/async-gen-func-decl.template | 29 +++++++++++++++ .../bullet-one/async-gen-func-expr.template | 30 ++++++++++++++++ .../bullet-one/async-gen-meth.template | 31 ++++++++++++++++ .../async-gen-named-func-expr.template | 30 ++++++++++++++++ .../bullet-one/async-meth.template | 31 ++++++++++++++++ .../cls-decl-async-gen-meth-static.template | 29 +++++++++++++++ .../cls-decl-async-gen-meth.template | 28 +++++++++++++++ .../cls-decl-async-meth-static.template | 29 +++++++++++++++ .../bullet-one/cls-decl-async-meth.template | 29 +++++++++++++++ .../cls-decl-gen-meth-static.template | 24 +++++++++++++ .../bullet-one/cls-decl-gen-meth.template | 23 ++++++++++++ .../bullet-one/cls-decl-meth-static.template | 22 ++++++++++++ .../bullet-one/cls-decl-meth.template | 22 ++++++++++++ .../cls-expr-async-gen-meth-static.template | 28 +++++++++++++++ .../cls-expr-async-gen-meth.template | 28 +++++++++++++++ .../cls-expr-async-meth-static.template | 30 ++++++++++++++++ .../bullet-one/cls-expr-async-meth.template | 29 +++++++++++++++ .../cls-expr-gen-meth-static.template | 23 ++++++++++++ .../bullet-one/cls-expr-gen-meth.template | 23 ++++++++++++ .../bullet-one/cls-expr-meth-static.template | 22 ++++++++++++ .../bullet-one/cls-expr-meth.template | 22 ++++++++++++ .../bullet-one/func-decl-strict.template | 21 +++++++++++ .../bullet-one/func-decl.template | 18 ++++++++++ .../bullet-one/func-expr-strict.template | 21 +++++++++++ .../bullet-one/func-expr.template | 19 ++++++++++ .../bullet-one/gen-func-decl.template | 22 ++++++++++++ .../bullet-one/gen-func-expr.template | 22 ++++++++++++ .../bullet-one/gen-meth.template | 25 +++++++++++++ .../bullet-one/meth.template | 22 ++++++++++++ .../bullet-two/arrow-function.template | 22 ++++++++++++ .../bullet-two/async-arrow-function.template | 35 +++++++++++++++++++ .../bullet-two/async-func-decl.template | 29 +++++++++++++++ .../bullet-two/async-func-expr-named.template | 29 +++++++++++++++ .../async-func-expr-nameless.template | 29 +++++++++++++++ .../bullet-two/async-gen-func-decl.template | 30 ++++++++++++++++ .../bullet-two/async-gen-func-expr.template | 31 ++++++++++++++++ .../bullet-two/async-gen-meth.template | 32 +++++++++++++++++ .../async-gen-named-func-expr.template | 31 ++++++++++++++++ .../bullet-two/async-meth.template | 32 +++++++++++++++++ .../cls-decl-async-gen-meth-static.template | 30 ++++++++++++++++ .../cls-decl-async-gen-meth.template | 29 +++++++++++++++ .../cls-decl-async-meth-static.template | 30 ++++++++++++++++ .../bullet-two/cls-decl-async-meth.template | 30 ++++++++++++++++ .../cls-decl-gen-meth-static.template | 25 +++++++++++++ .../bullet-two/cls-decl-gen-meth.template | 24 +++++++++++++ .../bullet-two/cls-decl-meth-static.template | 23 ++++++++++++ .../bullet-two/cls-decl-meth.template | 23 ++++++++++++ .../cls-expr-async-gen-meth-static.template | 29 +++++++++++++++ .../cls-expr-async-gen-meth.template | 29 +++++++++++++++ .../cls-expr-async-meth-static.template | 31 ++++++++++++++++ .../bullet-two/cls-expr-async-meth.template | 30 ++++++++++++++++ .../cls-expr-gen-meth-static.template | 24 +++++++++++++ .../bullet-two/cls-expr-gen-meth.template | 24 +++++++++++++ .../bullet-two/cls-expr-meth-static.template | 23 ++++++++++++ .../bullet-two/cls-expr-meth.template | 23 ++++++++++++ .../bullet-two/func-decl.template | 21 +++++++++++ .../bullet-two/func-expr.template | 21 +++++++++++ .../bullet-two/gen-func-decl.template | 23 ++++++++++++ .../bullet-two/gen-func-expr.template | 23 ++++++++++++ .../bullet-two/gen-meth.template | 26 ++++++++++++++ .../bullet-two/meth.template | 23 ++++++++++++ 69 files changed, 1795 insertions(+) create mode 100644 src/function-forms/forbidden-ext-direct-access-prop-arguments.case create mode 100644 src/function-forms/forbidden-ext-direct-access-prop-caller.case create mode 100644 src/function-forms/forbidden-ext-indirect-access-prop-caller.case create mode 100644 src/function-forms/forbidden-extensions/bullet-one/arrow-function.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/async-arrow-function.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/async-func-decl.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/async-func-expr-named.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/async-func-expr-nameless.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/async-gen-func-decl.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/async-gen-func-expr.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/async-gen-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/async-gen-named-func-expr.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/async-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/func-decl-strict.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/func-decl.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/func-expr-strict.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/func-expr.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/gen-func-decl.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/gen-func-expr.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/gen-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-one/meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/arrow-function.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/async-func-decl.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/async-gen-func-decl.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/async-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/func-decl.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/func-expr.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/gen-func-decl.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/gen-meth.template create mode 100644 src/function-forms/forbidden-extensions/bullet-two/meth.template diff --git a/src/function-forms/forbidden-ext-direct-access-prop-arguments.case b/src/function-forms/forbidden-ext-direct-access-prop-arguments.case new file mode 100644 index 0000000000..ff771ce48d --- /dev/null +++ b/src/function-forms/forbidden-ext-direct-access-prop-arguments.case @@ -0,0 +1,19 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +template: forbidden-extensions/bullet-one +esid: sec-forbidden-extensions +desc: > + Forbidden extension, o.arguments +info: | + ECMAScript function objects defined using syntactic constructors in strict mode code must not be created with own properties named "caller" or "arguments". Such own properties also must not be created for function objects defined using an ArrowFunction, MethodDefinition, GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or AsyncArrowFunction regardless of whether the definition is contained in strict mode code. Built-in functions, strict functions created using the Function constructor, generator functions created using the Generator constructor, async functions created using the AsyncFunction constructor, and functions created using the bind method also must not be created with such own properties. + +flags: [noStrict] +---*/ + +//- function-body +f.arguments; +//- method-body +this.method.arguments; +//- error +TypeError diff --git a/src/function-forms/forbidden-ext-direct-access-prop-caller.case b/src/function-forms/forbidden-ext-direct-access-prop-caller.case new file mode 100644 index 0000000000..dfbc139a16 --- /dev/null +++ b/src/function-forms/forbidden-ext-direct-access-prop-caller.case @@ -0,0 +1,19 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +template: forbidden-extensions/bullet-one +esid: sec-forbidden-extensions +desc: > + Forbidden extension, o.caller +info: | + ECMAScript function objects defined using syntactic constructors in strict mode code must not be created with own properties named "caller" or "arguments". Such own properties also must not be created for function objects defined using an ArrowFunction, MethodDefinition, GeneratorDeclaration, GeneratorExpression, AsyncGeneratorDeclaration, AsyncGeneratorExpression, ClassDeclaration, ClassExpression, AsyncFunctionDeclaration, AsyncFunctionExpression, or AsyncArrowFunction regardless of whether the definition is contained in strict mode code. Built-in functions, strict functions created using the Function constructor, generator functions created using the Generator constructor, async functions created using the AsyncFunction constructor, and functions created using the bind method also must not be created with such own properties. + +flags: [noStrict] +---*/ + +//- function-body +f.caller; +//- method-body +this.method.caller; +//- error +TypeError diff --git a/src/function-forms/forbidden-ext-indirect-access-prop-caller.case b/src/function-forms/forbidden-ext-indirect-access-prop-caller.case new file mode 100644 index 0000000000..972a89df7c --- /dev/null +++ b/src/function-forms/forbidden-ext-indirect-access-prop-caller.case @@ -0,0 +1,22 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +template: forbidden-extensions/bullet-two +esid: sec-forbidden-extensions +desc: > + Forbidden extension, o.caller +info: | + If an implementation extends any function object with an own property named "caller" the value of that property, as observed using [[Get]] or [[GetOwnProperty]], must not be a strict function object. If it is an accessor property, the function that is the value of the property's [[Get]] attribute must never return a strict function when called. + +flags: [noStrict] +---*/ + +//- setup +function inner() { + // This property is forbidden from having a value that is strict function object + return inner.caller; +} +//- body +inner().toString(); +//- error +TypeError diff --git a/src/function-forms/forbidden-extensions/bullet-one/arrow-function.template b/src/function-forms/forbidden-extensions/bullet-one/arrow-function.template new file mode 100644 index 0000000000..0f481f5d7f --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/arrow-function.template @@ -0,0 +1,21 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/arrow-function/ +name: arrow function expression +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +info: | + ArrowFunction : ArrowParameters => ConciseBody +---*/ + +var callCount = 0; +var f; +f = (/*{ params }*/) => { + /*{ function-body }*/ + callCount = callCount + 1; +}; + +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'arrow function body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-arrow-function.template b/src/function-forms/forbidden-extensions/bullet-one/async-arrow-function.template new file mode 100644 index 0000000000..56ad9fa2fd --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/async-arrow-function.template @@ -0,0 +1,34 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/async-arrow-function/ +name: async arrow function expression +esid: sec-async-arrow-function-definitions +info: | + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + +flags: [async] +features: [async-functions] +---*/ + +var callCount = 0; +var f; +f = async (/*{ params }*/) => { + /*{ function-body }*/ + callCount = callCount + 1; +}; + +f(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-func-decl.template b/src/function-forms/forbidden-extensions/bullet-one/async-func-decl.template new file mode 100644 index 0000000000..5cb65bb561 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/async-func-decl.template @@ -0,0 +1,28 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/async-function/ +name: async function declaration +esid: sec-async-function-definitions +info: | + AsyncFunctionDeclaration : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } +flags: [async] +features: [async-functions] +---*/ + +var callCount = 0; +async function f(/*{ params }*/) { + /*{ function-body }*/ + callCount = callCount + 1; +} + +f(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-named.template b/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-named.template new file mode 100644 index 0000000000..07d336b2d5 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-named.template @@ -0,0 +1,28 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/async-function/named- +name: async function named expression +esid: sec-async-function-definitions +info: | + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } +flags: [async] +features: [async-functions] +---*/ + +var callCount = 0; +var f = async function f(/*{ params }*/) { + /*{ function-body }*/ + callCount = callCount + 1; +} + +f(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-nameless.template b/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-nameless.template new file mode 100644 index 0000000000..927ade9793 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/async-func-expr-nameless.template @@ -0,0 +1,28 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/async-function/nameless- +name: async function nameless expression +esid: sec-async-function-definitions +info: | + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } +flags: [async] +features: [async-functions] +---*/ + +var callCount = 0; +var f = async function(/*{ params }*/) { + /*{ function-body }*/ + callCount = callCount + 1; +} + +f(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-decl.template b/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-decl.template new file mode 100644 index 0000000000..1b0fbf0e63 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-decl.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/statements/async-generator/ +name: async generator function declaration +esid: sec-asyncgenerator-definitions-instantiatefunctionobject +info: | + AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +async function* f(/*{ params }*/) { + /*{ function-body }*/ + callCount = callCount + 1; +} + +f(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-expr.template b/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-expr.template new file mode 100644 index 0000000000..14448ca291 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/async-gen-func-expr.template @@ -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. + +/*--- +path: language/expressions/async-generator/ +name: async generator function expression +esid: sec-asyncgenerator-definitions-evaluation +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +var f; +f = async function*(/*{ params }*/) { + /*{ function-body }*/ + callCount = callCount + 1; +}; + +f(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-one/async-gen-meth.template new file mode 100644 index 0000000000..5c789fb5b1 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/async-gen-meth.template @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/object/method-definition/async-gen-meth- +name: async generator method +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +var obj = { + async *method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +}; + +obj.method(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-gen-named-func-expr.template b/src/function-forms/forbidden-extensions/bullet-one/async-gen-named-func-expr.template new file mode 100644 index 0000000000..6819cb6351 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/async-gen-named-func-expr.template @@ -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. + +/*--- +path: language/expressions/async-generator/named- +name: async generator named function expression +esid: sec-asyncgenerator-definitions-evaluation +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +var f; +f = async function* g(/*{ params }*/) { + /*{ function-body }*/ + callCount = callCount + 1; +}; + +f(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/async-meth.template b/src/function-forms/forbidden-extensions/bullet-one/async-meth.template new file mode 100644 index 0000000000..44df728aba --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/async-meth.template @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/object/method-definition/async-meth- +name: async method +esid: sec-async-function-definitions +info: | + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } +flags: [async] +features: [async-functions] +---*/ + +var callCount = 0; + +var obj = { + async method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +}; + +obj.method(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth-static.template new file mode 100644 index 0000000000..9d0a59409e --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth-static.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/statements/class/async-gen-method-static/ +name: static class expression generator method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +class C { + static async *method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +} + +C.method(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth.template new file mode 100644 index 0000000000..b315f02424 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-gen-meth.template @@ -0,0 +1,28 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/async-gen-method/ +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +class C { + async *method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +} + +C.prototype.method(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth-static.template new file mode 100644 index 0000000000..18f9f0cff7 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth-static.template @@ -0,0 +1,29 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/async-method-static/ +name: static class declaration async method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +features: [async-functions] +flags: [async] +---*/ + +var callCount = 0; +class C { + static async method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +} + +C.method(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth.template new file mode 100644 index 0000000000..14edb0ed5f --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-async-meth.template @@ -0,0 +1,29 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/async-method/ +name: class declaration async method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +flags: [async] +features: [async-functions] +---*/ + +var callCount = 0; +class C { + async method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +} + +C.prototype.method(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth-static.template new file mode 100644 index 0000000000..c2f5e09c12 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth-static.template @@ -0,0 +1,24 @@ +// Copyright (C) 2020 Rick Waldron. 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 class expression generator method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +features: [generators] +---*/ + +var callCount = 0; +class C { + static *method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +} + +assert.throws(/*{ error }*/, function() { + C.method(/*{ args }*/).next(); +}); + +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth.template new file mode 100644 index 0000000000..565e564847 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-gen-meth.template @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/gen-method/ +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +features: [generators] +---*/ + +var callCount = 0; +class C { + *method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +} + +assert.throws(/*{ error }*/, function() { + C.prototype.method(/*{ args }*/).next(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth-static.template new file mode 100644 index 0000000000..06bded848c --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth-static.template @@ -0,0 +1,22 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/method-static/ +name: static class expression method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +---*/ + +var callCount = 0; +class C { + static method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +} + +assert.throws(/*{ error }*/, function() { + C.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth.template new file mode 100644 index 0000000000..3f95dd6f45 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-decl-meth.template @@ -0,0 +1,22 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/method/ +name: class expression method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +---*/ + +var callCount = 0; +class C { + method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +} + +assert.throws(/*{ error }*/, function() { + C.prototype.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth-static.template new file mode 100644 index 0000000000..cdc93e1d78 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth-static.template @@ -0,0 +1,28 @@ +// Copyright (C) 2020 Rick Waldron. 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 class expression async generator method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + static async *method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +}; + +C.method(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth.template new file mode 100644 index 0000000000..1b5a42bce2 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-gen-meth.template @@ -0,0 +1,28 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/async-gen-method/ +name: class expression async generator method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + async *method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +}; + +C.prototype.method(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth-static.template new file mode 100644 index 0000000000..69a065149a --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth-static.template @@ -0,0 +1,30 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/async-method-static/ +name: static class expression async method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +features: [async-functions] +flags: [async] +---*/ + +var callCount = 0; + +var C = class { + static async method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +}; + +C.method(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth.template new file mode 100644 index 0000000000..cf2620a597 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-async-meth.template @@ -0,0 +1,29 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/async-method/ +name: class expression async method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +features: [async-functions] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + async method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +}; + +C.prototype.method(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth-static.template new file mode 100644 index 0000000000..acd704b910 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth-static.template @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. 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 class expression generator method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +features: [generators] +---*/ + +var callCount = 0; +var C = class { + static *method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + C.method(/*{ args }*/).next(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth.template new file mode 100644 index 0000000000..e5996918ab --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-gen-meth.template @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/gen-method/ +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +features: [generators] +---*/ + +var callCount = 0; +var C = class { + *method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + C.prototype.method(/*{ args }*/).next(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth-static.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth-static.template new file mode 100644 index 0000000000..dcb43c0195 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth-static.template @@ -0,0 +1,22 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/method-static/ +name: static class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +---*/ + +var callCount = 0; +var C = class { + static method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + C.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth.template b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth.template new file mode 100644 index 0000000000..e2f0e507c5 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/cls-expr-meth.template @@ -0,0 +1,22 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/method/ +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +---*/ + +var callCount = 0; +var C = class { + method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + C.prototype.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/func-decl-strict.template b/src/function-forms/forbidden-extensions/bullet-one/func-decl-strict.template new file mode 100644 index 0000000000..ef8940dcff --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/func-decl-strict.template @@ -0,0 +1,21 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/function/ +name: function declaration +esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject +info: | + FunctionDeclaration : + function BindingIdentifier ( FormalParameters ) { FunctionBody } +---*/ + +var callCount = 0; +function f(/*{ params }*/) { + "use strict"; + /*{ function-body }*/ + callCount = callCount + 1; +} +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'function body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/func-decl.template b/src/function-forms/forbidden-extensions/bullet-one/func-decl.template new file mode 100644 index 0000000000..12976b73e8 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/func-decl.template @@ -0,0 +1,18 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/function/ +name: function declaration +esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject +info: | + FunctionDeclaration : + function BindingIdentifier ( FormalParameters ) { FunctionBody } +---*/ + +var callCount = 0; +function f(/*{ params }*/) { + /*{ function-body }*/ + callCount = callCount + 1; +} +f(/*{ args }*/); +assert.sameValue(callCount, 0, 'function was evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/func-expr-strict.template b/src/function-forms/forbidden-extensions/bullet-one/func-expr-strict.template new file mode 100644 index 0000000000..9d11f8ab7a --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/func-expr-strict.template @@ -0,0 +1,21 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/function/ +name: function expression +esid: sec-function-definitions-runtime-semantics-evaluation +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } +---*/ + +var callCount = 0; +var f; +f = function(/*{ params }*/) { + "use strict"; + /*{ function-body }*/ + callCount = callCount + 1; +}; +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'function body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/func-expr.template b/src/function-forms/forbidden-extensions/bullet-one/func-expr.template new file mode 100644 index 0000000000..697794a767 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/func-expr.template @@ -0,0 +1,19 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/function/ +name: function expression +esid: sec-function-definitions-runtime-semantics-evaluation +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } +---*/ + +var callCount = 0; +var f; +f = function(/*{ params }*/) { + /*{ function-body }*/ + callCount = callCount + 1; +}; +f(/*{ args }*/); + +assert.sameValue(callCount, 1, 'function was evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/gen-func-decl.template b/src/function-forms/forbidden-extensions/bullet-one/gen-func-decl.template new file mode 100644 index 0000000000..7cee8069b9 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/gen-func-decl.template @@ -0,0 +1,22 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/generators/ +name: generator function declaration +esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject +info: | + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } +features: [generators] +---*/ + +var callCount = 0; +function* f(/*{ params }*/) { + /*{ function-body }*/ + callCount = callCount + 1; +} + +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/).next(); +}); + +assert.sameValue(callCount, 0, 'generator function body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/gen-func-expr.template b/src/function-forms/forbidden-extensions/bullet-one/gen-func-expr.template new file mode 100644 index 0000000000..c83f75a8e5 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/gen-func-expr.template @@ -0,0 +1,22 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/generators/ +name: generator function expression +esid: sec-generator-function-definitions-runtime-semantics-evaluation +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } +features: [generators] +---*/ + +var callCount = 0; +var f; +f = function*(/*{ params }*/) { + /*{ function-body }*/ + callCount = callCount + 1; +}; + +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/).next(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/gen-meth.template b/src/function-forms/forbidden-extensions/bullet-one/gen-meth.template new file mode 100644 index 0000000000..eaf360ef1b --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/gen-meth.template @@ -0,0 +1,25 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/object/method-definition/gen-meth- +name: generator method +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + +features: [generators] +---*/ + +var callCount = 0; +var obj = { + *method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + obj.method(/*{ args }*/).next(); +}); +assert.sameValue(callCount, 0, 'generator method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-one/meth.template b/src/function-forms/forbidden-extensions/bullet-one/meth.template new file mode 100644 index 0000000000..69a5b4e715 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-one/meth.template @@ -0,0 +1,22 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/object/method-definition/meth- +name: method +esid: sec-runtime-semantics-definemethod +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } +---*/ + +var callCount = 0; +var obj = { + method(/*{ params }*/) { + /*{ method-body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + obj.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/arrow-function.template b/src/function-forms/forbidden-extensions/bullet-two/arrow-function.template new file mode 100644 index 0000000000..51cf2d739b --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/arrow-function.template @@ -0,0 +1,22 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/arrow-function/ +name: arrow function expression +esid: sec-arrow-definitions-runtime-semantics-evaluation +info: | + ArrowFunction : ArrowParameters => ConciseBody +---*/ + +var callCount = 0; +var f; +f = (/*{ params }*/) => { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; +}; + +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'arrow function body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template b/src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template new file mode 100644 index 0000000000..257ac4a44c --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/async-arrow-function.template @@ -0,0 +1,35 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/async-arrow-function/ +name: async arrow function expression +esid: sec-async-arrow-definitions +info: | + AsyncArrowFunction : + ... + CoverCallExpressionAndAsyncArrowHead => AsyncConciseBody + + AsyncConciseBody : + { AsyncFunctionBody } + +flags: [async] +features: [async-functions] +---*/ + +var callCount = 0; +var f; +f = async (/*{ params }*/) => { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; +}; + +f(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-func-decl.template b/src/function-forms/forbidden-extensions/bullet-two/async-func-decl.template new file mode 100644 index 0000000000..c4d3a0e15f --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/async-func-decl.template @@ -0,0 +1,29 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/async-function/ +name: async function declaration +esid: sec-async-definitions +info: | + AsyncFunctionDeclaration : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } +flags: [async] +features: [async-functions] +---*/ + +var callCount = 0; +async function f(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; +} + +f(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template b/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template new file mode 100644 index 0000000000..a65d8cf0c0 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-named.template @@ -0,0 +1,29 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/async-function/named- +name: async function named expression +esid: sec-async-definitions +info: | + AsyncFunctionExpression : + async function BindingIdentifier ( FormalParameters ) { AsyncFunctionBody } +flags: [async] +features: [async-functions] +---*/ + +var callCount = 0; +var f = async function f(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; +} + +f(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template b/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template new file mode 100644 index 0000000000..67685244f3 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/async-func-expr-nameless.template @@ -0,0 +1,29 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/async-function/nameless- +name: async function nameless expression +esid: sec-async-definitions +info: | + AsyncFunctionExpression : + async function ( FormalParameters ) { AsyncFunctionBody } +flags: [async] +features: [async-functions] +---*/ + +var callCount = 0; +var f = async function(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; +} + +f(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-decl.template b/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-decl.template new file mode 100644 index 0000000000..949ee88312 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-decl.template @@ -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. + +/*--- +path: language/statements/async-generator/ +name: async generator function declaration +esid: sec-asyncgenerator-definitions-instantiatefunctionobject +info: | + AsyncGeneratorDeclaration : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +async function* f(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; +} + +f(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template b/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template new file mode 100644 index 0000000000..b314cb44f6 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/async-gen-func-expr.template @@ -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. + +/*--- +path: language/expressions/async-generator/ +name: async generator function expression +esid: sec-asyncgenerator-definitions-evaluation +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * ( FormalParameters ) { + AsyncGeneratorBody } + +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +var f; +f = async function*(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; +}; + +f(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template new file mode 100644 index 0000000000..eb415c7319 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/async-gen-meth.template @@ -0,0 +1,32 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/object/method-definition/async-gen-meth- +name: async generator method +esid: sec-asyncgenerator-definitions-propertydefinitionevaluation +info: | + AsyncGeneratorMethod : + async [no LineTerminator here] * PropertyName ( UniqueFormalParameters ) + { AsyncGeneratorBody } + +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +var obj = { + async *method(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; + } +}; + +obj.method(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template b/src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template new file mode 100644 index 0000000000..1b196da17c --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/async-gen-named-func-expr.template @@ -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. + +/*--- +path: language/expressions/async-generator/named- +name: async generator named function expression +esid: sec-asyncgenerator-definitions-evaluation +info: | + AsyncGeneratorExpression : async [no LineTerminator here] function * BindingIdentifier + ( FormalParameters ) { AsyncGeneratorBody } + +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +var f; +f = async function* g(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; +}; + +f(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/async-meth.template b/src/function-forms/forbidden-extensions/bullet-two/async-meth.template new file mode 100644 index 0000000000..d0d1e0b7f6 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/async-meth.template @@ -0,0 +1,32 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/object/method-definition/async-meth- +name: async method +esid: sec-async-definitions +info: | + AsyncMethod : + async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } +flags: [async] +features: [async-functions] +---*/ + +var callCount = 0; + +var obj = { + async method(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; + } +}; + +obj.method(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth-static.template new file mode 100644 index 0000000000..8fb20f7552 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth-static.template @@ -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. + +/*--- +path: language/statements/class/async-gen-method-static/ +name: static class expression generator method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +class C { + static async *method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +} + +C.method(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template new file mode 100644 index 0000000000..8b560c4fbc --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-gen-meth.template @@ -0,0 +1,29 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/async-gen-method/ +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +class C { + async *method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +} + +C.prototype.method(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth-static.template new file mode 100644 index 0000000000..a79e9507b6 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth-static.template @@ -0,0 +1,30 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/async-method-static/ +name: static class declaration async method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +features: [async-functions] +flags: [async] +---*/ + +var callCount = 0; +class C { + static async method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +} + +C.method(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth.template new file mode 100644 index 0000000000..e30087e526 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-async-meth.template @@ -0,0 +1,30 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/statements/class/async-method/ +name: class declaration async method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +flags: [async] +features: [async-functions] +---*/ + +var callCount = 0; +class C { + async method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +} + +C.prototype.method(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth-static.template new file mode 100644 index 0000000000..f858a0681c --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth-static.template @@ -0,0 +1,25 @@ +// Copyright (C) 2020 Rick Waldron. 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 class expression generator method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +features: [generators] +---*/ + +var callCount = 0; +class C { + static *method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +} + +assert.throws(/*{ error }*/, function() { + C.method(/*{ args }*/).next(); +}); + +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth.template new file mode 100644 index 0000000000..4228e67f44 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-gen-meth.template @@ -0,0 +1,24 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/gen-method/ +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +features: [generators] +---*/ + +var callCount = 0; +class C { + *method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +} + +assert.throws(/*{ error }*/, function() { + C.prototype.method(/*{ args }*/).next(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth-static.template new file mode 100644 index 0000000000..42141e1ad4 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth-static.template @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/method-static/ +name: static class expression method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +---*/ + +var callCount = 0; +class C { + static method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +} + +assert.throws(/*{ error }*/, function() { + C.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth.template new file mode 100644 index 0000000000..042d2fbd28 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-decl-meth.template @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/class/method/ +name: class expression method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +info: | + ClassDeclaration : class BindingIdentifier ClassTail +---*/ + +var callCount = 0; +class C { + method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +} + +assert.throws(/*{ error }*/, function() { + C.prototype.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template new file mode 100644 index 0000000000..08ae9b8f43 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth-static.template @@ -0,0 +1,29 @@ +// Copyright (C) 2020 Rick Waldron. 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 class expression async generator method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + static async *method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template new file mode 100644 index 0000000000..623b8e9c10 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-gen-meth.template @@ -0,0 +1,29 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/async-gen-method/ +name: class expression async generator method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +features: [async-iteration] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + async *method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.prototype.method(/*{ args }*/).next() + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template new file mode 100644 index 0000000000..710cb84f11 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth-static.template @@ -0,0 +1,31 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/async-method-static/ +name: static class expression async method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +features: [async-functions] +flags: [async] +---*/ + +var callCount = 0; + +var C = class { + static async method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template new file mode 100644 index 0000000000..9fac04f687 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-async-meth.template @@ -0,0 +1,30 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. + +/*--- +path: language/expressions/class/async-method/ +name: class expression async method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +features: [async-functions] +flags: [async] +---*/ + +var callCount = 0; +var C = class { + async method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.prototype.method(/*{ args }*/) + .then(_ => { + throw new Test262Error('function should not be resolved'); + }, error => assert.sameValue(error.constructor, /*{ error }*/)) + .then(() => { + assert.sameValue(callCount, 0, 'function body is not evaluated'); + }, $DONE) + .then($DONE, $DONE); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template new file mode 100644 index 0000000000..694d16e877 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth-static.template @@ -0,0 +1,24 @@ +// Copyright (C) 2020 Rick Waldron. 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 class expression generator method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +features: [generators] +---*/ + +var callCount = 0; +var C = class { + static *method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + C.method(/*{ args }*/).next(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template new file mode 100644 index 0000000000..2d539fffb3 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-gen-meth.template @@ -0,0 +1,24 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/gen-method/ +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +features: [generators] +---*/ + +var callCount = 0; +var C = class { + *method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + C.prototype.method(/*{ args }*/).next(); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template new file mode 100644 index 0000000000..cb890e8e61 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth-static.template @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/method-static/ +name: static class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +---*/ + +var callCount = 0; +var C = class { + static method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + C.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template new file mode 100644 index 0000000000..868ed97ebe --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/cls-expr-meth.template @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/class/method/ +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +info: | + ClassExpression : class BindingIdentifieropt ClassTail +---*/ + +var callCount = 0; +var C = class { + method(/*{ params }*/) { + /* implicit strict */ + /*{ body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + C.prototype.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/func-decl.template b/src/function-forms/forbidden-extensions/bullet-two/func-decl.template new file mode 100644 index 0000000000..ad96c8641e --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/func-decl.template @@ -0,0 +1,21 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/function/ +name: function declaration +esid: sec-definitions-runtime-semantics-instantiatefunctionobject +info: | + FunctionDeclaration : + function BindingIdentifier ( FormalParameters ) { FunctionBody } +---*/ + +var callCount = 0; +function f(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; +} +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/func-expr.template b/src/function-forms/forbidden-extensions/bullet-two/func-expr.template new file mode 100644 index 0000000000..fb67c7b397 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/func-expr.template @@ -0,0 +1,21 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/function/ +name: function expression +esid: sec-definitions-runtime-semantics-evaluation +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } +---*/ + +var callCount = 0; +var f; +f = function(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; +}; +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/gen-func-decl.template b/src/function-forms/forbidden-extensions/bullet-two/gen-func-decl.template new file mode 100644 index 0000000000..1bc7918838 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/gen-func-decl.template @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/generators/ +name: generator function declaration +esid: sec-generator-definitions-runtime-semantics-instantiatefunctionobject +info: | + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } +features: [generators] +---*/ + +var callCount = 0; +function* f(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; +} + +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/).next(); +}); + +assert.sameValue(callCount, 0, 'generator function body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template b/src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template new file mode 100644 index 0000000000..873958ec8b --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/gen-func-expr.template @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/generators/ +name: generator function expression +esid: sec-generator-definitions-runtime-semantics-evaluation +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } +features: [generators] +---*/ + +var callCount = 0; +var f; +f = function*(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; +}; + +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/).next(); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/gen-meth.template b/src/function-forms/forbidden-extensions/bullet-two/gen-meth.template new file mode 100644 index 0000000000..83989f232a --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/gen-meth.template @@ -0,0 +1,26 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/object/method-definition/gen-meth- +name: generator method +esid: sec-generator-definitions-runtime-semantics-propertydefinitionevaluation +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + +features: [generators] +---*/ + +var callCount = 0; +var obj = { + *method(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + obj.method(/*{ args }*/).next(); +}); +assert.sameValue(callCount, 0, 'generator method body not evaluated'); diff --git a/src/function-forms/forbidden-extensions/bullet-two/meth.template b/src/function-forms/forbidden-extensions/bullet-two/meth.template new file mode 100644 index 0000000000..9ef34e7002 --- /dev/null +++ b/src/function-forms/forbidden-extensions/bullet-two/meth.template @@ -0,0 +1,23 @@ +// Copyright (C) 2020 Rick Waldron. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/object/method-definition/meth- +name: method +esid: sec-runtime-semantics-definemethod +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } +---*/ + +var callCount = 0; +var obj = { + method(/*{ params }*/) { + "use strict"; + /*{ body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + obj.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated');