From 744cb4d2c908a025204d9d5d0d1c038acd51db11 Mon Sep 17 00:00:00 2001 From: Mike Pennisi <mike@mikepennisi.com> Date: Thu, 2 Jun 2016 14:30:33 -0400 Subject: [PATCH] Add templates for destructuring with dflt params --- .../default/arrow-function-dflt.template | 48 ++++++++++++ .../default/cls-decl-gen-meth-dflt.template | 71 ++++++++++++++++++ .../cls-decl-gen-meth-static-dflt.template | 71 ++++++++++++++++++ .../default/cls-decl-meth-dflt.template | 69 ++++++++++++++++++ .../cls-decl-meth-static-dflt.template | 69 ++++++++++++++++++ .../default/cls-expr-gen-meth-dflt.template | 73 +++++++++++++++++++ .../cls-expr-gen-meth-static-dflt.template | 73 +++++++++++++++++++ .../default/cls-expr-meth-dflt.template | 70 ++++++++++++++++++ .../cls-expr-meth-static-dflt.template | 70 ++++++++++++++++++ .../default/func-decl-dflt.template | 48 ++++++++++++ .../default/func-expr-dflt.template | 49 +++++++++++++ .../default/gen-func-decl-dflt.template | 47 ++++++++++++ .../default/gen-func-expr-dflt.template | 49 +++++++++++++ .../default/gen-method-dflt.template | 55 ++++++++++++++ src/dstr-binding/default/meth-dflt.template | 52 +++++++++++++ .../error/arrow-function-dflt.template | 44 +++++++++++ .../error/cls-decl-gen-meth-dflt.template | 69 ++++++++++++++++++ .../cls-decl-gen-meth-static-dflt.template | 68 +++++++++++++++++ .../error/cls-decl-meth-dflt.template | 68 +++++++++++++++++ .../error/cls-decl-meth-static-dflt.template | 66 +++++++++++++++++ .../error/cls-expr-gen-meth-dflt.template | 71 ++++++++++++++++++ .../cls-expr-gen-meth-static-dflt.template | 70 ++++++++++++++++++ .../error/cls-expr-meth-dflt.template | 69 ++++++++++++++++++ .../error/cls-expr-meth-static-dflt.template | 67 +++++++++++++++++ .../error/func-decl-dflt.template | 46 ++++++++++++ .../error/func-expr-dflt.template | 45 ++++++++++++ .../error/gen-func-decl-dflt.template | 45 ++++++++++++ .../error/gen-func-expr-dflt.template | 45 ++++++++++++ src/dstr-binding/error/gen-meth-dflt.template | 52 +++++++++++++ src/dstr-binding/error/meth-dflt.template | 49 +++++++++++++ 30 files changed, 1788 insertions(+) create mode 100644 src/dstr-binding/default/arrow-function-dflt.template create mode 100644 src/dstr-binding/default/cls-decl-gen-meth-dflt.template create mode 100644 src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template create mode 100644 src/dstr-binding/default/cls-decl-meth-dflt.template create mode 100644 src/dstr-binding/default/cls-decl-meth-static-dflt.template create mode 100644 src/dstr-binding/default/cls-expr-gen-meth-dflt.template create mode 100644 src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template create mode 100644 src/dstr-binding/default/cls-expr-meth-dflt.template create mode 100644 src/dstr-binding/default/cls-expr-meth-static-dflt.template create mode 100644 src/dstr-binding/default/func-decl-dflt.template create mode 100644 src/dstr-binding/default/func-expr-dflt.template create mode 100644 src/dstr-binding/default/gen-func-decl-dflt.template create mode 100644 src/dstr-binding/default/gen-func-expr-dflt.template create mode 100644 src/dstr-binding/default/gen-method-dflt.template create mode 100644 src/dstr-binding/default/meth-dflt.template create mode 100644 src/dstr-binding/error/arrow-function-dflt.template create mode 100644 src/dstr-binding/error/cls-decl-gen-meth-dflt.template create mode 100644 src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template create mode 100644 src/dstr-binding/error/cls-decl-meth-dflt.template create mode 100644 src/dstr-binding/error/cls-decl-meth-static-dflt.template create mode 100644 src/dstr-binding/error/cls-expr-gen-meth-dflt.template create mode 100644 src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template create mode 100644 src/dstr-binding/error/cls-expr-meth-dflt.template create mode 100644 src/dstr-binding/error/cls-expr-meth-static-dflt.template create mode 100644 src/dstr-binding/error/func-decl-dflt.template create mode 100644 src/dstr-binding/error/func-expr-dflt.template create mode 100644 src/dstr-binding/error/gen-func-decl-dflt.template create mode 100644 src/dstr-binding/error/gen-func-expr-dflt.template create mode 100644 src/dstr-binding/error/gen-meth-dflt.template create mode 100644 src/dstr-binding/error/meth-dflt.template diff --git a/src/dstr-binding/default/arrow-function-dflt.template b/src/dstr-binding/default/arrow-function-dflt.template new file mode 100644 index 0000000000..b6e0eabd9b --- /dev/null +++ b/src/dstr-binding/default/arrow-function-dflt.template @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/arrow-function/dstr-dflt- +name: arrow function expression (default parameter) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +es6id: 14.2.16 +features: [destructuring-binding, default-parameters] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = (/*{ elems }*/ = /*{ vals }*/) => { + /*{ body }*/ + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/src/dstr-binding/default/cls-decl-gen-meth-dflt.template b/src/dstr-binding/default/cls-decl-gen-meth-dflt.template new file mode 100644 index 0000000000..3523cd63b9 --- /dev/null +++ b/src/dstr-binding/default/cls-decl-gen-meth-dflt.template @@ -0,0 +1,71 @@ +// Copyright (C) 2016 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-gen-meth-dflt- +name: class expression method (default parameters) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod 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 GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +class C { + *method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template b/src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template new file mode 100644 index 0000000000..bb257929b9 --- /dev/null +++ b/src/dstr-binding/default/cls-decl-gen-meth-static-dflt.template @@ -0,0 +1,71 @@ +// Copyright (C) 2016 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-gen-meth-static-dflt- +name: static class expression generator method (default parameter) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod 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 GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +class C { + static *method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-decl-meth-dflt.template b/src/dstr-binding/default/cls-decl-meth-dflt.template new file mode 100644 index 0000000000..9a073c5b74 --- /dev/null +++ b/src/dstr-binding/default/cls-decl-meth-dflt.template @@ -0,0 +1,69 @@ +// Copyright (C) 2016 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-meth-dflt- +name: class expression method (default parameter) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +class C { + method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-decl-meth-static-dflt.template b/src/dstr-binding/default/cls-decl-meth-static-dflt.template new file mode 100644 index 0000000000..07f25960ab --- /dev/null +++ b/src/dstr-binding/default/cls-decl-meth-static-dflt.template @@ -0,0 +1,69 @@ +// Copyright (C) 2016 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-meth-static-dflt- +name: static class expression method (default parameter) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +class C { + static method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-expr-gen-meth-dflt.template b/src/dstr-binding/default/cls-expr-gen-meth-dflt.template new file mode 100644 index 0000000000..b8963fdc05 --- /dev/null +++ b/src/dstr-binding/default/cls-expr-gen-meth-dflt.template @@ -0,0 +1,73 @@ +// Copyright (C) 2016 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-gen-meth-dflt- +name: class expression method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod 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 GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + *method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +new C().method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template b/src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template new file mode 100644 index 0000000000..fd512fc015 --- /dev/null +++ b/src/dstr-binding/default/cls-expr-gen-meth-static-dflt.template @@ -0,0 +1,73 @@ +// Copyright (C) 2016 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-gen-meth-static-dflt- +name: static class expression generator method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod 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 GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static *method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method().next(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-expr-meth-dflt.template b/src/dstr-binding/default/cls-expr-meth-dflt.template new file mode 100644 index 0000000000..c2a5f0e4ad --- /dev/null +++ b/src/dstr-binding/default/cls-expr-meth-dflt.template @@ -0,0 +1,70 @@ +// Copyright (C) 2016 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-meth-dflt- +name: class expression method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +new C().method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/cls-expr-meth-static-dflt.template b/src/dstr-binding/default/cls-expr-meth-static-dflt.template new file mode 100644 index 0000000000..831d74e41a --- /dev/null +++ b/src/dstr-binding/default/cls-expr-meth-static-dflt.template @@ -0,0 +1,70 @@ +// Copyright (C) 2016 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-meth-static-dflt- +name: static class expression method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var C = class { + static method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/default/func-decl-dflt.template b/src/dstr-binding/default/func-decl-dflt.template new file mode 100644 index 0000000000..9b58d5a198 --- /dev/null +++ b/src/dstr-binding/default/func-decl-dflt.template @@ -0,0 +1,48 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/function/dstr-dflt- +name: function declaration (default parameter) +esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.1.19 +features: [destructuring-binding, default-parameters] +info: | + FunctionDeclaration : + function BindingIdentifier ( FormalParameters ) { FunctionBody } + + [...] + 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +function f(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/src/dstr-binding/default/func-expr-dflt.template b/src/dstr-binding/default/func-expr-dflt.template new file mode 100644 index 0000000000..bee2b4aa22 --- /dev/null +++ b/src/dstr-binding/default/func-expr-dflt.template @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/function/dstr-dflt- +name: function expression (default parameter) +esid: sec-function-definitions-runtime-semantics-evaluation +es6id: 14.1.20 +features: [destructuring-binding, default-parameters] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = function(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; + +f(); +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/src/dstr-binding/default/gen-func-decl-dflt.template b/src/dstr-binding/default/gen-func-decl-dflt.template new file mode 100644 index 0000000000..a5eb965ab0 --- /dev/null +++ b/src/dstr-binding/default/gen-func-decl-dflt.template @@ -0,0 +1,47 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/generators/dstr-dflt- +name: generator function declaration (default parameter) +esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.4.12 +features: [destructuring-binding, default-parameters] +info: | + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + + [...] + 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +function* f(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/src/dstr-binding/default/gen-func-expr-dflt.template b/src/dstr-binding/default/gen-func-expr-dflt.template new file mode 100644 index 0000000000..f3f16ae6d8 --- /dev/null +++ b/src/dstr-binding/default/gen-func-expr-dflt.template @@ -0,0 +1,49 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/generators/dstr-dflt- +name: generator function expression (default parameter) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +features: [destructuring-binding, default-parameters] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var f; +f = function*(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; + +f().next(); +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/src/dstr-binding/default/gen-method-dflt.template b/src/dstr-binding/default/gen-method-dflt.template new file mode 100644 index 0000000000..0a75534c61 --- /dev/null +++ b/src/dstr-binding/default/gen-method-dflt.template @@ -0,0 +1,55 @@ +// Copyright (C) 2016 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-gen-meth-dflt- +name: generator method (default parameter) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +es6id: 14.4.13 +features: [destructuring-binding, default-parameters] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod 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 GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var obj = { + *method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +obj.method().next(); +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/src/dstr-binding/default/meth-dflt.template b/src/dstr-binding/default/meth-dflt.template new file mode 100644 index 0000000000..3a8b825e7e --- /dev/null +++ b/src/dstr-binding/default/meth-dflt.template @@ -0,0 +1,52 @@ +// Copyright (C) 2016 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-meth-dflt- +name: method (default parameter) +esid: sec-runtime-semantics-definemethod +es6id: 14.3.8 +features: [destructuring-binding, default-parameters] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var callCount = 0; +var obj = { + method(/*{ elems }*/ = /*{ vals }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +obj.method(); +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dstr-binding/error/arrow-function-dflt.template b/src/dstr-binding/error/arrow-function-dflt.template new file mode 100644 index 0000000000..268fbe58b8 --- /dev/null +++ b/src/dstr-binding/error/arrow-function-dflt.template @@ -0,0 +1,44 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/arrow-function/dstr-dflt- +name: arrow function expression (default parameter) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +es6id: 14.2.16 +features: [destructuring-binding, default-parameters] +info: | + ArrowFunction : ArrowParameters => ConciseBody + + [...] + 4. Let closure be FunctionCreate(Arrow, parameters, ConciseBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var f = (/*{ elems }*/ = /*{ vals }*/) => {}; + +assert.throws(/*{ error }*/, function() { + f(); +}); diff --git a/src/dstr-binding/error/cls-decl-gen-meth-dflt.template b/src/dstr-binding/error/cls-decl-gen-meth-dflt.template new file mode 100644 index 0000000000..48479af1b1 --- /dev/null +++ b/src/dstr-binding/error/cls-decl-gen-meth-dflt.template @@ -0,0 +1,69 @@ +// Copyright (C) 2016 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-gen-meth-dflt- +name: class expression method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod 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 GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +class C { + *method(/*{ elems }*/ = /*{ vals }*/) {} +}; +var c = new C(); + +assert.throws(/*{ error }*/, function() { + c.method(); +}); diff --git a/src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template b/src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template new file mode 100644 index 0000000000..ba0ee63759 --- /dev/null +++ b/src/dstr-binding/error/cls-decl-gen-meth-static-dflt.template @@ -0,0 +1,68 @@ +// Copyright (C) 2016 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-gen-meth-static-dflt- +name: static class expression generator method (default parameter) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod 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 GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +class C { + static *method(/*{ elems }*/ = /*{ vals }*/) {} +}; + +assert.throws(/*{ error }*/, function() { + C.method(); +}); diff --git a/src/dstr-binding/error/cls-decl-meth-dflt.template b/src/dstr-binding/error/cls-decl-meth-dflt.template new file mode 100644 index 0000000000..6824a0a039 --- /dev/null +++ b/src/dstr-binding/error/cls-decl-meth-dflt.template @@ -0,0 +1,68 @@ +// Copyright (C) 2016 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-meth-dflt- +name: class expression method (default parameter) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +class C { + method(/*{ elems }*/ = /*{ vals }*/) {} +}; + +var c = new C(); + +assert.throws(/*{ error }*/, function() { + c.method(); +}); diff --git a/src/dstr-binding/error/cls-decl-meth-static-dflt.template b/src/dstr-binding/error/cls-decl-meth-static-dflt.template new file mode 100644 index 0000000000..7c86010dbf --- /dev/null +++ b/src/dstr-binding/error/cls-decl-meth-static-dflt.template @@ -0,0 +1,66 @@ +// Copyright (C) 2016 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-meth-static-dflt- +name: static class expression method (default parameter) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +class C { + static method(/*{ elems }*/ = /*{ vals }*/) {} +}; + +assert.throws(/*{ error }*/, function() { + C.method(); +}); diff --git a/src/dstr-binding/error/cls-expr-gen-meth-dflt.template b/src/dstr-binding/error/cls-expr-gen-meth-dflt.template new file mode 100644 index 0000000000..e6bdc24765 --- /dev/null +++ b/src/dstr-binding/error/cls-expr-gen-meth-dflt.template @@ -0,0 +1,71 @@ +// Copyright (C) 2016 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-gen-meth-dflt- +name: class expression method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod 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 GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var C = class { + *method(/*{ elems }*/ = /*{ vals }*/) {} +}; +var c = new C(); + +assert.throws(/*{ error }*/, function() { + c.method(); +}); diff --git a/src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template b/src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template new file mode 100644 index 0000000000..75cd41fe88 --- /dev/null +++ b/src/dstr-binding/error/cls-expr-gen-meth-static-dflt.template @@ -0,0 +1,70 @@ +// Copyright (C) 2016 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-gen-meth-static-dflt- +name: static class expression generator method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation + + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod 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 GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var C = class { + static *method(/*{ elems }*/ = /*{ vals }*/) {} +}; + +assert.throws(/*{ error }*/, function() { + C.method(); +}); diff --git a/src/dstr-binding/error/cls-expr-meth-dflt.template b/src/dstr-binding/error/cls-expr-meth-dflt.template new file mode 100644 index 0000000000..0f1465a2b1 --- /dev/null +++ b/src/dstr-binding/error/cls-expr-meth-dflt.template @@ -0,0 +1,69 @@ +// Copyright (C) 2016 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-meth-dflt- +name: class expression method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var C = class { + method(/*{ elems }*/ = /*{ vals }*/) {} +}; + +var c = new C(); + +assert.throws(/*{ error }*/, function() { + c.method(); +}); diff --git a/src/dstr-binding/error/cls-expr-meth-static-dflt.template b/src/dstr-binding/error/cls-expr-meth-static-dflt.template new file mode 100644 index 0000000000..e623115df5 --- /dev/null +++ b/src/dstr-binding/error/cls-expr-meth-static-dflt.template @@ -0,0 +1,67 @@ +// Copyright (C) 2016 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-meth-static-dflt- +name: static class expression method (default parameter) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [destructuring-binding, default-parameters] +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. + [...] + + 14.3.8 Runtime Semantics: DefineMethod + + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, + scope, strict). If functionPrototype was passed as a parameter then pass its + value as the functionPrototype optional argument of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var C = class { + static method(/*{ elems }*/ = /*{ vals }*/) {} +}; + +assert.throws(/*{ error }*/, function() { + C.method(); +}); diff --git a/src/dstr-binding/error/func-decl-dflt.template b/src/dstr-binding/error/func-decl-dflt.template new file mode 100644 index 0000000000..ebadbe395e --- /dev/null +++ b/src/dstr-binding/error/func-decl-dflt.template @@ -0,0 +1,46 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/function/dstr-dflt- +name: function declaration (default parameter) +esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.1.19 +features: [destructuring-binding, default-parameters] +info: | + FunctionDeclaration : + function BindingIdentifier ( FormalParameters ) { FunctionBody } + + [...] + 3. Let F be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +function f(/*{ elems }*/ = /*{ vals }*/) {} + +assert.throws(/*{ error }*/, function() { + f(); +}); diff --git a/src/dstr-binding/error/func-expr-dflt.template b/src/dstr-binding/error/func-expr-dflt.template new file mode 100644 index 0000000000..29c03f558e --- /dev/null +++ b/src/dstr-binding/error/func-expr-dflt.template @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/function/dstr-dflt- +name: function expression (default parameter) +esid: sec-function-definitions-runtime-semantics-evaluation +es6id: 14.1.20 +features: [destructuring-binding, default-parameters] +info: | + FunctionExpression : function ( FormalParameters ) { FunctionBody } + + [...] + 3. Let closure be FunctionCreate(Normal, FormalParameters, FunctionBody, + scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var f = function(/*{ elems }*/ = /*{ vals }*/) {}; + +assert.throws(/*{ error }*/, function() { + f(); +}); diff --git a/src/dstr-binding/error/gen-func-decl-dflt.template b/src/dstr-binding/error/gen-func-decl-dflt.template new file mode 100644 index 0000000000..523836662b --- /dev/null +++ b/src/dstr-binding/error/gen-func-decl-dflt.template @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/statements/generators/dstr-dflt- +name: generator function declaration (default parameter) +esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.4.12 +features: [destructuring-binding, default-parameters] +info: | + GeneratorDeclaration : function * ( FormalParameters ) { GeneratorBody } + + [...] + 2. Let F be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +function* f(/*{ elems }*/ = /*{ vals }*/) {} + +assert.throws(/*{ error }*/, function() { + f(); +}); diff --git a/src/dstr-binding/error/gen-func-expr-dflt.template b/src/dstr-binding/error/gen-func-expr-dflt.template new file mode 100644 index 0000000000..2689749a29 --- /dev/null +++ b/src/dstr-binding/error/gen-func-expr-dflt.template @@ -0,0 +1,45 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +path: language/expressions/generators/dstr-dflt- +name: generator function expression (default parameter) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +features: [destructuring-binding, default-parameters] +info: | + GeneratorExpression : function * ( FormalParameters ) { GeneratorBody } + + [...] + 3. Let closure be GeneratorFunctionCreate(Normal, FormalParameters, + GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var f = function*(/*{ elems }*/ = /*{ vals }*/) {}; + +assert.throws(/*{ error }*/, function() { + f(); +}); diff --git a/src/dstr-binding/error/gen-meth-dflt.template b/src/dstr-binding/error/gen-meth-dflt.template new file mode 100644 index 0000000000..d738d6b2d3 --- /dev/null +++ b/src/dstr-binding/error/gen-meth-dflt.template @@ -0,0 +1,52 @@ +// Copyright (C) 2016 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-gen-meth-dflt- +name: generator method (default parameter) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +es6id: 14.4.13 +features: [destructuring-binding, default-parameters] +info: | + GeneratorMethod : + * PropertyName ( StrictFormalParameters ) { GeneratorBody } + + 1. Let propKey be the result of evaluating PropertyName. + 2. ReturnIfAbrupt(propKey). + 3. If the function code for this GeneratorMethod 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 GeneratorFunctionCreate(Method, + StrictFormalParameters, GeneratorBody, scope, strict). + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var obj = { + *method(/*{ elems }*/ = /*{ vals }*/) {} +}; + +assert.throws(/*{ error }*/, function() { + obj.method(); +}); diff --git a/src/dstr-binding/error/meth-dflt.template b/src/dstr-binding/error/meth-dflt.template new file mode 100644 index 0000000000..e56ffd0b2c --- /dev/null +++ b/src/dstr-binding/error/meth-dflt.template @@ -0,0 +1,49 @@ +// Copyright (C) 2016 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-meth-dflt- +name: method (default parameter) +esid: sec-runtime-semantics-definemethod +es6id: 14.3.8 +features: [destructuring-binding, default-parameters] +info: | + MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } + + [...] + 6. Let closure be FunctionCreate(kind, StrictFormalParameters, + FunctionBody, scope, strict). If functionPrototype was passed as a + parameter then pass its value as the functionPrototype optional argument + of FunctionCreate. + [...] + + 9.2.1 [[Call]] ( thisArgument, argumentsList) + + [...] + 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). + [...] + + 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) + + 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). + [...] + + 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) + + [...] + 23. Let iteratorRecord be Record {[[iterator]]: + CreateListIterator(argumentsList), [[done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + b. Let formalStatus be IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +var obj = { + method(/*{ elems }*/ = /*{ vals }*/) {} +}; + +assert.throws(/*{ error }*/, function() { + obj.method(); +}); -- GitLab