rest-params-trailing-comma-early-error.js (2499B)
1 // |reftest| error:SyntaxError 2 // This file was procedurally generated from the following sources: 3 // - src/function-forms/rest-params-trailing-comma-early-error.case 4 // - src/function-forms/syntax/cls-decl-meth.template 5 /*--- 6 description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (class expression method) 7 esid: sec-runtime-semantics-bindingclassdeclarationevaluation 8 flags: [generated] 9 negative: 10 phase: parse 11 type: SyntaxError 12 info: | 13 ClassDeclaration : class BindingIdentifier ClassTail 14 15 1. Let className be StringValue of BindingIdentifier. 16 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with 17 argument className. 18 [...] 19 20 14.5.14 Runtime Semantics: ClassDefinitionEvaluation 21 22 21. For each ClassElement m in order from methods 23 a. If IsStatic of m is false, then 24 i. Let status be the result of performing 25 PropertyDefinitionEvaluation for m with arguments proto and 26 false. 27 [...] 28 29 14.3.8 Runtime Semantics: DefineMethod 30 31 MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody } 32 33 [...] 34 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody, 35 scope, strict). If functionPrototype was passed as a parameter then pass its 36 value as the functionPrototype optional argument of FunctionCreate. 37 [...] 38 39 9.2.1 [[Call]] ( thisArgument, argumentsList) 40 41 [...] 42 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). 43 [...] 44 45 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) 46 47 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). 48 [...] 49 50 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) 51 52 [...] 53 23. Let iteratorRecord be Record {[[iterator]]: 54 CreateListIterator(argumentsList), [[done]]: false}. 55 24. If hasDuplicates is true, then 56 [...] 57 25. Else, 58 b. Let formalStatus be IteratorBindingInitialization for formals with 59 iteratorRecord and env as arguments. 60 [...] 61 62 Trailing comma in the parameters list 63 64 14.1 Function Definitions 65 66 FormalParameters[Yield, Await] : 67 [empty] 68 FunctionRestParameter[?Yield, ?Await] 69 FormalParameterList[?Yield, ?Await] 70 FormalParameterList[?Yield, ?Await] , 71 FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] 72 ---*/ 73 $DONOTEVALUATE(); 74 75 class C { 76 method(...a,) { 77 78 } 79 }