Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1567)

Unified Diff: test/mjsunit/harmony/class-fields-to-name.js

Issue 2330473002: Class fields, part 3 (backends)
Patch Set: bytecode test Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/harmony/class-fields-syntax.js ('k') | test/mjsunit/harmony/class-fields-visibility.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}
« no previous file with comments | « test/mjsunit/harmony/class-fields-syntax.js ('k') | test/mjsunit/harmony/class-fields-visibility.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698