Debian Codegraph @

js/src/tests/test262/language/statements/class/method/dflt-params-trailing-comma.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/function-forms/dflt-params-trailing-comma.case
3 // - src/function-forms/default/cls-decl-meth.template
4 /*---
5 description: A trailing comma should not increase the respective length, using default parameters (class expression method)
6 esid: sec-runtime-semantics-bindingclassdeclarationevaluation
7 flags: [generated]
8 info: |
9 ClassDeclaration : class BindingIdentifier ClassTail
10
11 1. Let className be StringValue of BindingIdentifier.
12 2. Let value be the result of ClassDefinitionEvaluation of ClassTail with
13 argument className.
14 [...]
15
16 14.5.14 Runtime Semantics: ClassDefinitionEvaluation
17
18 21. For each ClassElement m in order from methods
19 a. If IsStatic of m is false, then
20 i. Let status be the result of performing
21 PropertyDefinitionEvaluation for m with arguments proto and
22 false.
23 [...]
24
25 14.3.8 Runtime Semantics: DefineMethod
26
27 MethodDefinition : PropertyName ( StrictFormalParameters ) { FunctionBody }
28
29 [...]
30 6. Let closure be FunctionCreate(kind, StrictFormalParameters, FunctionBody,
31 scope, strict). If functionPrototype was passed as a parameter then pass its
32 value as the functionPrototype optional argument of FunctionCreate.
33 [...]
34
35 9.2.1 [[Call]] ( thisArgument, argumentsList)
36
37 [...]
38 7. Let result be OrdinaryCallEvaluateBody(F, argumentsList).
39 [...]
40
41 9.2.1.3 OrdinaryCallEvaluateBody ( F, argumentsList )
42
43 1. Let status be FunctionDeclarationInstantiation(F, argumentsList).
44 [...]
45
46 9.2.12 FunctionDeclarationInstantiation(func, argumentsList)
47
48 [...]
49 23. Let iteratorRecord be Record {[[iterator]]:
50 CreateListIterator(argumentsList), [[done]]: false}.
51 24. If hasDuplicates is true, then
52 [...]
53 25. Else,
54 b. Let formalStatus be IteratorBindingInitialization for formals with
55 iteratorRecord and env as arguments.
56 [...]
57
58 Trailing comma in the parameters list
59
60 14.1 Function Definitions
61
62 FormalParameters[Yield, Await] : FormalParameterList[?Yield, ?Await] ,
63 ---*/
64
65 var callCount = 0;
66 class C {
67 method(a, b = 39,) {
68 assert.sameValue(a, 42);
69 assert.sameValue(b, 39);
70 callCount = callCount + 1;
71 }
72 }
73
74 C.prototype.method(42, undefined, 1);
75
76 // Stores a reference `ref` for case evaluation
77 var ref = C.prototype.method;
78
79 assert.sameValue(callCount, 1, 'method invoked exactly once');
80
81 assert.sameValue(ref.length, 1, 'length is properly set');
82
83 reportCompare(0, 0);