diff --git a/src/dflt-params/abrupt.case b/src/dflt-params/abrupt.case new file mode 100644 index 0000000000..7c52350567 --- /dev/null +++ b/src/dflt-params/abrupt.case @@ -0,0 +1,21 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: Abrupt completion returned by evaluation of initializer +template: error +info: | + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +//- params +_ = (function() { throw new Test262Error(); }()) +//- error +Test262Error diff --git a/src/dflt-params/arg-val-not-undefined.case b/src/dflt-params/arg-val-not-undefined.case new file mode 100644 index 0000000000..20082b1ae9 --- /dev/null +++ b/src/dflt-params/arg-val-not-undefined.case @@ -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. +/*--- +desc: Use of intializer when argument value is not `undefined` +template: default +info: | + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +//- setup +var obj = {}; +var falseCount = 0; +var stringCount = 0; +var nanCount = 0; +var zeroCount = 0; +var nullCount = 0; +var objCount = 0; +//- params +aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1 +//- args +false, '', NaN, 0, null, obj +//- body +assert.sameValue(aFalse, false); +assert.sameValue(aString, ''); +assert.sameValue(aNaN, NaN); +assert.sameValue(a0, 0); +assert.sameValue(aNull, null); +assert.sameValue(aObj, obj); +//- teardown +assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); +assert.sameValue(stringCount, 0, 'initializer not evaluated: string'); +assert.sameValue(nanCount, 0, 'initializer not evaluated: NaN'); +assert.sameValue(zeroCount, 0, 'initializer not evaluated: 0'); +assert.sameValue(nullCount, 0, 'initializer not evaluated: null'); +assert.sameValue(objCount, 0, 'initializer not evaluated: object'); diff --git a/src/dflt-params/arg-val-undefined.case b/src/dflt-params/arg-val-undefined.case new file mode 100644 index 0000000000..3d4797b26e --- /dev/null +++ b/src/dflt-params/arg-val-undefined.case @@ -0,0 +1,29 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: Use of intializer when argument value is `undefined` +template: default +info: | + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + [...] + 23. Let iteratorRecord be Record {[[Iterator]]: + CreateListIterator(argumentsList), [[Done]]: false}. + 24. If hasDuplicates is true, then + [...] + 25. Else, + a. Perform ? IteratorBindingInitialization for formals with + iteratorRecord and env as arguments. + [...] +---*/ + +//- params +fromLiteral = 23, fromExpr = 45, fromHole = 99 +//- args +undefined, void 0 +//- body +assert.sameValue(fromLiteral, 23); +assert.sameValue(fromExpr, 45); +assert.sameValue(fromHole, 99); diff --git a/src/dflt-params/default/arrow-function.template b/src/dflt-params/default/arrow-function.template new file mode 100644 index 0000000000..d6b94de60a --- /dev/null +++ b/src/dflt-params/default/arrow-function.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/params-dflt- +name: arrow function expression +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +es6id: 14.2.16 +features: [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 = (/*{ params }*/) => { + /*{ body }*/ + callCount = callCount + 1; +}; + +f(/*{ args }*/); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/src/dflt-params/default/cls-decl-gen-meth-static.template b/src/dflt-params/default/cls-decl-gen-meth-static.template new file mode 100644 index 0000000000..a617fc6d6f --- /dev/null +++ b/src/dflt-params/default/cls-decl-gen-meth-static.template @@ -0,0 +1,72 @@ +// 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/params-dflt-gen-meth-static- +name: static class expression generator method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +} + +C.method(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dflt-params/default/cls-decl-gen-meth.template b/src/dflt-params/default/cls-decl-gen-meth.template new file mode 100644 index 0000000000..ba80c6ecd2 --- /dev/null +++ b/src/dflt-params/default/cls-decl-gen-meth.template @@ -0,0 +1,72 @@ +// 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/params-dflt-gen-meth- +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +} + +C.prototype.method(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dflt-params/default/cls-decl-meth-static.template b/src/dflt-params/default/cls-decl-meth-static.template new file mode 100644 index 0000000000..637db4ac8d --- /dev/null +++ b/src/dflt-params/default/cls-decl-meth-static.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/statements/class/params-dflt-meth-static- +name: static class expression method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +} + +C.method(/*{ args }*/); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dflt-params/default/cls-decl-meth.template b/src/dflt-params/default/cls-decl-meth.template new file mode 100644 index 0000000000..9c5eabaa95 --- /dev/null +++ b/src/dflt-params/default/cls-decl-meth.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/statements/class/params-dflt-meth- +name: class expression method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +} + +C.prototype.method(/*{ args }*/); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dflt-params/default/cls-expr-gen-meth-static.template b/src/dflt-params/default/cls-expr-gen-meth-static.template new file mode 100644 index 0000000000..1964116f89 --- /dev/null +++ b/src/dflt-params/default/cls-expr-gen-meth-static.template @@ -0,0 +1,74 @@ +// 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/params-dflt-gen-meth-static- +name: static class expression generator method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dflt-params/default/cls-expr-gen-meth.template b/src/dflt-params/default/cls-expr-gen-meth.template new file mode 100644 index 0000000000..a02781a19d --- /dev/null +++ b/src/dflt-params/default/cls-expr-gen-meth.template @@ -0,0 +1,74 @@ +// 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/params-dflt-gen-meth- +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.prototype.method(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dflt-params/default/cls-expr-meth-static.template b/src/dflt-params/default/cls-expr-meth-static.template new file mode 100644 index 0000000000..1906dc9d1f --- /dev/null +++ b/src/dflt-params/default/cls-expr-meth-static.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/params-dflt-meth-static- +name: static class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.method(/*{ args }*/); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dflt-params/default/cls-expr-meth.template b/src/dflt-params/default/cls-expr-meth.template new file mode 100644 index 0000000000..0220880d47 --- /dev/null +++ b/src/dflt-params/default/cls-expr-meth.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/params-dflt-meth- +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +C.prototype.method(/*{ args }*/); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dflt-params/default/func-decl.template b/src/dflt-params/default/func-decl.template new file mode 100644 index 0000000000..d6cdb614b6 --- /dev/null +++ b/src/dflt-params/default/func-decl.template @@ -0,0 +1,50 @@ +// 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/params-dflt- +name: function declaration +esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.1.19 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; +} + +f(/*{ args }*/); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/src/dflt-params/default/func-expr.template b/src/dflt-params/default/func-expr.template new file mode 100644 index 0000000000..75cbfecf45 --- /dev/null +++ b/src/dflt-params/default/func-expr.template @@ -0,0 +1,50 @@ +// 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/params-dflt- +name: function expression +esid: sec-function-definitions-runtime-semantics-evaluation +es6id: 14.1.20 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; + +f(/*{ args }*/); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/src/dflt-params/default/gen-func-decl.template b/src/dflt-params/default/gen-func-decl.template new file mode 100644 index 0000000000..c3d38a3761 --- /dev/null +++ b/src/dflt-params/default/gen-func-decl.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/statements/generators/params-dflt- +name: generator function declaration +esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.4.12 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; +} + +f(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/src/dflt-params/default/gen-func-expr.template b/src/dflt-params/default/gen-func-expr.template new file mode 100644 index 0000000000..c95d116be6 --- /dev/null +++ b/src/dflt-params/default/gen-func-expr.template @@ -0,0 +1,50 @@ +// 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/params-dflt- +name: generator function expression +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +features: [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*(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; + +f(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/src/dflt-params/default/gen-meth.template b/src/dflt-params/default/gen-meth.template new file mode 100644 index 0000000000..a302e61601 --- /dev/null +++ b/src/dflt-params/default/gen-meth.template @@ -0,0 +1,56 @@ +// 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/method-definition/params-dflt-gen-meth- +name: generator method +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +es6id: 14.4.13 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +obj.method(/*{ args }*/).next(); + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/src/dflt-params/default/meth.template b/src/dflt-params/default/meth.template new file mode 100644 index 0000000000..48f25bdfd0 --- /dev/null +++ b/src/dflt-params/default/meth.template @@ -0,0 +1,53 @@ +// 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/method-definition/params-dflt-meth- +name: method +esid: sec-runtime-semantics-definemethod +es6id: 14.3.8 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +obj.method(/*{ args }*/); + +assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/src/dflt-params/duplicates.case b/src/dflt-params/duplicates.case new file mode 100644 index 0000000000..e2a6e424d0 --- /dev/null +++ b/src/dflt-params/duplicates.case @@ -0,0 +1,25 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: > + It is a Syntax Error if BoundNames of FormalParameters contains any duplicate + elements. +template: syntax +negative: SyntaxError +info: | + 14.1.2 Static Semantics: Early Errors + + StrictFormalParameters : FormalParameters + + - It is a Syntax Error if BoundNames of FormalParameters contains any + duplicate elements. + + FormalParameters : FormalParameterList + + - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is + false and BoundNames of FormalParameterList contains any duplicate + elements. +---*/ + +//- params +x = 0, x diff --git a/src/dflt-params/error/arrow-function.template b/src/dflt-params/error/arrow-function.template new file mode 100644 index 0000000000..80e76e09b3 --- /dev/null +++ b/src/dflt-params/error/arrow-function.template @@ -0,0 +1,50 @@ +// 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/params-dflt- +name: arrow function expression +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +es6id: 14.2.16 +features: [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 = (/*{ params }*/) => { + /*{ body }*/ + callCount = callCount + 1; +}; + +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'arrow function body not evaluated'); diff --git a/src/dflt-params/error/cls-decl-gen-meth-static.template b/src/dflt-params/error/cls-decl-gen-meth-static.template new file mode 100644 index 0000000000..91132c062e --- /dev/null +++ b/src/dflt-params/error/cls-decl-gen-meth-static.template @@ -0,0 +1,74 @@ +// 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/params-dflt-gen-meth-static- +name: static class expression generator method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +} + +assert.throws(/*{ error }*/, function() { + C.method(/*{ args }*/); +}); + +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/dflt-params/error/cls-decl-gen-meth.template b/src/dflt-params/error/cls-decl-gen-meth.template new file mode 100644 index 0000000000..a27716832b --- /dev/null +++ b/src/dflt-params/error/cls-decl-gen-meth.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/statements/class/params-dflt-gen-meth- +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +} + +assert.throws(/*{ error }*/, function() { + C.prototype.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/dflt-params/error/cls-decl-meth-static.template b/src/dflt-params/error/cls-decl-meth-static.template new file mode 100644 index 0000000000..204380ef36 --- /dev/null +++ b/src/dflt-params/error/cls-decl-meth-static.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/params-dflt-meth-static- +name: static class expression method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +} + +assert.throws(/*{ error }*/, function() { + C.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/dflt-params/error/cls-decl-meth.template b/src/dflt-params/error/cls-decl-meth.template new file mode 100644 index 0000000000..3242269590 --- /dev/null +++ b/src/dflt-params/error/cls-decl-meth.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/params-dflt-meth- +name: class expression method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +} + +assert.throws(/*{ error }*/, function() { + C.prototype.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/dflt-params/error/cls-expr-gen-meth-static.template b/src/dflt-params/error/cls-expr-gen-meth-static.template new file mode 100644 index 0000000000..9c43e710f6 --- /dev/null +++ b/src/dflt-params/error/cls-expr-gen-meth-static.template @@ -0,0 +1,75 @@ +// 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/params-dflt-gen-meth-static- +name: static class expression generator method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + C.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/dflt-params/error/cls-expr-gen-meth.template b/src/dflt-params/error/cls-expr-gen-meth.template new file mode 100644 index 0000000000..f1603cf651 --- /dev/null +++ b/src/dflt-params/error/cls-expr-gen-meth.template @@ -0,0 +1,75 @@ +// 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/params-dflt-gen-meth- +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + C.prototype.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/dflt-params/error/cls-expr-meth-static.template b/src/dflt-params/error/cls-expr-meth-static.template new file mode 100644 index 0000000000..05bed0933b --- /dev/null +++ b/src/dflt-params/error/cls-expr-meth-static.template @@ -0,0 +1,72 @@ +// 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/params-dflt-meth-static- +name: static class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + C.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/dflt-params/error/cls-expr-meth.template b/src/dflt-params/error/cls-expr-meth.template new file mode 100644 index 0000000000..b89ff9944f --- /dev/null +++ b/src/dflt-params/error/cls-expr-meth.template @@ -0,0 +1,72 @@ +// 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/params-dflt-meth- +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + C.prototype.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/dflt-params/error/func-decl.template b/src/dflt-params/error/func-decl.template new file mode 100644 index 0000000000..81e5da3712 --- /dev/null +++ b/src/dflt-params/error/func-decl.template @@ -0,0 +1,50 @@ +// 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/params-dflt- +name: function declaration +esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.1.19 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; +} +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'function body not evaluated'); diff --git a/src/dflt-params/error/func-expr.template b/src/dflt-params/error/func-expr.template new file mode 100644 index 0000000000..2d38723ca1 --- /dev/null +++ b/src/dflt-params/error/func-expr.template @@ -0,0 +1,51 @@ +// 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/params-dflt- +name: function expression +esid: sec-function-definitions-runtime-semantics-evaluation +es6id: 14.1.20 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; + +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'function body not evaluated'); diff --git a/src/dflt-params/error/gen-func-decl.template b/src/dflt-params/error/gen-func-decl.template new file mode 100644 index 0000000000..74d7e3e33b --- /dev/null +++ b/src/dflt-params/error/gen-func-decl.template @@ -0,0 +1,51 @@ +// 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/params-dflt- +name: generator function declaration +esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.4.12 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; +} + +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/); +}); + +assert.sameValue(callCount, 0, 'generator function body not evaluated'); diff --git a/src/dflt-params/error/gen-func-expr.template b/src/dflt-params/error/gen-func-expr.template new file mode 100644 index 0000000000..950d3e132b --- /dev/null +++ b/src/dflt-params/error/gen-func-expr.template @@ -0,0 +1,51 @@ +// 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/params-dflt- +name: generator function expression +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +features: [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*(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; +}; + +assert.throws(/*{ error }*/, function() { + f(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'generator function body not evaluated'); diff --git a/src/dflt-params/error/gen-meth.template b/src/dflt-params/error/gen-meth.template new file mode 100644 index 0000000000..3862e08507 --- /dev/null +++ b/src/dflt-params/error/gen-meth.template @@ -0,0 +1,57 @@ +// 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/method-definition/params-dflt-gen-meth- +name: generator method +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +es6id: 14.4.13 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + obj.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'generator method body not evaluated'); diff --git a/src/dflt-params/error/meth.template b/src/dflt-params/error/meth.template new file mode 100644 index 0000000000..3683dbbedf --- /dev/null +++ b/src/dflt-params/error/meth.template @@ -0,0 +1,54 @@ +// 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/method-definition/params-dflt-meth- +name: method +esid: sec-runtime-semantics-definemethod +es6id: 14.3.8 +features: [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(/*{ params }*/) { + /*{ body }*/ + callCount = callCount + 1; + } +}; + +assert.throws(/*{ error }*/, function() { + obj.method(/*{ args }*/); +}); +assert.sameValue(callCount, 0, 'method body not evaluated'); diff --git a/src/dflt-params/ref-later.case b/src/dflt-params/ref-later.case new file mode 100644 index 0000000000..3087a10f32 --- /dev/null +++ b/src/dflt-params/ref-later.case @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: Referencing a parameter that occurs later in the ParameterList +template: error +info: | + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +//- setup +var x = 0; +//- params +x = y, y +//- error +ReferenceError diff --git a/src/dflt-params/ref-prior.case b/src/dflt-params/ref-prior.case new file mode 100644 index 0000000000..5e28248bb0 --- /dev/null +++ b/src/dflt-params/ref-prior.case @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: Referencing a parameter that occurs earlier in the ParameterList +template: default +info: | + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +//- setup +var x = 0; +//- params +x, y = x, z = y +//- args +3 +//- body +assert.sameValue(x, 3, 'first argument value'); +assert.sameValue(y, 3, 'second argument value'); +assert.sameValue(z, 3, 'third argument value'); diff --git a/src/dflt-params/ref-self.case b/src/dflt-params/ref-self.case new file mode 100644 index 0000000000..41b92f46e5 --- /dev/null +++ b/src/dflt-params/ref-self.case @@ -0,0 +1,23 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: Referencing a parameter from within its own initializer +template: error +info: | + 14.1.19 Runtime Semantics: IteratorBindingInitialization + + FormalsList : FormalsList , FormalParameter + + 1. Let status be the result of performing IteratorBindingInitialization for + FormalsList using iteratorRecord and environment as the arguments. + 2. ReturnIfAbrupt(status). + 3. Return the result of performing IteratorBindingInitialization for + FormalParameter using iteratorRecord and environment as the arguments. +---*/ + +//- setup +var x = 0; +//- params +x = x +//- error +ReferenceError diff --git a/src/dflt-params/rest.case b/src/dflt-params/rest.case new file mode 100644 index 0000000000..e8b7f03e35 --- /dev/null +++ b/src/dflt-params/rest.case @@ -0,0 +1,27 @@ +// Copyright (C) 2016 the V8 project authors. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +desc: RestParameter does not support an initializer +template: syntax +info: | + 14.1 Function Definitions + + Syntax + + FunctionRestParameter[Yield] : + + BindingRestElement[?Yield] + + 13.3.3 Destructuring Binding Patterns + + Syntax + + BindingRestElement[Yield] : + + ...BindingIdentifier[?Yield] + ...BindingPattern[?Yield] +negative: SyntaxError +---*/ + +//- params +...x = [] diff --git a/src/dflt-params/syntax/arrow-function.template b/src/dflt-params/syntax/arrow-function.template new file mode 100644 index 0000000000..46f6eabab0 --- /dev/null +++ b/src/dflt-params/syntax/arrow-function.template @@ -0,0 +1,42 @@ +// 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/params-dflt- +name: arrow function expression +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +es6id: 14.2.16 +features: [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. + [...] +---*/ + +0, (/*{ params }*/) => { + /*{ body }*/ +}; diff --git a/src/dflt-params/syntax/cls-decl-gen-meth-static.template b/src/dflt-params/syntax/cls-decl-gen-meth-static.template new file mode 100644 index 0000000000..50414c1ada --- /dev/null +++ b/src/dflt-params/syntax/cls-decl-gen-meth-static.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/params-dflt-gen-meth-static- +name: static class expression generator method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [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(/*{ params }*/) { + /*{ body }*/ + } +} diff --git a/src/dflt-params/syntax/cls-decl-gen-meth.template b/src/dflt-params/syntax/cls-decl-gen-meth.template new file mode 100644 index 0000000000..fe6c086403 --- /dev/null +++ b/src/dflt-params/syntax/cls-decl-gen-meth.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/params-dflt-gen-meth- +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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(/*{ params }*/) { + /*{ body }*/ + } +} diff --git a/src/dflt-params/syntax/cls-decl-meth-static.template b/src/dflt-params/syntax/cls-decl-meth-static.template new file mode 100644 index 0000000000..b3c8b8709d --- /dev/null +++ b/src/dflt-params/syntax/cls-decl-meth-static.template @@ -0,0 +1,64 @@ +// 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/params-dflt-meth-static- +name: static class expression method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [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(/*{ params }*/) { + /*{ body }*/ + } +} diff --git a/src/dflt-params/syntax/cls-decl-meth.template b/src/dflt-params/syntax/cls-decl-meth.template new file mode 100644 index 0000000000..f6cdd67e5d --- /dev/null +++ b/src/dflt-params/syntax/cls-decl-meth.template @@ -0,0 +1,64 @@ +// 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/params-dflt-meth- +name: class expression method +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [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(/*{ params }*/) { + /*{ body }*/ + } +} diff --git a/src/dflt-params/syntax/cls-expr-gen-meth-static.template b/src/dflt-params/syntax/cls-expr-gen-meth-static.template new file mode 100644 index 0000000000..dad8668991 --- /dev/null +++ b/src/dflt-params/syntax/cls-expr-gen-meth-static.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/expressions/class/params-dflt-gen-meth-static- +name: static class expression generator method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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. + [...] +---*/ + +0, class { + static *method(/*{ params }*/) { + /*{ body }*/ + } +}; diff --git a/src/dflt-params/syntax/cls-expr-gen-meth.template b/src/dflt-params/syntax/cls-expr-gen-meth.template new file mode 100644 index 0000000000..6557296226 --- /dev/null +++ b/src/dflt-params/syntax/cls-expr-gen-meth.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/expressions/class/params-dflt-gen-meth- +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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. + [...] +---*/ + +0, class { + *method(/*{ params }*/) { + /*{ body }*/ + } +}; diff --git a/src/dflt-params/syntax/cls-expr-meth-static.template b/src/dflt-params/syntax/cls-expr-meth-static.template new file mode 100644 index 0000000000..f90fa8dccb --- /dev/null +++ b/src/dflt-params/syntax/cls-expr-meth-static.template @@ -0,0 +1,65 @@ +// 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/params-dflt-meth-static- +name: static class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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. + [...] +---*/ + +0, class { + static method(/*{ params }*/) { + /*{ body }*/ + } +}; diff --git a/src/dflt-params/syntax/cls-expr-meth.template b/src/dflt-params/syntax/cls-expr-meth.template new file mode 100644 index 0000000000..88f862d083 --- /dev/null +++ b/src/dflt-params/syntax/cls-expr-meth.template @@ -0,0 +1,65 @@ +// 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/params-dflt-meth- +name: class expression method +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [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. + [...] +---*/ + +0, class { + method(/*{ params }*/) { + /*{ body }*/ + } +}; diff --git a/src/dflt-params/syntax/func-decl.template b/src/dflt-params/syntax/func-decl.template new file mode 100644 index 0000000000..601a9826b2 --- /dev/null +++ b/src/dflt-params/syntax/func-decl.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/statements/function/params-dflt- +name: function declaration +esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.1.19 +features: [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(/*{ params }*/) { + /*{ body }*/ +} diff --git a/src/dflt-params/syntax/func-expr.template b/src/dflt-params/syntax/func-expr.template new file mode 100644 index 0000000000..8407f2df2a --- /dev/null +++ b/src/dflt-params/syntax/func-expr.template @@ -0,0 +1,43 @@ +// 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/params-dflt- +name: function expression +esid: sec-function-definitions-runtime-semantics-evaluation +es6id: 14.1.20 +features: [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. + [...] +---*/ + +0, function(/*{ params }*/) { + /*{ body }*/ +}; diff --git a/src/dflt-params/syntax/gen-func-decl.template b/src/dflt-params/syntax/gen-func-decl.template new file mode 100644 index 0000000000..79b7683c96 --- /dev/null +++ b/src/dflt-params/syntax/gen-func-decl.template @@ -0,0 +1,43 @@ +// 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/params-dflt- +name: generator function declaration +esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.4.12 +features: [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(/*{ params }*/) { + /*{ body }*/ +} diff --git a/src/dflt-params/syntax/gen-func-expr.template b/src/dflt-params/syntax/gen-func-expr.template new file mode 100644 index 0000000000..0ef6dbe35a --- /dev/null +++ b/src/dflt-params/syntax/gen-func-expr.template @@ -0,0 +1,43 @@ +// 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/params-dflt- +name: generator function expression +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +features: [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. + [...] +---*/ + +0, function*(/*{ params }*/) { + /*{ body }*/ +}; diff --git a/src/dflt-params/syntax/gen-meth.template b/src/dflt-params/syntax/gen-meth.template new file mode 100644 index 0000000000..f9125cff59 --- /dev/null +++ b/src/dflt-params/syntax/gen-meth.template @@ -0,0 +1,50 @@ +// 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/method-definition/params-dflt-gen-meth- +name: generator method +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +es6id: 14.4.13 +features: [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. + [...] +---*/ + +0, { + *method(/*{ params }*/) { + /*{ body }*/ + } +}; diff --git a/src/dflt-params/syntax/meth.template b/src/dflt-params/syntax/meth.template new file mode 100644 index 0000000000..b9f3c83109 --- /dev/null +++ b/src/dflt-params/syntax/meth.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/expressions/object/method-definition/params-dflt-meth- +name: method +esid: sec-runtime-semantics-definemethod +es6id: 14.3.8 +features: [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. + [...] +---*/ + +0, { + method(/*{ params }*/) { + /*{ body }*/ + } +};