| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/class-fields/computed-symbol-names.case |
| 3 |
// - src/class-fields/productions/cls-expr-multiple-definitions.template |
| 4 |
/*--- |
| 5 |
description: Computed property symbol names (multiple fields definitions) |
| 6 |
esid: prod-FieldDefinition |
| 7 |
features: [Symbol, computed-property-names, class, class-fields-public] |
| 8 |
flags: [generated] |
| 9 |
includes: [propertyHelper.js] |
| 10 |
info: | |
| 11 |
ClassElement: |
| 12 |
... |
| 13 |
FieldDefinition ; |
| 14 |
|
| 15 |
FieldDefinition: |
| 16 |
ClassElementName Initializer_opt |
| 17 |
|
| 18 |
ClassElementName: |
| 19 |
PropertyName |
| 20 |
|
| 21 |
---*/ |
| 22 |
var x = Symbol(); |
| 23 |
var y = Symbol(); |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
var C = class { |
| 28 |
foo = "foobar"; |
| 29 |
m() { return 42 } |
| 30 |
[x]; [y] = 42 |
| 31 |
m2() { return 39 } |
| 32 |
bar = "barbaz"; |
| 33 |
|
| 34 |
} |
| 35 |
|
| 36 |
var c = new C(); |
| 37 |
|
| 38 |
assert.sameValue(c.m(), 42); |
| 39 |
assert.sameValue(Object.hasOwnProperty.call(c, "m"), false); |
| 40 |
assert.sameValue(c.m, C.prototype.m); |
| 41 |
|
| 42 |
verifyProperty(C.prototype, "m", { |
| 43 |
enumerable: false, |
| 44 |
configurable: true, |
| 45 |
writable: true, |
| 46 |
}); |
| 47 |
|
| 48 |
assert.sameValue(c.m2(), 39); |
| 49 |
assert.sameValue(Object.hasOwnProperty.call(c, "m2"), false); |
| 50 |
assert.sameValue(c.m2, C.prototype.m2); |
| 51 |
|
| 52 |
verifyProperty(C.prototype, "m2", { |
| 53 |
enumerable: false, |
| 54 |
configurable: true, |
| 55 |
writable: true, |
| 56 |
}); |
| 57 |
|
| 58 |
assert.sameValue(c.foo, "foobar"); |
| 59 |
assert.sameValue(Object.hasOwnProperty.call(C, "foo"), false); |
| 60 |
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "foo"), false); |
| 61 |
|
| 62 |
verifyProperty(c, "foo", { |
| 63 |
value: "foobar", |
| 64 |
enumerable: true, |
| 65 |
configurable: true, |
| 66 |
writable: true, |
| 67 |
}); |
| 68 |
|
| 69 |
assert.sameValue(c.bar, "barbaz"); |
| 70 |
assert.sameValue(Object.hasOwnProperty.call(C, "bar"), false); |
| 71 |
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "bar"), false); |
| 72 |
|
| 73 |
verifyProperty(c, "bar", { |
| 74 |
value: "barbaz", |
| 75 |
enumerable: true, |
| 76 |
configurable: true, |
| 77 |
writable: true, |
| 78 |
}); |
| 79 |
|
| 80 |
assert.sameValue(Object.hasOwnProperty.call(C.prototype, x), false); |
| 81 |
assert.sameValue(Object.hasOwnProperty.call(C, x), false); |
| 82 |
|
| 83 |
verifyProperty(c, x, { |
| 84 |
value: undefined, |
| 85 |
enumerable: true, |
| 86 |
writable: true, |
| 87 |
configurable: true |
| 88 |
}); |
| 89 |
|
| 90 |
assert.sameValue(Object.hasOwnProperty.call(C.prototype, y), false); |
| 91 |
assert.sameValue(Object.hasOwnProperty.call(C, y), false); |
| 92 |
|
| 93 |
verifyProperty(c, y, { |
| 94 |
value: 42, |
| 95 |
enumerable: true, |
| 96 |
writable: true, |
| 97 |
configurable: true |
| 98 |
}); |
| 99 |
|
| 100 |
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "x"), false); |
| 101 |
assert.sameValue(Object.hasOwnProperty.call(C, "x"), false); |
| 102 |
assert.sameValue(Object.hasOwnProperty.call(c, "x"), false); |
| 103 |
|
| 104 |
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "y"), false); |
| 105 |
assert.sameValue(Object.hasOwnProperty.call(C, "y"), false); |
| 106 |
assert.sameValue(Object.hasOwnProperty.call(c, "y"), false); |