diff --git a/test/language/expressions/arrow-function/params-dflt-arg-val-not-undefined.js b/test/language/expressions/arrow-function/params-dflt-arg-val-not-undefined.js index 6bbd530386036234a74a135ff5fb4dd4f494cdf8..124a1addfe73f41f2d0336e122b44860cecde9ae 100644 --- a/test/language/expressions/arrow-function/params-dflt-arg-val-not-undefined.js +++ b/test/language/expressions/arrow-function/params-dflt-arg-val-not-undefined.js @@ -60,8 +60,9 @@ var nullCount = 0; var objCount = 0; var callCount = 0; -var f; -f = (aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) => { +// Stores a reference `ref` for case evaluation +var ref; +ref = (aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) => { assert.sameValue(aFalse, false); assert.sameValue(aString, ''); assert.sameValue(aNaN, NaN); @@ -71,7 +72,7 @@ f = (aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, callCount = callCount + 1; }; -f(false, '', NaN, 0, null, obj); +ref(false, '', NaN, 0, null, obj); assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); diff --git a/test/language/expressions/arrow-function/params-dflt-arg-val-undefined.js b/test/language/expressions/arrow-function/params-dflt-arg-val-undefined.js index d3c55e91b010295576ec3b7c14d81b7cdc0d63b1..6de08d0c56e5062f15b3959f163e32320fdc21bb 100644 --- a/test/language/expressions/arrow-function/params-dflt-arg-val-undefined.js +++ b/test/language/expressions/arrow-function/params-dflt-arg-val-undefined.js @@ -53,13 +53,14 @@ info: | ---*/ var callCount = 0; -var f; -f = (fromLiteral = 23, fromExpr = 45, fromHole = 99) => { +// Stores a reference `ref` for case evaluation +var ref; +ref = (fromLiteral = 23, fromExpr = 45, fromHole = 99) => { assert.sameValue(fromLiteral, 23); assert.sameValue(fromExpr, 45); assert.sameValue(fromHole, 99); callCount = callCount + 1; }; -f(undefined, void 0); +ref(undefined, void 0); assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/test/language/expressions/arrow-function/params-dflt-ref-prior.js b/test/language/expressions/arrow-function/params-dflt-ref-prior.js index 41111ad7406be63232851b9b294eaffc3d61712d..bb39e868676439be1d2ed503f61686c50eca2ab3 100644 --- a/test/language/expressions/arrow-function/params-dflt-ref-prior.js +++ b/test/language/expressions/arrow-function/params-dflt-ref-prior.js @@ -50,13 +50,14 @@ info: | var x = 0; var callCount = 0; -var f; -f = (x, y = x, z = y) => { +// Stores a reference `ref` for case evaluation +var ref; +ref = (x, y = x, z = y) => { assert.sameValue(x, 3, 'first argument value'); assert.sameValue(y, 3, 'second argument value'); assert.sameValue(z, 3, 'third argument value'); callCount = callCount + 1; }; -f(3); +ref(3); assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); diff --git a/test/language/expressions/arrow-function/params-trailing-comma-dflt-param.js b/test/language/expressions/arrow-function/params-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..83340496556709af39a7096f906c6f501daaaf2f --- /dev/null +++ b/test/language/expressions/arrow-function/params-trailing-comma-dflt-param.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/arrow-function.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +es6id: 14.2.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = (a, b = 39,) => { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, undefined, 1); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/arrow-function/params-trailing-comma-multiple-param.js b/test/language/expressions/arrow-function/params-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..639dab0f56c8a18b97e9d11bd0ec05531d712a8b --- /dev/null +++ b/test/language/expressions/arrow-function/params-trailing-comma-multiple-param.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/arrow-function.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +es6id: 14.2.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = (a, b,) => { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, 39, 1); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/expressions/arrow-function/params-trailing-comma-rest-early-error.js b/test/language/expressions/arrow-function/params-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..7c42cae0013089d8b38d5d38e04e7f6c38686f82 --- /dev/null +++ b/test/language/expressions/arrow-function/params-trailing-comma-rest-early-error.js @@ -0,0 +1,57 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/arrow-function.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +es6id: 14.2.16 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +0, (...a,) => { + +}; diff --git a/test/language/expressions/arrow-function/params-trailing-comma-single-param.js b/test/language/expressions/arrow-function/params-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..4ba05c84a18baf7bcf5205085a99ee7dad1dd41d --- /dev/null +++ b/test/language/expressions/arrow-function/params-trailing-comma-single-param.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/arrow-function.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (arrow function expression) +esid: sec-arrow-function-definitions-runtime-semantics-evaluation +es6id: 14.2.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = (a,) => { + assert.sameValue(a, 42); + callCount = callCount + 1; +}; + +ref(42, 39); +assert.sameValue(callCount, 1, 'arrow function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/class/params-gen-meth-dflt-arg-val-not-undefined.js b/test/language/expressions/class/params-gen-meth-dflt-arg-val-not-undefined.js index 1eca63f8200e3d337275473901d73fcaf8a9735f..7e646c83712386355b3ec7e530e756ce4ba382b1 100644 --- a/test/language/expressions/class/params-gen-meth-dflt-arg-val-not-undefined.js +++ b/test/language/expressions/class/params-gen-meth-dflt-arg-val-not-undefined.js @@ -98,6 +98,9 @@ var C = class { C.prototype.method(false, '', NaN, 0, null, obj).next(); +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); diff --git a/test/language/expressions/class/params-gen-meth-dflt-arg-val-undefined.js b/test/language/expressions/class/params-gen-meth-dflt-arg-val-undefined.js index 45383979e50250862f879ee5f61cebdef302ef1c..a9d7d04a96bc765a9308f2a8612889fdaabec660 100644 --- a/test/language/expressions/class/params-gen-meth-dflt-arg-val-undefined.js +++ b/test/language/expressions/class/params-gen-meth-dflt-arg-val-undefined.js @@ -88,4 +88,7 @@ var C = class { C.prototype.method(undefined, void 0).next(); +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/expressions/class/params-gen-meth-dflt-ref-prior.js b/test/language/expressions/class/params-gen-meth-dflt-ref-prior.js index 08cab97dd2c2efdebb57e64251143c8be9e7c0a1..eb08e5c1ae90bcf046df875b92612996f6dc0161 100644 --- a/test/language/expressions/class/params-gen-meth-dflt-ref-prior.js +++ b/test/language/expressions/class/params-gen-meth-dflt-ref-prior.js @@ -85,4 +85,7 @@ var C = class { C.prototype.method(3).next(); +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/expressions/class/params-gen-meth-static-dflt-arg-val-not-undefined.js b/test/language/expressions/class/params-gen-meth-static-dflt-arg-val-not-undefined.js index 023fccf96d0e84fe32760e3b02f8330b7ef51637..94e32b78ef62c5202f90e9835d7036e6f8952180 100644 --- a/test/language/expressions/class/params-gen-meth-static-dflt-arg-val-not-undefined.js +++ b/test/language/expressions/class/params-gen-meth-static-dflt-arg-val-not-undefined.js @@ -98,6 +98,9 @@ var C = class { C.method(false, '', NaN, 0, null, obj).next(); +// Stores a reference `ref` for case evaluation +var ref = C.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); diff --git a/test/language/expressions/class/params-gen-meth-static-dflt-arg-val-undefined.js b/test/language/expressions/class/params-gen-meth-static-dflt-arg-val-undefined.js index f3c329ed9914261ee0e2ba81e74314c04d009193..019cae222f4f98fedfe92a394bd2865af2fbefd2 100644 --- a/test/language/expressions/class/params-gen-meth-static-dflt-arg-val-undefined.js +++ b/test/language/expressions/class/params-gen-meth-static-dflt-arg-val-undefined.js @@ -88,4 +88,7 @@ var C = class { C.method(undefined, void 0).next(); +// Stores a reference `ref` for case evaluation +var ref = C.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/expressions/class/params-gen-meth-static-dflt-ref-prior.js b/test/language/expressions/class/params-gen-meth-static-dflt-ref-prior.js index 75ae6e0dae84542dbbd461c8152232dcbe4e0704..275baaacd9ddc08770368addc915d61f27e09ee5 100644 --- a/test/language/expressions/class/params-gen-meth-static-dflt-ref-prior.js +++ b/test/language/expressions/class/params-gen-meth-static-dflt-ref-prior.js @@ -85,4 +85,7 @@ var C = class { C.method(3).next(); +// Stores a reference `ref` for case evaluation +var ref = C.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/expressions/class/params-gen-meth-static-trailing-comma-dflt-param.js b/test/language/expressions/class/params-gen-meth-static-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..1edabc15ea03f3b913d546b627823dc614e68fdd --- /dev/null +++ b/test/language/expressions/class/params-gen-meth-static-trailing-comma-dflt-param.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/cls-expr-gen-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static *method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.method(42, undefined, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/class/params-gen-meth-static-trailing-comma-multiple-param.js b/test/language/expressions/class/params-gen-meth-static-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..fd48f9ff48afb4d5b9ddbe928e0206e2001344d4 --- /dev/null +++ b/test/language/expressions/class/params-gen-meth-static-trailing-comma-multiple-param.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/cls-expr-gen-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static *method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.method(42, 39, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/expressions/class/params-gen-meth-static-trailing-comma-rest-early-error.js b/test/language/expressions/class/params-gen-meth-static-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..a177a7db6a4d64428a639db70a6baa231d7598b0 --- /dev/null +++ b/test/language/expressions/class/params-gen-meth-static-trailing-comma-rest-early-error.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/cls-expr-gen-meth-static.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +0, class { + static *method(...a,) { + + } +}; diff --git a/test/language/expressions/class/params-gen-meth-static-trailing-comma-single-param.js b/test/language/expressions/class/params-gen-meth-static-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..ec09cd51b37ef0d9c7d0ff0713fd6018e7703c3e --- /dev/null +++ b/test/language/expressions/class/params-gen-meth-static-trailing-comma-single-param.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/cls-expr-gen-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (static class expression generator method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static *method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +C.method(42, 39).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/class/params-gen-meth-trailing-comma-dflt-param.js b/test/language/expressions/class/params-gen-meth-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..fe8f44849f21bbb00922504180aef1e8682476aa --- /dev/null +++ b/test/language/expressions/class/params-gen-meth-trailing-comma-dflt-param.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/cls-expr-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + *method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, undefined, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/class/params-gen-meth-trailing-comma-multiple-param.js b/test/language/expressions/class/params-gen-meth-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..1b2307446f9659d7bc07f148fe242a6ca32f21e4 --- /dev/null +++ b/test/language/expressions/class/params-gen-meth-trailing-comma-multiple-param.js @@ -0,0 +1,87 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/cls-expr-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + *method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, 39, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/expressions/class/params-gen-meth-trailing-comma-rest-early-error.js b/test/language/expressions/class/params-gen-meth-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..66872635f923b1f0bde6f3ad9ffc378d88a450bb --- /dev/null +++ b/test/language/expressions/class/params-gen-meth-trailing-comma-rest-early-error.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/cls-expr-gen-meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +0, class { + *method(...a,) { + + } +}; diff --git a/test/language/expressions/class/params-gen-meth-trailing-comma-single-param.js b/test/language/expressions/class/params-gen-meth-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..e56043b421b15e57ee5c52a43dcbf8543cb0323a --- /dev/null +++ b/test/language/expressions/class/params-gen-meth-trailing-comma-single-param.js @@ -0,0 +1,86 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/cls-expr-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + *method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, 39).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/class/params-meth-dflt-arg-val-not-undefined.js b/test/language/expressions/class/params-meth-dflt-arg-val-not-undefined.js index a882098ce35f15336e199452ae8f94342ab2adae..67046c63a57188e5f9cf8fc225d1ecf3c6309476 100644 --- a/test/language/expressions/class/params-meth-dflt-arg-val-not-undefined.js +++ b/test/language/expressions/class/params-meth-dflt-arg-val-not-undefined.js @@ -95,6 +95,9 @@ var C = class { C.prototype.method(false, '', NaN, 0, null, obj); +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); diff --git a/test/language/expressions/class/params-meth-dflt-arg-val-undefined.js b/test/language/expressions/class/params-meth-dflt-arg-val-undefined.js index ec748421f37581461704d6360b421829bc052c22..49840bdc624ca01257ade657ed8d554187146b61 100644 --- a/test/language/expressions/class/params-meth-dflt-arg-val-undefined.js +++ b/test/language/expressions/class/params-meth-dflt-arg-val-undefined.js @@ -85,4 +85,7 @@ var C = class { C.prototype.method(undefined, void 0); +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/expressions/class/params-meth-dflt-ref-prior.js b/test/language/expressions/class/params-meth-dflt-ref-prior.js index 7a650a08d5249226fa574fd6b6878a91adc5c067..449877bc6add76aae24208ee6102a0fe11562cd3 100644 --- a/test/language/expressions/class/params-meth-dflt-ref-prior.js +++ b/test/language/expressions/class/params-meth-dflt-ref-prior.js @@ -82,4 +82,7 @@ var C = class { C.prototype.method(3); +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/expressions/class/params-meth-static-dflt-arg-val-not-undefined.js b/test/language/expressions/class/params-meth-static-dflt-arg-val-not-undefined.js index 113d9e75a8b12de947a0b30d8a964b6a09fb138a..1a5528f143ac97d69bbdad57f4548ff1c45e8d2f 100644 --- a/test/language/expressions/class/params-meth-static-dflt-arg-val-not-undefined.js +++ b/test/language/expressions/class/params-meth-static-dflt-arg-val-not-undefined.js @@ -95,6 +95,9 @@ var C = class { C.method(false, '', NaN, 0, null, obj); +// Stores a reference `ref` for case evaluation +var ref = C.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); diff --git a/test/language/expressions/class/params-meth-static-dflt-arg-val-undefined.js b/test/language/expressions/class/params-meth-static-dflt-arg-val-undefined.js index 6355c328afeb01ec41a23d0102d592c89c094fc4..43ce95ca68d79ed170c8317e860116971e43be7b 100644 --- a/test/language/expressions/class/params-meth-static-dflt-arg-val-undefined.js +++ b/test/language/expressions/class/params-meth-static-dflt-arg-val-undefined.js @@ -85,4 +85,7 @@ var C = class { C.method(undefined, void 0); +// Stores a reference `ref` for case evaluation +var ref = C.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/expressions/class/params-meth-static-dflt-ref-prior.js b/test/language/expressions/class/params-meth-static-dflt-ref-prior.js index 4d9702c610e937ae6ff95a39209229e13731cd97..4ae8dce0fa9d931ed3e910049bc713e1b53b8840 100644 --- a/test/language/expressions/class/params-meth-static-dflt-ref-prior.js +++ b/test/language/expressions/class/params-meth-static-dflt-ref-prior.js @@ -82,4 +82,7 @@ var C = class { C.method(3); +// Stores a reference `ref` for case evaluation +var ref = C.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/expressions/class/params-meth-static-trailing-comma-dflt-param.js b/test/language/expressions/class/params-meth-static-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..18ae7c3a3127bd852a235bd682dc02251b272b66 --- /dev/null +++ b/test/language/expressions/class/params-meth-static-trailing-comma-dflt-param.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/cls-expr-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.method(42, undefined, 1); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/class/params-meth-static-trailing-comma-multiple-param.js b/test/language/expressions/class/params-meth-static-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..a978520b675a879f721ac23ea073dbb034852c35 --- /dev/null +++ b/test/language/expressions/class/params-meth-static-trailing-comma-multiple-param.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/cls-expr-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.method(42, 39, 1); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/expressions/class/params-meth-static-trailing-comma-rest-early-error.js b/test/language/expressions/class/params-meth-static-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..19af19bf3032dbbf4ac5b7dbb78f5e5e31e7078e --- /dev/null +++ b/test/language/expressions/class/params-meth-static-trailing-comma-rest-early-error.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/cls-expr-meth-static.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +0, class { + static method(...a,) { + + } +}; diff --git a/test/language/expressions/class/params-meth-static-trailing-comma-single-param.js b/test/language/expressions/class/params-meth-static-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..3fc1bdecda86d0d46247c53bf8664824a8a53fb8 --- /dev/null +++ b/test/language/expressions/class/params-meth-static-trailing-comma-single-param.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/cls-expr-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (static class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + static method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +C.method(42, 39); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/class/params-meth-trailing-comma-dflt-param.js b/test/language/expressions/class/params-meth-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..7585060a290be13342219f190b0f70553714c570 --- /dev/null +++ b/test/language/expressions/class/params-meth-trailing-comma-dflt-param.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/cls-expr-meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, undefined, 1); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/class/params-meth-trailing-comma-multiple-param.js b/test/language/expressions/class/params-meth-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..2c414dde4a429cf75ccb3acf2eb35df64c564b51 --- /dev/null +++ b/test/language/expressions/class/params-meth-trailing-comma-multiple-param.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/cls-expr-meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, 39, 1); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/expressions/class/params-meth-trailing-comma-rest-early-error.js b/test/language/expressions/class/params-meth-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..e4fd102549a3c00410ae8f756061f8085b592266 --- /dev/null +++ b/test/language/expressions/class/params-meth-trailing-comma-rest-early-error.js @@ -0,0 +1,80 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/cls-expr-meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +0, class { + method(...a,) { + + } +}; diff --git a/test/language/expressions/class/params-meth-trailing-comma-single-param.js b/test/language/expressions/class/params-meth-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..43739616c4dc0901f705104195da15966d9ae9ae --- /dev/null +++ b/test/language/expressions/class/params-meth-trailing-comma-single-param.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/cls-expr-meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var C = class { + method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +C.prototype.method(42, 39); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/function/params-dflt-arg-val-not-undefined.js b/test/language/expressions/function/params-dflt-arg-val-not-undefined.js index d66bd39081b81d05832d5f521c7e721483c1215a..155c4084aecd853d92f32905b1bd2ac37ba72934 100644 --- a/test/language/expressions/function/params-dflt-arg-val-not-undefined.js +++ b/test/language/expressions/function/params-dflt-arg-val-not-undefined.js @@ -61,8 +61,9 @@ var nullCount = 0; var objCount = 0; var callCount = 0; -var f; -f = function(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { +// Stores a reference `ref` for case evaluation +var ref; +ref = function(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { assert.sameValue(aFalse, false); assert.sameValue(aString, ''); assert.sameValue(aNaN, NaN); @@ -72,7 +73,7 @@ f = function(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCoun callCount = callCount + 1; }; -f(false, '', NaN, 0, null, obj); +ref(false, '', NaN, 0, null, obj); assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/test/language/expressions/function/params-dflt-arg-val-undefined.js b/test/language/expressions/function/params-dflt-arg-val-undefined.js index 0f05d78629219249be646c3dcddc47f70c171ee5..fce94ee815c05e334cf320ea4d6b33a91eaa3e2d 100644 --- a/test/language/expressions/function/params-dflt-arg-val-undefined.js +++ b/test/language/expressions/function/params-dflt-arg-val-undefined.js @@ -54,14 +54,15 @@ info: | ---*/ var callCount = 0; -var f; -f = function(fromLiteral = 23, fromExpr = 45, fromHole = 99) { +// Stores a reference `ref` for case evaluation +var ref; +ref = function(fromLiteral = 23, fromExpr = 45, fromHole = 99) { assert.sameValue(fromLiteral, 23); assert.sameValue(fromExpr, 45); assert.sameValue(fromHole, 99); callCount = callCount + 1; }; -f(undefined, void 0); +ref(undefined, void 0); assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/test/language/expressions/function/params-dflt-ref-prior.js b/test/language/expressions/function/params-dflt-ref-prior.js index 2e9601fa7e477b77d0a424b0abbb88b379bb16d0..5f57f3c3a8ded9fa5981a795fcfd1bc9d9891b83 100644 --- a/test/language/expressions/function/params-dflt-ref-prior.js +++ b/test/language/expressions/function/params-dflt-ref-prior.js @@ -51,14 +51,15 @@ info: | var x = 0; var callCount = 0; -var f; -f = function(x, y = x, z = y) { +// Stores a reference `ref` for case evaluation +var ref; +ref = function(x, y = x, z = y) { assert.sameValue(x, 3, 'first argument value'); assert.sameValue(y, 3, 'second argument value'); assert.sameValue(z, 3, 'third argument value'); callCount = callCount + 1; }; -f(3); +ref(3); assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/test/language/expressions/function/params-trailing-comma-dflt-param.js b/test/language/expressions/function/params-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..0efe0350d186ba49b88299cf83e93d92ab30bdc4 --- /dev/null +++ b/test/language/expressions/function/params-trailing-comma-dflt-param.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +es6id: 14.1.20 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, undefined, 1); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/function/params-trailing-comma-multiple-param.js b/test/language/expressions/function/params-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..74b5258f25c66c60a19e25d715b7dbf94ca2d9fc --- /dev/null +++ b/test/language/expressions/function/params-trailing-comma-multiple-param.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +es6id: 14.1.20 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, 39, 1); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/expressions/function/params-trailing-comma-rest-early-error.js b/test/language/expressions/function/params-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..00f17f165ba8b01deb3190754d80f1e457ad1a7a --- /dev/null +++ b/test/language/expressions/function/params-trailing-comma-rest-early-error.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/func-expr.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +es6id: 14.1.20 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +0, function(...a,) { + +}; diff --git a/test/language/expressions/function/params-trailing-comma-single-param.js b/test/language/expressions/function/params-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..f11f2f872dd533d56b78da22c6fb9f9929ce9088 --- /dev/null +++ b/test/language/expressions/function/params-trailing-comma-single-param.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (function expression) +esid: sec-function-definitions-runtime-semantics-evaluation +es6id: 14.1.20 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; +}; + +ref(42, 39); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/generators/params-dflt-arg-val-not-undefined.js b/test/language/expressions/generators/params-dflt-arg-val-not-undefined.js index f20a26357bf9392032c246752db380b23531b4ab..67186d3a80fc3d87dba20299971756c3cb7c59af 100644 --- a/test/language/expressions/generators/params-dflt-arg-val-not-undefined.js +++ b/test/language/expressions/generators/params-dflt-arg-val-not-undefined.js @@ -61,8 +61,9 @@ var nullCount = 0; var objCount = 0; var callCount = 0; -var f; -f = function*(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { assert.sameValue(aFalse, false); assert.sameValue(aString, ''); assert.sameValue(aNaN, NaN); @@ -72,7 +73,7 @@ f = function*(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCou callCount = callCount + 1; }; -f(false, '', NaN, 0, null, obj).next(); +ref(false, '', NaN, 0, null, obj).next(); assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/test/language/expressions/generators/params-dflt-arg-val-undefined.js b/test/language/expressions/generators/params-dflt-arg-val-undefined.js index a31c11965e29d74862038c9ff2f6b1fab41347ed..c4d328168a9aa7b9bb42aaf44a5c5011ffa6aa48 100644 --- a/test/language/expressions/generators/params-dflt-arg-val-undefined.js +++ b/test/language/expressions/generators/params-dflt-arg-val-undefined.js @@ -54,14 +54,15 @@ info: | ---*/ var callCount = 0; -var f; -f = function*(fromLiteral = 23, fromExpr = 45, fromHole = 99) { +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(fromLiteral = 23, fromExpr = 45, fromHole = 99) { assert.sameValue(fromLiteral, 23); assert.sameValue(fromExpr, 45); assert.sameValue(fromHole, 99); callCount = callCount + 1; }; -f(undefined, void 0).next(); +ref(undefined, void 0).next(); assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/test/language/expressions/generators/params-dflt-ref-prior.js b/test/language/expressions/generators/params-dflt-ref-prior.js index f0cb6d6cb7093531a1ecdbc443fab129430cf0c9..7bcc97d555d4611889fb9e0cf35347fa249f5625 100644 --- a/test/language/expressions/generators/params-dflt-ref-prior.js +++ b/test/language/expressions/generators/params-dflt-ref-prior.js @@ -51,14 +51,15 @@ info: | var x = 0; var callCount = 0; -var f; -f = function*(x, y = x, z = y) { +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(x, y = x, z = y) { assert.sameValue(x, 3, 'first argument value'); assert.sameValue(y, 3, 'second argument value'); assert.sameValue(z, 3, 'third argument value'); callCount = callCount + 1; }; -f(3).next(); +ref(3).next(); assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/test/language/expressions/generators/params-trailing-comma-dflt-param.js b/test/language/expressions/generators/params-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..168bea0a88aad9f315ffbd15d3ac1bb82a0308ee --- /dev/null +++ b/test/language/expressions/generators/params-trailing-comma-dflt-param.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/gen-func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, undefined, 1).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/generators/params-trailing-comma-multiple-param.js b/test/language/expressions/generators/params-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..3a88860dd8d7872bc91488e516948b1b833f3828 --- /dev/null +++ b/test/language/expressions/generators/params-trailing-comma-multiple-param.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/gen-func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +}; + +ref(42, 39, 1).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/expressions/generators/params-trailing-comma-rest-early-error.js b/test/language/expressions/generators/params-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..72d780b1fbc8eef788ca52f8d1cafd28add91193 --- /dev/null +++ b/test/language/expressions/generators/params-trailing-comma-rest-early-error.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/gen-func-expr.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +0, function*(...a,) { + +}; diff --git a/test/language/expressions/generators/params-trailing-comma-single-param.js b/test/language/expressions/generators/params-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..fdcf86ebcef4a71864be6bd5556111e9f9569800 --- /dev/null +++ b/test/language/expressions/generators/params-trailing-comma-single-param.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/gen-func-expr.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (generator function expression) +esid: sec-generator-function-definitions-runtime-semantics-evaluation +es6id: 14.4.14 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +var ref; +ref = function*(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; +}; + +ref(42, 39).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/object/method-definition/params-gen-meth-dflt-arg-val-not-undefined.js b/test/language/expressions/object/method-definition/params-gen-meth-dflt-arg-val-not-undefined.js index 42954aa25faf905ec36f7c5fc423f90ec3684cfc..c7657ec8ecf79cf09d77e24a03e438bf13c6feaa 100644 --- a/test/language/expressions/object/method-definition/params-gen-meth-dflt-arg-val-not-undefined.js +++ b/test/language/expressions/object/method-definition/params-gen-meth-dflt-arg-val-not-undefined.js @@ -80,6 +80,9 @@ var obj = { obj.method(false, '', NaN, 0, null, obj).next(); +// Stores a reference `ref` for case evaluation +var ref = obj.method; + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); diff --git a/test/language/expressions/object/method-definition/params-gen-meth-dflt-arg-val-undefined.js b/test/language/expressions/object/method-definition/params-gen-meth-dflt-arg-val-undefined.js index f8dae01ee1214fdb3fcb5f2b90f85f3bc7bb5d50..8f745ea1aa1fe8c307d5a3754438c78f8e309fcd 100644 --- a/test/language/expressions/object/method-definition/params-gen-meth-dflt-arg-val-undefined.js +++ b/test/language/expressions/object/method-definition/params-gen-meth-dflt-arg-val-undefined.js @@ -70,4 +70,7 @@ var obj = { obj.method(undefined, void 0).next(); +// Stores a reference `ref` for case evaluation +var ref = obj.method; + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/test/language/expressions/object/method-definition/params-gen-meth-dflt-ref-prior.js b/test/language/expressions/object/method-definition/params-gen-meth-dflt-ref-prior.js index 91c3f8e27c727eb9e0a1bab58088ed83a2420956..ea90ea918cb4cf29457152af054364857dba96fb 100644 --- a/test/language/expressions/object/method-definition/params-gen-meth-dflt-ref-prior.js +++ b/test/language/expressions/object/method-definition/params-gen-meth-dflt-ref-prior.js @@ -67,4 +67,7 @@ var obj = { obj.method(3).next(); +// Stores a reference `ref` for case evaluation +var ref = obj.method; + assert.sameValue(callCount, 1, 'generator method invoked exactly once'); diff --git a/test/language/expressions/object/method-definition/params-gen-meth-trailing-comma-dflt-param.js b/test/language/expressions/object/method-definition/params-gen-meth-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..66c2c44563586d19fb7737b627ddfe98ece24064 --- /dev/null +++ b/test/language/expressions/object/method-definition/params-gen-meth-trailing-comma-dflt-param.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +es6id: 14.4.13 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + *method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +obj.method(42, undefined, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/object/method-definition/params-gen-meth-trailing-comma-multiple-param.js b/test/language/expressions/object/method-definition/params-gen-meth-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..15c4dff643fceea3a9030a8bc6d16916085d8453 --- /dev/null +++ b/test/language/expressions/object/method-definition/params-gen-meth-trailing-comma-multiple-param.js @@ -0,0 +1,69 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +es6id: 14.4.13 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + *method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +obj.method(42, 39, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/expressions/object/method-definition/params-gen-meth-trailing-comma-rest-early-error.js b/test/language/expressions/object/method-definition/params-gen-meth-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..2c2dc0ea0377e40275155b041cb0f10771ea6e8b --- /dev/null +++ b/test/language/expressions/object/method-definition/params-gen-meth-trailing-comma-rest-early-error.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/gen-meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +es6id: 14.4.13 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +0, { + *method(...a,) { + + } +}; diff --git a/test/language/expressions/object/method-definition/params-gen-meth-trailing-comma-single-param.js b/test/language/expressions/object/method-definition/params-gen-meth-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..499296034e1a8e996a8ab8a6a1f26d2c8229cb21 --- /dev/null +++ b/test/language/expressions/object/method-definition/params-gen-meth-trailing-comma-single-param.js @@ -0,0 +1,68 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (generator method) +esid: sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation +es6id: 14.4.13 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + *method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +obj.method(42, 39).next(); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'generator method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/object/method-definition/params-meth-dflt-arg-val-not-undefined.js b/test/language/expressions/object/method-definition/params-meth-dflt-arg-val-not-undefined.js index edbdc988e7960f0ae213310c73414eacb4973cd6..9a8dea759a14dab66ba8028c14f90711e66ac5b6 100644 --- a/test/language/expressions/object/method-definition/params-meth-dflt-arg-val-not-undefined.js +++ b/test/language/expressions/object/method-definition/params-meth-dflt-arg-val-not-undefined.js @@ -77,6 +77,9 @@ var obj = { obj.method(false, '', NaN, 0, null, obj); +// Stores a reference `ref` for case evaluation +var ref = obj.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); diff --git a/test/language/expressions/object/method-definition/params-meth-dflt-arg-val-undefined.js b/test/language/expressions/object/method-definition/params-meth-dflt-arg-val-undefined.js index 70a8538f8f1cc5b9be544badcb06b92355a1bc7b..1d28dfd8aa2b6277c63f97828491e44eb32ad462 100644 --- a/test/language/expressions/object/method-definition/params-meth-dflt-arg-val-undefined.js +++ b/test/language/expressions/object/method-definition/params-meth-dflt-arg-val-undefined.js @@ -67,4 +67,7 @@ var obj = { obj.method(undefined, void 0); +// Stores a reference `ref` for case evaluation +var ref = obj.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/expressions/object/method-definition/params-meth-dflt-ref-prior.js b/test/language/expressions/object/method-definition/params-meth-dflt-ref-prior.js index 7ae927f3df606505cd77879575480e7a5e159dac..3fa1ed96031a0a08d25d493f0f6946d3943d4462 100644 --- a/test/language/expressions/object/method-definition/params-meth-dflt-ref-prior.js +++ b/test/language/expressions/object/method-definition/params-meth-dflt-ref-prior.js @@ -64,4 +64,7 @@ var obj = { obj.method(3); +// Stores a reference `ref` for case evaluation +var ref = obj.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/expressions/object/method-definition/params-meth-trailing-comma-dflt-param.js b/test/language/expressions/object/method-definition/params-meth-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..3b5dabe7d93ac9735423753c6d5707f70ddce6d6 --- /dev/null +++ b/test/language/expressions/object/method-definition/params-meth-trailing-comma-dflt-param.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (method) +esid: sec-runtime-semantics-definemethod +es6id: 14.3.8 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +obj.method(42, undefined, 1); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/expressions/object/method-definition/params-meth-trailing-comma-multiple-param.js b/test/language/expressions/object/method-definition/params-meth-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..2c7a740106351b3ff6cb8698af5330efd2662eeb --- /dev/null +++ b/test/language/expressions/object/method-definition/params-meth-trailing-comma-multiple-param.js @@ -0,0 +1,66 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (method) +esid: sec-runtime-semantics-definemethod +es6id: 14.3.8 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +}; + +obj.method(42, 39, 1); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/expressions/object/method-definition/params-meth-trailing-comma-rest-early-error.js b/test/language/expressions/object/method-definition/params-meth-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..16bb72dca1cb907ad30933d063ca21469848b030 --- /dev/null +++ b/test/language/expressions/object/method-definition/params-meth-trailing-comma-rest-early-error.js @@ -0,0 +1,62 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (method) +esid: sec-runtime-semantics-definemethod +es6id: 14.3.8 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +0, { + method(...a,) { + + } +}; diff --git a/test/language/expressions/object/method-definition/params-meth-trailing-comma-single-param.js b/test/language/expressions/object/method-definition/params-meth-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..44d366120aa54a0d391e1ff2cebd1a0c66094d38 --- /dev/null +++ b/test/language/expressions/object/method-definition/params-meth-trailing-comma-single-param.js @@ -0,0 +1,65 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (method) +esid: sec-runtime-semantics-definemethod +es6id: 14.3.8 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +var obj = { + method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +}; + +obj.method(42, 39); + +// Stores a reference `ref` for case evaluation +var ref = obj.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/statements/class/params-gen-meth-dflt-arg-val-not-undefined.js b/test/language/statements/class/params-gen-meth-dflt-arg-val-not-undefined.js index 532a0325dfafc5527ae4c52a6bda77ea32578fdf..85db41c299c087feff2a9ff1938c01893c62b69e 100644 --- a/test/language/statements/class/params-gen-meth-dflt-arg-val-not-undefined.js +++ b/test/language/statements/class/params-gen-meth-dflt-arg-val-not-undefined.js @@ -96,6 +96,9 @@ class C { C.prototype.method(false, '', NaN, 0, null, obj).next(); +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); diff --git a/test/language/statements/class/params-gen-meth-dflt-arg-val-undefined.js b/test/language/statements/class/params-gen-meth-dflt-arg-val-undefined.js index fb1556a27ff3a387e4a384edbc709446c6a32b0e..2cdbd15aeb451cff298079c1fb1a5c055456e2e0 100644 --- a/test/language/statements/class/params-gen-meth-dflt-arg-val-undefined.js +++ b/test/language/statements/class/params-gen-meth-dflt-arg-val-undefined.js @@ -86,4 +86,7 @@ class C { C.prototype.method(undefined, void 0).next(); +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/statements/class/params-gen-meth-dflt-ref-prior.js b/test/language/statements/class/params-gen-meth-dflt-ref-prior.js index 6215260734f715cf83809988d6a1eedbb0c0ece7..f5531bcde7a6a94084a7c91d95f4d3a92946129d 100644 --- a/test/language/statements/class/params-gen-meth-dflt-ref-prior.js +++ b/test/language/statements/class/params-gen-meth-dflt-ref-prior.js @@ -83,4 +83,7 @@ class C { C.prototype.method(3).next(); +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/statements/class/params-gen-meth-static-dflt-arg-val-not-undefined.js b/test/language/statements/class/params-gen-meth-static-dflt-arg-val-not-undefined.js index 2663e0c26e2d6e07461ad97db20cb219d61a12f5..35565f1fdf8d71770fc3a4ef3f6f265ee49871be 100644 --- a/test/language/statements/class/params-gen-meth-static-dflt-arg-val-not-undefined.js +++ b/test/language/statements/class/params-gen-meth-static-dflt-arg-val-not-undefined.js @@ -96,6 +96,9 @@ class C { C.method(false, '', NaN, 0, null, obj).next(); +// Stores a reference `ref` for case evaluation +var ref = C.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); diff --git a/test/language/statements/class/params-gen-meth-static-dflt-arg-val-undefined.js b/test/language/statements/class/params-gen-meth-static-dflt-arg-val-undefined.js index e9d90bd5c2fcd3e9254444700897e7288ed413a0..e9f6c788d1a0a701e0c285a5890b282283fd2ac7 100644 --- a/test/language/statements/class/params-gen-meth-static-dflt-arg-val-undefined.js +++ b/test/language/statements/class/params-gen-meth-static-dflt-arg-val-undefined.js @@ -86,4 +86,7 @@ class C { C.method(undefined, void 0).next(); +// Stores a reference `ref` for case evaluation +var ref = C.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/statements/class/params-gen-meth-static-dflt-ref-prior.js b/test/language/statements/class/params-gen-meth-static-dflt-ref-prior.js index 84912b3060925ada571313f0cf60e8f067ddc594..9b052c82c09bf8205cd9c07d414db3451645fdef 100644 --- a/test/language/statements/class/params-gen-meth-static-dflt-ref-prior.js +++ b/test/language/statements/class/params-gen-meth-static-dflt-ref-prior.js @@ -83,4 +83,7 @@ class C { C.method(3).next(); +// Stores a reference `ref` for case evaluation +var ref = C.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/statements/class/params-gen-meth-static-trailing-comma-dflt-param.js b/test/language/statements/class/params-gen-meth-static-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..538373d95ffae2352b7ec74da58a5f7d8e05b45f --- /dev/null +++ b/test/language/statements/class/params-gen-meth-static-trailing-comma-dflt-param.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/cls-decl-gen-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (static class expression generator method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +class C { + static *method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +C.method(42, undefined, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/statements/class/params-gen-meth-static-trailing-comma-multiple-param.js b/test/language/statements/class/params-gen-meth-static-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..d6ca9b64c9ee89ad175f302bdf0c19ad04f32328 --- /dev/null +++ b/test/language/statements/class/params-gen-meth-static-trailing-comma-multiple-param.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/cls-decl-gen-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (static class expression generator method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +class C { + static *method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +C.method(42, 39, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/statements/class/params-gen-meth-static-trailing-comma-rest-early-error.js b/test/language/statements/class/params-gen-meth-static-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..ee4459fda96afda2ff7ceae9f7e27053270d2da3 --- /dev/null +++ b/test/language/statements/class/params-gen-meth-static-trailing-comma-rest-early-error.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/cls-decl-gen-meth-static.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class expression generator method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +class C { + static *method(...a,) { + + } +} diff --git a/test/language/statements/class/params-gen-meth-static-trailing-comma-single-param.js b/test/language/statements/class/params-gen-meth-static-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..2d9b91451d46693ee53e0ea2f0017704afbcc366 --- /dev/null +++ b/test/language/statements/class/params-gen-meth-static-trailing-comma-single-param.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/cls-decl-gen-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (static class expression generator method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +class C { + static *method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +} + +C.method(42, 39).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/statements/class/params-gen-meth-trailing-comma-dflt-param.js b/test/language/statements/class/params-gen-meth-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..138089140aa8561c176fea2b4aba7f9b83dba519 --- /dev/null +++ b/test/language/statements/class/params-gen-meth-trailing-comma-dflt-param.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/cls-decl-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +class C { + *method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +C.prototype.method(42, undefined, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/statements/class/params-gen-meth-trailing-comma-multiple-param.js b/test/language/statements/class/params-gen-meth-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..fca88318d06b757a4c24f1fd05d9cb2ccb5637d5 --- /dev/null +++ b/test/language/statements/class/params-gen-meth-trailing-comma-multiple-param.js @@ -0,0 +1,85 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/cls-decl-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +class C { + *method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +C.prototype.method(42, 39, 1).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/statements/class/params-gen-meth-trailing-comma-rest-early-error.js b/test/language/statements/class/params-gen-meth-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..52658dd36877209da56c3047f45be076ae9383bd --- /dev/null +++ b/test/language/statements/class/params-gen-meth-trailing-comma-rest-early-error.js @@ -0,0 +1,81 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/cls-decl-gen-meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +class C { + *method(...a,) { + + } +} diff --git a/test/language/statements/class/params-gen-meth-trailing-comma-single-param.js b/test/language/statements/class/params-gen-meth-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..7122abdfb19a9ccf8898a5a01e87fc0f5a08bc9b --- /dev/null +++ b/test/language/statements/class/params-gen-meth-trailing-comma-single-param.js @@ -0,0 +1,84 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/cls-decl-gen-meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (class expression method) +esid: sec-class-definitions-runtime-semantics-evaluation +es6id: 14.5.16 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +class C { + *method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +} + +C.prototype.method(42, 39).next(); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/statements/class/params-meth-dflt-arg-val-not-undefined.js b/test/language/statements/class/params-meth-dflt-arg-val-not-undefined.js index 54abd9ccc169dcdddfe7a5a30f84d5c641e7ed41..a407a3d8e10c8cfb65ea6b3decefc53aae08e4b1 100644 --- a/test/language/statements/class/params-meth-dflt-arg-val-not-undefined.js +++ b/test/language/statements/class/params-meth-dflt-arg-val-not-undefined.js @@ -94,6 +94,9 @@ class C { C.prototype.method(false, '', NaN, 0, null, obj); +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); diff --git a/test/language/statements/class/params-meth-dflt-arg-val-undefined.js b/test/language/statements/class/params-meth-dflt-arg-val-undefined.js index 58125897765eadf66a0c6c96d393753f1e88e38b..c069432fce86b11e9c2d6b1659cf8ac11c8f1906 100644 --- a/test/language/statements/class/params-meth-dflt-arg-val-undefined.js +++ b/test/language/statements/class/params-meth-dflt-arg-val-undefined.js @@ -84,4 +84,7 @@ class C { C.prototype.method(undefined, void 0); +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/statements/class/params-meth-dflt-ref-prior.js b/test/language/statements/class/params-meth-dflt-ref-prior.js index ab52842d5643490f44ee0c6b4f8c35d1080a3889..de033f27d5c561dde1409ed78a98ff0c4ee06065 100644 --- a/test/language/statements/class/params-meth-dflt-ref-prior.js +++ b/test/language/statements/class/params-meth-dflt-ref-prior.js @@ -81,4 +81,7 @@ class C { C.prototype.method(3); +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/statements/class/params-meth-static-dflt-arg-val-not-undefined.js b/test/language/statements/class/params-meth-static-dflt-arg-val-not-undefined.js index b15ade83544442dae06fbac6ba8abe359f522c9b..fdd20d47114e8d566a9d7dbabc11e55c98d1543a 100644 --- a/test/language/statements/class/params-meth-static-dflt-arg-val-not-undefined.js +++ b/test/language/statements/class/params-meth-static-dflt-arg-val-not-undefined.js @@ -94,6 +94,9 @@ class C { C.method(false, '', NaN, 0, null, obj); +// Stores a reference `ref` for case evaluation +var ref = C.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); assert.sameValue(falseCount, 0, 'initializer not evaluated: false'); diff --git a/test/language/statements/class/params-meth-static-dflt-arg-val-undefined.js b/test/language/statements/class/params-meth-static-dflt-arg-val-undefined.js index 1be4da47e671ed893a40914e37a13c819d1d508e..a3a8058c1102131553f7bc4f142cdf1b0f07824f 100644 --- a/test/language/statements/class/params-meth-static-dflt-arg-val-undefined.js +++ b/test/language/statements/class/params-meth-static-dflt-arg-val-undefined.js @@ -84,4 +84,7 @@ class C { C.method(undefined, void 0); +// Stores a reference `ref` for case evaluation +var ref = C.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/statements/class/params-meth-static-dflt-ref-prior.js b/test/language/statements/class/params-meth-static-dflt-ref-prior.js index 2f827d3e387418693cc4755b9c264543612e46c6..5a40559bf157fa4a5ba655152403b63af8f81180 100644 --- a/test/language/statements/class/params-meth-static-dflt-ref-prior.js +++ b/test/language/statements/class/params-meth-static-dflt-ref-prior.js @@ -81,4 +81,7 @@ class C { C.method(3); +// Stores a reference `ref` for case evaluation +var ref = C.method; + assert.sameValue(callCount, 1, 'method invoked exactly once'); diff --git a/test/language/statements/class/params-meth-static-trailing-comma-dflt-param.js b/test/language/statements/class/params-meth-static-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..2cebf2c45eff5d482c164918e3982caf60b35056 --- /dev/null +++ b/test/language/statements/class/params-meth-static-trailing-comma-dflt-param.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/cls-decl-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (static class expression method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +class C { + static method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +C.method(42, undefined, 1); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/statements/class/params-meth-static-trailing-comma-multiple-param.js b/test/language/statements/class/params-meth-static-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..dedc564c25e3740f9d480737063c72b13fa8f412 --- /dev/null +++ b/test/language/statements/class/params-meth-static-trailing-comma-multiple-param.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/cls-decl-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (static class expression method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +class C { + static method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +C.method(42, 39, 1); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/statements/class/params-meth-static-trailing-comma-rest-early-error.js b/test/language/statements/class/params-meth-static-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..37f99374bd3cf0b48cd71dd0522f5f1253be8019 --- /dev/null +++ b/test/language/statements/class/params-meth-static-trailing-comma-rest-early-error.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/cls-decl-meth-static.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class expression method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +class C { + static method(...a,) { + + } +} diff --git a/test/language/statements/class/params-meth-static-trailing-comma-single-param.js b/test/language/statements/class/params-meth-static-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..c27a4bd40d0fc2dd52e552f3acdee4875e27358f --- /dev/null +++ b/test/language/statements/class/params-meth-static-trailing-comma-single-param.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/cls-decl-meth-static.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (static class expression method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +class C { + static method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +} + +C.method(42, 39); + +// Stores a reference `ref` for case evaluation +var ref = C.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/statements/class/params-meth-trailing-comma-dflt-param.js b/test/language/statements/class/params-meth-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..9d7d73d21b0b45e82333297eb1e12197354de269 --- /dev/null +++ b/test/language/statements/class/params-meth-trailing-comma-dflt-param.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/cls-decl-meth.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (class expression method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +class C { + method(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +C.prototype.method(42, undefined, 1); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/statements/class/params-meth-trailing-comma-multiple-param.js b/test/language/statements/class/params-meth-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..d94dd4afcaa65acaf34133f4a28439488104c9fb --- /dev/null +++ b/test/language/statements/class/params-meth-trailing-comma-multiple-param.js @@ -0,0 +1,83 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/cls-decl-meth.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (class expression method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +class C { + method(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; + } +} + +C.prototype.method(42, 39, 1); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/statements/class/params-meth-trailing-comma-rest-early-error.js b/test/language/statements/class/params-meth-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..4294a1aa8b0b680b685ff5a14af999da4fce1ef2 --- /dev/null +++ b/test/language/statements/class/params-meth-trailing-comma-rest-early-error.js @@ -0,0 +1,79 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/cls-decl-meth.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +class C { + method(...a,) { + + } +} diff --git a/test/language/statements/class/params-meth-trailing-comma-single-param.js b/test/language/statements/class/params-meth-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..415db35db528a959c24e55dfc15bfe0759808943 --- /dev/null +++ b/test/language/statements/class/params-meth-trailing-comma-single-param.js @@ -0,0 +1,82 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/cls-decl-meth.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (class expression method) +esid: sec-runtime-semantics-bindingclassdeclarationevaluation +es6id: 14.5.15 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +class C { + method(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; + } +} + +C.prototype.method(42, 39); + +// Stores a reference `ref` for case evaluation +var ref = C.prototype.method; + +assert.sameValue(callCount, 1, 'method invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/statements/function/params-dflt-arg-val-not-undefined.js b/test/language/statements/function/params-dflt-arg-val-not-undefined.js index 7b5244dfdf13ace5a4daace59e2638093ce6ce18..5b0312659b9f80851347653e870b2d4795eba9ec 100644 --- a/test/language/statements/function/params-dflt-arg-val-not-undefined.js +++ b/test/language/statements/function/params-dflt-arg-val-not-undefined.js @@ -62,7 +62,8 @@ var nullCount = 0; var objCount = 0; var callCount = 0; -function f(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { +// Stores a reference `ref` for case evaluation +function ref(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { assert.sameValue(aFalse, false); assert.sameValue(aString, ''); assert.sameValue(aNaN, NaN); @@ -72,7 +73,7 @@ function f(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount callCount = callCount + 1; } -f(false, '', NaN, 0, null, obj); +ref(false, '', NaN, 0, null, obj); assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/test/language/statements/function/params-dflt-arg-val-undefined.js b/test/language/statements/function/params-dflt-arg-val-undefined.js index 0486e5ae74c9b2be6393c308e10aa75a3641cab6..52ac16f96b5babe2e09d5acbc70f7ed676400b72 100644 --- a/test/language/statements/function/params-dflt-arg-val-undefined.js +++ b/test/language/statements/function/params-dflt-arg-val-undefined.js @@ -55,13 +55,14 @@ info: | ---*/ var callCount = 0; -function f(fromLiteral = 23, fromExpr = 45, fromHole = 99) { +// Stores a reference `ref` for case evaluation +function ref(fromLiteral = 23, fromExpr = 45, fromHole = 99) { assert.sameValue(fromLiteral, 23); assert.sameValue(fromExpr, 45); assert.sameValue(fromHole, 99); callCount = callCount + 1; } -f(undefined, void 0); +ref(undefined, void 0); assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/test/language/statements/function/params-dflt-ref-prior.js b/test/language/statements/function/params-dflt-ref-prior.js index 597692de3d7a89311f7d5b4ef63bdb2070713d38..6abe926cd1407ff8a603bdea6aa857414226268d 100644 --- a/test/language/statements/function/params-dflt-ref-prior.js +++ b/test/language/statements/function/params-dflt-ref-prior.js @@ -52,13 +52,14 @@ info: | var x = 0; var callCount = 0; -function f(x, y = x, z = y) { +// Stores a reference `ref` for case evaluation +function ref(x, y = x, z = y) { assert.sameValue(x, 3, 'first argument value'); assert.sameValue(y, 3, 'second argument value'); assert.sameValue(z, 3, 'third argument value'); callCount = callCount + 1; } -f(3); +ref(3); assert.sameValue(callCount, 1, 'function invoked exactly once'); diff --git a/test/language/statements/function/params-trailing-comma-dflt-param.js b/test/language/statements/function/params-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..c266163d520fdd967f30c72cd269e2f8fe982def --- /dev/null +++ b/test/language/statements/function/params-trailing-comma-dflt-param.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/func-decl.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (function declaration) +esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.1.19 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +function ref(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +} + +ref(42, undefined, 1); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/statements/function/params-trailing-comma-multiple-param.js b/test/language/statements/function/params-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..db6a1ce4c2bfa22a210112dd6d39830164ba64ec --- /dev/null +++ b/test/language/statements/function/params-trailing-comma-multiple-param.js @@ -0,0 +1,61 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/func-decl.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (function declaration) +esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.1.19 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +function ref(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +} + +ref(42, 39, 1); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/statements/function/params-trailing-comma-rest-early-error.js b/test/language/statements/function/params-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..6a3e82315c5f5e6db9899e6c69df1e964bfdcce5 --- /dev/null +++ b/test/language/statements/function/params-trailing-comma-rest-early-error.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/func-decl.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (function declaration) +esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.1.19 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +function f(...a,) { + +} diff --git a/test/language/statements/function/params-trailing-comma-single-param.js b/test/language/statements/function/params-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..737d0ccaa9146395443721f46f5ea98dc03dad70 --- /dev/null +++ b/test/language/statements/function/params-trailing-comma-single-param.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/func-decl.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (function declaration) +esid: sec-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.1.19 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +function ref(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; +} + +ref(42, 39); + +assert.sameValue(callCount, 1, 'function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/statements/generators/params-dflt-arg-val-not-undefined.js b/test/language/statements/generators/params-dflt-arg-val-not-undefined.js index 1208267a2e7065c18ca87ad08f4bfe0170eb9c61..a910b31a98aa47b34fbc491e68d1248fc0efc48c 100644 --- a/test/language/statements/generators/params-dflt-arg-val-not-undefined.js +++ b/test/language/statements/generators/params-dflt-arg-val-not-undefined.js @@ -61,7 +61,8 @@ var nullCount = 0; var objCount = 0; var callCount = 0; -function* f(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { +// Stores a reference `ref` for case evaluation +function* ref(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount += 1, a0 = zeroCount += 1, aNull = nullCount += 1, aObj = objCount +=1) { assert.sameValue(aFalse, false); assert.sameValue(aString, ''); assert.sameValue(aNaN, NaN); @@ -71,7 +72,7 @@ function* f(aFalse = falseCount +=1, aString = stringCount += 1, aNaN = nanCount callCount = callCount + 1; } -f(false, '', NaN, 0, null, obj).next(); +ref(false, '', NaN, 0, null, obj).next(); assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/test/language/statements/generators/params-dflt-arg-val-undefined.js b/test/language/statements/generators/params-dflt-arg-val-undefined.js index 19623e5fb816a2a9a3eb102aeeaa460f81daef21..69c553aa7a23e1f4ad63057c294e98a761ce79d6 100644 --- a/test/language/statements/generators/params-dflt-arg-val-undefined.js +++ b/test/language/statements/generators/params-dflt-arg-val-undefined.js @@ -54,13 +54,14 @@ info: | ---*/ var callCount = 0; -function* f(fromLiteral = 23, fromExpr = 45, fromHole = 99) { +// Stores a reference `ref` for case evaluation +function* ref(fromLiteral = 23, fromExpr = 45, fromHole = 99) { assert.sameValue(fromLiteral, 23); assert.sameValue(fromExpr, 45); assert.sameValue(fromHole, 99); callCount = callCount + 1; } -f(undefined, void 0).next(); +ref(undefined, void 0).next(); assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/test/language/statements/generators/params-dflt-ref-prior.js b/test/language/statements/generators/params-dflt-ref-prior.js index 687741166db7be0c513208033726335142066020..e00c5ea39219552ad626ea4846c2bc6d58b756fa 100644 --- a/test/language/statements/generators/params-dflt-ref-prior.js +++ b/test/language/statements/generators/params-dflt-ref-prior.js @@ -51,13 +51,14 @@ info: | var x = 0; var callCount = 0; -function* f(x, y = x, z = y) { +// Stores a reference `ref` for case evaluation +function* ref(x, y = x, z = y) { assert.sameValue(x, 3, 'first argument value'); assert.sameValue(y, 3, 'second argument value'); assert.sameValue(z, 3, 'third argument value'); callCount = callCount + 1; } -f(3).next(); +ref(3).next(); assert.sameValue(callCount, 1, 'generator function invoked exactly once'); diff --git a/test/language/statements/generators/params-trailing-comma-dflt-param.js b/test/language/statements/generators/params-trailing-comma-dflt-param.js new file mode 100644 index 0000000000000000000000000000000000000000..e8898caf4a44d32af2ae16b36cfeb8e3c3b83257 --- /dev/null +++ b/test/language/statements/generators/params-trailing-comma-dflt-param.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-dflt-param.case +// - src/params/default/gen-func-decl.template +/*--- +description: A trailing comma should not increase the respective length, using default parameters (generator function declaration) +esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.4.12 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +function* ref(a, b = 39,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +} + +ref(42, undefined, 1).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set'); diff --git a/test/language/statements/generators/params-trailing-comma-multiple-param.js b/test/language/statements/generators/params-trailing-comma-multiple-param.js new file mode 100644 index 0000000000000000000000000000000000000000..a5a46cb50aa81d2d2f2a0294d00e8f0f09afcf66 --- /dev/null +++ b/test/language/statements/generators/params-trailing-comma-multiple-param.js @@ -0,0 +1,60 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-multiple-param.case +// - src/params/default/gen-func-decl.template +/*--- +description: A trailing comma should not increase the respective length, using multiple parameters (generator function declaration) +esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.4.12 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +function* ref(a, b,) { + assert.sameValue(a, 42); + assert.sameValue(b, 39); + callCount = callCount + 1; +} + +ref(42, 39, 1).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +assert.sameValue(ref.length, 2, 'length is properly set'); diff --git a/test/language/statements/generators/params-trailing-comma-rest-early-error.js b/test/language/statements/generators/params-trailing-comma-rest-early-error.js new file mode 100644 index 0000000000000000000000000000000000000000..3fe5a33a697644ad099bb11a48ec6443688df4fc --- /dev/null +++ b/test/language/statements/generators/params-trailing-comma-rest-early-error.js @@ -0,0 +1,58 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-rest-early-error.case +// - src/params/syntax/gen-func-decl.template +/*--- +description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (generator function declaration) +esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.4.12 +features: [default-parameters] +flags: [generated] +negative: + phase: early + type: SyntaxError +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : + [empty] + FunctionRestParameter[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] + FormalParameterList[?Yield, ?Await] , + FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] +---*/ + +function* f(...a,) { + +} diff --git a/test/language/statements/generators/params-trailing-comma-single-param.js b/test/language/statements/generators/params-trailing-comma-single-param.js new file mode 100644 index 0000000000000000000000000000000000000000..8d26691060abedf3bb6fc8be75d65a35e76de1ad --- /dev/null +++ b/test/language/statements/generators/params-trailing-comma-single-param.js @@ -0,0 +1,59 @@ +// This file was procedurally generated from the following sources: +// - src/params/trailing-comma-single-param.case +// - src/params/default/gen-func-decl.template +/*--- +description: A trailing comma should not increase the respective length, using a single parameter (generator function declaration) +esid: sec-generator-function-definitions-runtime-semantics-instantiatefunctionobject +es6id: 14.4.12 +features: [default-parameters] +flags: [generated] +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. + [...] + + Trailing comma in the parameters list + + 14.1 Function Definitions + + FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] , +---*/ + +var callCount = 0; +// Stores a reference `ref` for case evaluation +function* ref(a,) { + assert.sameValue(a, 42); + callCount = callCount + 1; +} + +ref(42, 39).next(); + +assert.sameValue(callCount, 1, 'generator function invoked exactly once'); + +assert.sameValue(ref.length, 1, 'length is properly set');