Debian Codegraph @

js/src/tests/test262/language/expressions/super/call-spread-obj-manipulate-outter-obj-in-getter.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/spread/obj-manipulate-outter-obj-in-getter.case
3 // - src/spread/default/super-call.template
4 /*---
5 description: Getter manipulates outter object before it's spread operation (SuperCall)
6 esid: sec-super-keyword-runtime-semantics-evaluation
7 features: [object-spread]
8 flags: [generated]
9 info: |
10 SuperCall : super Arguments
11
12 1. Let newTarget be GetNewTarget().
13 2. If newTarget is undefined, throw a ReferenceError exception.
14 3. Let func be GetSuperConstructor().
15 4. ReturnIfAbrupt(func).
16 5. Let argList be ArgumentListEvaluation of Arguments.
17 [...]
18
19 Pending Runtime Semantics: PropertyDefinitionEvaluation
20
21 PropertyDefinition:...AssignmentExpression
22
23 1. Let exprValue be the result of evaluating AssignmentExpression.
24 2. Let fromValue be GetValue(exprValue).
25 3. ReturnIfAbrupt(fromValue).
26 4. Let excludedNames be a new empty List.
27 5. Return CopyDataProperties(object, fromValue, excludedNames).
28
29 ---*/
30 var o = { a: 0, b: 1 };
31 var cthulhu = { get x() {
32 delete o.a;
33 o.b = 42;
34 o.c = "ni";
35 }};
36
37 var callCount = 0;
38
39 class Test262ParentClass {
40 constructor(obj) {
41 assert.sameValue(obj.hasOwnProperty("a"), false);
42 assert.sameValue(obj.b, 42);
43 assert.sameValue(obj.c, "ni");
44 assert(obj.hasOwnProperty("x"));
45 assert.sameValue(Object.keys(obj).length, 3);
46 callCount += 1;
47 }
48 }
49
50 class Test262ChildClass extends Test262ParentClass {
51 constructor() {
52 super({...cthulhu, ...o});
53 }
54 }
55
56 new Test262ChildClass();
57 assert.sameValue(callCount, 1);
58
59 reportCompare(0, 0);