rest-params-trailing-comma-early-error.js (2808B)
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-expr-gen-meth-static.template 5 /*--- 6 description: It's a syntax error if a FunctionRestParameter is followed by a trailing comma (static class expression generator method) 7 esid: sec-class-definitions-runtime-semantics-evaluation 8 features: [generators] 9 flags: [generated] 10 negative: 11 phase: parse 12 type: SyntaxError 13 info: | 14 ClassExpression : class BindingIdentifieropt ClassTail 15 16 1. If BindingIdentifieropt is not present, let className be undefined. 17 2. Else, let className be StringValue of BindingIdentifier. 18 3. Let value be the result of ClassDefinitionEvaluation of ClassTail 19 with argument className. 20 [...] 21 22 14.5.14 Runtime Semantics: ClassDefinitionEvaluation 23 24 21. For each ClassElement m in order from methods 25 a. If IsStatic of m is false, then 26 b. Else, 27 Let status be the result of performing PropertyDefinitionEvaluation 28 for m with arguments F and false. 29 [...] 30 31 14.4.13 Runtime Semantics: PropertyDefinitionEvaluation 32 33 GeneratorMethod : 34 * PropertyName ( StrictFormalParameters ) { GeneratorBody } 35 36 1. Let propKey be the result of evaluating PropertyName. 37 2. ReturnIfAbrupt(propKey). 38 3. If the function code for this GeneratorMethod is strict mode code, 39 let strict be true. Otherwise let strict be false. 40 4. Let scope be the running execution context's LexicalEnvironment. 41 5. Let closure be GeneratorFunctionCreate(Method, 42 StrictFormalParameters, GeneratorBody, scope, strict). 43 44 9.2.1 [[Call]] ( thisArgument, argumentsList) 45 46 [...] 47 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList). 48 [...] 49 50 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList ) 51 52 1. Let status be FunctionDeclarationInstantiation(F, argumentsList). 53 [...] 54 55 9.2.12 FunctionDeclarationInstantiation(func, argumentsList) 56 57 [...] 58 23. Let iteratorRecord be Record {[[iterator]]: 59 CreateListIterator(argumentsList), [[done]]: false}. 60 24. If hasDuplicates is true, then 61 [...] 62 25. Else, 63 b. Let formalStatus be IteratorBindingInitialization for formals with 64 iteratorRecord and env as arguments. 65 [...] 66 67 68 Trailing comma in the parameters list 69 70 14.1 Function Definitions 71 72 FormalParameters[Yield, Await] : 73 [empty] 74 FunctionRestParameter[?Yield, ?Await] 75 FormalParameterList[?Yield, ?Await] 76 FormalParameterList[?Yield, ?Await] , 77 FormalParameterList[?Yield, ?Await] , FunctionRestParameter[?Yield, ?Await] 78 ---*/ 79 $DONOTEVALUATE(); 80 81 0, class { 82 static *method(...a,) { 83 84 } 85 };