dflt-params-duplicates.js (2194B)
1 // |reftest| error:SyntaxError 2 // This file was procedurally generated from the following sources: 3 // - src/function-forms/dflt-params-duplicates.case 4 // - src/function-forms/syntax/cls-expr-async-meth-static.template 5 /*--- 6 description: It is a Syntax Error if BoundNames of FormalParameters contains any duplicate elements. (static class expression async method) 7 esid: sec-class-definitions-runtime-semantics-evaluation 8 features: [default-parameters] 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 Runtime Semantics: PropertyDefinitionEvaluation 32 33 AsyncMethod : async PropertyName ( UniqueFormalParameters ) { AsyncFunctionBody } 34 35 1. Let propKey be the result of evaluating PropertyName. 36 2. ReturnIfAbrupt(propKey). 37 3. If the function code for this AsyncMethod is strict mode code, let strict be true. Otherwise 38 let strict be false. 39 4. Let scope be the LexicalEnvironment of the running execution context. 40 5. Let closure be ! AsyncFunctionCreate(Method, UniqueFormalParameters, AsyncFunctionBody, 41 scope, strict). 42 [...] 43 44 45 14.1.2 Static Semantics: Early Errors 46 47 StrictFormalParameters : FormalParameters 48 49 - It is a Syntax Error if BoundNames of FormalParameters contains any 50 duplicate elements. 51 52 FormalParameters : FormalParameterList 53 54 - It is a Syntax Error if IsSimpleParameterList of FormalParameterList is 55 false and BoundNames of FormalParameterList contains any duplicate 56 elements. 57 58 ---*/ 59 $DONOTEVALUATE(); 60 61 var C = class { 62 static async method(x = 0, x) { 63 64 } 65 };