| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/class-fields/init-value-defined-after-class.case |
| 3 |
// - src/class-fields/default/cls-expr.template |
| 4 |
/*--- |
| 5 |
description: The initializer value is defined after the class evaluation (field definitions in a class expression) |
| 6 |
esid: prod-FieldDefinition |
| 7 |
features: [computed-property-names, class, class-fields-public] |
| 8 |
flags: [generated] |
| 9 |
includes: [propertyHelper.js] |
| 10 |
info: | |
| 11 |
[[Construct]] ( argumentsList, newTarget) |
| 12 |
|
| 13 |
8. If kind is "base", then |
| 14 |
a. Perform OrdinaryCallBindThis(F, calleeContext, thisArgument). |
| 15 |
b. Let result be InitializeInstanceFields(thisArgument, F). |
| 16 |
... |
| 17 |
... |
| 18 |
11. Let result be OrdinaryCallEvaluateBody(F, argumentsList). |
| 19 |
... |
| 20 |
|
| 21 |
---*/ |
| 22 |
var x = false; |
| 23 |
|
| 24 |
|
| 25 |
var C = class { |
| 26 |
[x] = x; |
| 27 |
} |
| 28 |
|
| 29 |
var c1 = new C(); |
| 30 |
|
| 31 |
x = true; |
| 32 |
var c2 = new C(); |
| 33 |
|
| 34 |
verifyProperty(c1, "false", { |
| 35 |
value: false, |
| 36 |
enumerable: true, |
| 37 |
configurable: true, |
| 38 |
writable: true, |
| 39 |
}); |
| 40 |
verifyProperty(c2, "false", { |
| 41 |
value: true, |
| 42 |
enumerable: true, |
| 43 |
configurable: true, |
| 44 |
writable: true, |
| 45 |
}); |
| 46 |
|
| 47 |
assert.sameValue(c1.hasOwnProperty("true"), false); |
| 48 |
assert.sameValue(c2.hasOwnProperty("true"), false); |