| Index: test/mjsunit/harmony/class-fields-to-name.js
|
| diff --git a/test/mjsunit/harmony/class-fields-to-name.js b/test/mjsunit/harmony/class-fields-to-name.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..003975f13aa41a8d18ed56fb0f8d02cb1ea9ecd7
|
| --- /dev/null
|
| +++ b/test/mjsunit/harmony/class-fields-to-name.js
|
| @@ -0,0 +1,41 @@
|
| +// Copyright 2016 the V8 project authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +// Flags: --harmony-class-fields
|
| +
|
| +{
|
| + let hits = 0;
|
| + let coercible = { toString(){ ++hits; return 'a'; } };
|
| +
|
| + class C {
|
| + [coercible] = 0;
|
| + }
|
| +
|
| + assertEquals(1, hits);
|
| +
|
| + new C;
|
| + new C;
|
| +
|
| + assertEquals(1, hits);
|
| +
|
| + assertEquals(0, (new C).a);
|
| +}
|
| +
|
| +{
|
| + let hits = 0;
|
| + let coercible = { toString(){ ++hits; return 'a'; } };
|
| +
|
| + class C {
|
| + static [coercible] = 0;
|
| + }
|
| +
|
| + assertEquals(1, hits);
|
| +
|
| + new C;
|
| + new C;
|
| +
|
| + assertEquals(1, hits);
|
| +
|
| + assertEquals(0, C.a);
|
| +}
|
|
|