Debian Codegraph @

js/src/tests/test262/language/expressions/super/call-spread-mult-expr.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/spread/mult-expr.case
3 // - src/spread/default/super-call.template
4 /*---
5 description: Spread operator applied to AssignmentExpression following other elements (SuperCall)
6 esid: sec-super-keyword-runtime-semantics-evaluation
7 flags: [generated]
8 info: |
9 SuperCall : super Arguments
10
11 1. Let newTarget be GetNewTarget().
12 2. If newTarget is undefined, throw a ReferenceError exception.
13 3. Let func be GetSuperConstructor().
14 4. ReturnIfAbrupt(func).
15 5. Let argList be ArgumentListEvaluation of Arguments.
16 [...]
17
18 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
19
20 ArgumentList : ArgumentList , ... AssignmentExpression
21
22 1. Let precedingArgs be the result of evaluating ArgumentList.
23 2. Let spreadRef be the result of evaluating AssignmentExpression.
24 3. Let iterator be GetIterator(GetValue(spreadRef) ).
25 4. ReturnIfAbrupt(iterator).
26 5. Repeat
27 a. Let next be IteratorStep(iterator).
28 b. ReturnIfAbrupt(next).
29 c. If next is false, return precedingArgs.
30 ---*/
31 var source = [3, 4, 5];
32 var target;
33
34 var callCount = 0;
35
36 class Test262ParentClass {
37 constructor() {
38 assert.sameValue(arguments.length, 5);
39 assert.sameValue(arguments[0], 1);
40 assert.sameValue(arguments[1], 2);
41 assert.sameValue(arguments[2], 3);
42 assert.sameValue(arguments[3], 4);
43 assert.sameValue(arguments[4], 5);
44 assert.sameValue(target, source);
45 callCount += 1;
46 }
47 }
48
49 class Test262ChildClass extends Test262ParentClass {
50 constructor() {
51 super(1, 2, ...target = source);
52 }
53 }
54
55 new Test262ChildClass();
56 assert.sameValue(callCount, 1);
57
58 reportCompare(0, 0);