Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/class/fields-redeclaration.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/class-fields/redeclaration.case
3 // - src/class-fields/default/cls-expr.template
4 /*---
5 description: Redeclaration of public fields with the same name (field definitions in a class expression)
6 esid: prod-FieldDefinition
7 features: [class, class-fields-public]
8 flags: [generated]
9 includes: [propertyHelper.js, compareArray.js]
10 info: |
11 2.13.2 Runtime Semantics: ClassDefinitionEvaluation
12
13 ...
14 30. Set the value of F's [[Fields]] internal slot to fieldRecords.
15 ...
16
17 2.14 [[Construct]] ( argumentsList, newTarget)
18
19 ...
20 8. If kind is "base", then
21 ...
22 b. Let result be InitializeInstanceFields(thisArgument, F).
23 ...
24
25 2.9 InitializeInstanceFields ( O, constructor )
26
27 3. Let fieldRecords be the value of constructor's [[Fields]] internal slot.
28 4. For each item fieldRecord in order from fieldRecords,
29 a. If fieldRecord.[[static]] is false, then
30 i. Perform ? DefineField(O, fieldRecord).
31
32 ---*/
33 var x = [];
34
35
36 var C = class {
37 y = (x.push("a"), "old_value");
38 ["y"] = (x.push("b"), "another_value");
39 "y" = (x.push("c"), "same_value");
40 y = (x.push("d"), "same_value");
41 }
42
43 var c = new C();
44
45 assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false);
46 assert.sameValue(Object.hasOwnProperty.call(C, "y"), false);
47
48 verifyProperty(c, "y", {
49 value: "same_value",
50 enumerable: true,
51 writable: true,
52 configurable: true
53 });
54
55 assert(compareArray(x, ["a", "b", "c", "d"]));