summaryrefslogtreecommitdiff
path: root/src/class-fields/literal-names.case
blob: 3637efbca22fc01ba9147a268ac514b56d276ba8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (C) 2017 the V8 project authors, 2017 Igalia S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
desc: Literal property names
info: |
  ClassElement:
    ...
    FieldDefinition ;

  FieldDefinition:
    ClassElementName Initializer_opt

  ClassElementName:
    PropertyName
template: productions
includes: [propertyHelper.js]
---*/

//- setup
const fn = function() {}

//- fields
a; b = 42;
c = fn
//- assertions
assert.sameValue(Object.hasOwnProperty.call(C.prototype, "a"), false);
assert.sameValue(Object.hasOwnProperty.call(C, "a"), false);

verifyProperty(c, "a", {
  value: undefined,
  enumerable: true,
  writable: true,
  configurable: true
});

assert.sameValue(Object.hasOwnProperty.call(C.prototype, "b"), false);
assert.sameValue(Object.hasOwnProperty.call(C, "b"), false);

verifyProperty(c, "b", {
  value: 42,
  enumerable: true,
  writable: true,
  configurable: true
});

assert.sameValue(Object.hasOwnProperty.call(C.prototype, "c"), false);
assert.sameValue(Object.hasOwnProperty.call(C, "c"), false);

verifyProperty(c, "c", {
  value: fn,
  enumerable: true,
  writable: true,
  configurable: true
});