Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/super/call-spread-mult-iter.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/spread/mult-iter.case
3 // - src/spread/default/super-call.template
4 /*---
5 description: Spread operator following other arguments with a valid iterator (SuperCall)
6 esid: sec-super-keyword-runtime-semantics-evaluation
7 es6id: 12.3.5.1
8 features: [Symbol.iterator]
9 flags: [generated]
10 info: |
11 SuperCall : super Arguments
12
13 1. Let newTarget be GetNewTarget().
14 2. If newTarget is undefined, throw a ReferenceError exception.
15 3. Let func be GetSuperConstructor().
16 4. ReturnIfAbrupt(func).
17 5. Let argList be ArgumentListEvaluation of Arguments.
18 [...]
19
20 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
21
22 ArgumentList : ... AssignmentExpression
23
24 1. Let list be an empty List.
25 2. Let spreadRef be the result of evaluating AssignmentExpression.
26 3. Let spreadObj be GetValue(spreadRef).
27 4. Let iterator be GetIterator(spreadObj).
28 5. ReturnIfAbrupt(iterator).
29 6. Repeat
30 a. Let next be IteratorStep(iterator).
31 b. ReturnIfAbrupt(next).
32 c. If next is false, return list.
33 d. Let nextArg be IteratorValue(next).
34 e. ReturnIfAbrupt(nextArg).
35 f. Append nextArg as the last element of list.
36 ---*/
37 var iter = {};
38 iter[Symbol.iterator] = function() {
39 var nextCount = 3;
40 return {
41 next: function() {
42 nextCount += 1;
43 return { done: nextCount === 6, value: nextCount };
44 }
45 };
46 };
47
48 var callCount = 0;
49
50 class Test262ParentClass {
51 constructor() {
52 assert.sameValue(arguments.length, 5);
53 assert.sameValue(arguments[0], 1);
54 assert.sameValue(arguments[1], 2);
55 assert.sameValue(arguments[2], 3);
56 assert.sameValue(arguments[3], 4);
57 assert.sameValue(arguments[4], 5);
58 callCount += 1;
59 }
60 }
61
62 class Test262ChildClass extends Test262ParentClass {
63 constructor() {
64 super(1, 2, 3, ...iter);
65 }
66 }
67
68 new Test262ChildClass();
69 assert.sameValue(callCount, 1);