Debian Codegraph @

js/src/tests/test262/language/expressions/array/spread-mult-obj-ident.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/spread/mult-obj-ident.case
3 // - src/spread/default/array.template
4 /*---
5 description: Object Spread operator following other properties (Array initializer)
6 esid: sec-runtime-semantics-arrayaccumulation
7 features: [object-spread]
8 flags: [generated]
9 includes: [propertyHelper.js]
10 info: |
11 SpreadElement : ...AssignmentExpression
12
13 1. Let spreadRef be the result of evaluating AssignmentExpression.
14 2. Let spreadObj be ? GetValue(spreadRef).
15 3. Let iterator be ? GetIterator(spreadObj).
16 4. Repeat
17 a. Let next be ? IteratorStep(iterator).
18 b. If next is false, return nextIndex.
19 c. Let nextValue be ? IteratorValue(next).
20 d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)),
21 nextValue).
22 e. Assert: status is true.
23 f. Let nextIndex be nextIndex + 1.
24
25 Pending Runtime Semantics: PropertyDefinitionEvaluation
26
27 PropertyDefinition:...AssignmentExpression
28
29 1. Let exprValue be the result of evaluating AssignmentExpression.
30 2. Let fromValue be GetValue(exprValue).
31 3. ReturnIfAbrupt(fromValue).
32 4. Let excludedNames be a new empty List.
33 5. Return CopyDataProperties(object, fromValue, excludedNames).
34
35 ---*/
36 let o = {c: 3, d: 4};
37
38
39 var callCount = 0;
40
41 (function(obj) {
42 assert.sameValue(Object.keys(obj).length, 4);
43
44 verifyProperty(obj, "a", {
45 enumerable: true,
46 writable: true,
47 configurable: true,
48 value: 1
49 });
50
51 verifyProperty(obj, "b", {
52 enumerable: true,
53 writable: true,
54 configurable: true,
55 value: 2
56 });
57
58 verifyProperty(obj, "c", {
59 enumerable: true,
60 writable: true,
61 configurable: true,
62 value: 3
63 });
64
65 verifyProperty(obj, "d", {
66 enumerable: true,
67 writable: true,
68 configurable: true,
69 value: 4
70 });
71 callCount += 1;
72 }.apply(null, [{a: 1, b: 2, ...o}]));
73
74 assert.sameValue(callCount, 1);
75
76 reportCompare(0, 0);