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