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

Unified Diff: test/mjsunit/es6/function-name.js

Issue 2567343004: [parser] Fix bug with non-static name method/property (Closed)
Patch Set: Created 4 years 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 | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/function-name.js
diff --git a/test/mjsunit/es6/function-name.js b/test/mjsunit/es6/function-name.js
index 12cb3e6db1640727b3aa689d017bd57abe5816ed..95bc2d44164aefd7d1d31414d99c1adda03b5391 100644
--- a/test/mjsunit/es6/function-name.js
+++ b/test/mjsunit/es6/function-name.js
@@ -386,3 +386,39 @@
class C { static name() { } static foo() { } }
assertEquals(['length', 'prototype', 'name', 'foo'], Object.getOwnPropertyNames(C));
})();
+
nickie 2016/12/13 22:14:44 Guys, please check that these two sets of tests ac
+(function testStaticName() {
+ class C { static name() { return 42; } }
+ assertEquals(42, C.name());
+ assertEquals(undefined, new C().name);
+
+ class D { static get name() { return 17; } }
+ assertEquals(17, D.name);
+ assertEquals(undefined, new D().name);
+
+ var c = class { static name() { return 42; } }
+ assertEquals(42, c.name());
+ assertEquals(undefined, new c().name);
+
+ var d = class { static get name() { return 17; } }
+ assertEquals(17, d.name);
+ assertEquals(undefined, new d().name);
+})();
+
+(function testNonStaticName() {
+ class C { name() { return 42; } }
+ assertEquals('C', C.name);
+ assertEquals(42, new C().name());
+
+ class D { get name() { return 17; } }
+ assertEquals('D', D.name);
+ assertEquals(17, new D().name);
+
+ var c = class { name() { return 42; } }
+ assertEquals('c', c.name);
+ assertEquals(42, new c().name());
+
+ var d = class { get name() { return 17; } }
+ assertEquals('d', d.name);
+ assertEquals(17, new d().name);
+})();
« no previous file with comments | « src/parsing/parser-base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698