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

Unified Diff: test/mjsunit/es6/classes.js

Issue 2142333002: Refactor class declaration logic to the parser and runtime Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: minor cleanup per Adam Created 4 years, 5 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
« src/parsing/parser.cc ('K') | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/es6/classes.js
diff --git a/test/mjsunit/es6/classes.js b/test/mjsunit/es6/classes.js
index fb77dbb8e4b01bb273512b215763dadbb1077661..6cdbe75a89c5cab629c854c985c350c41453a79d 100644
--- a/test/mjsunit/es6/classes.js
+++ b/test/mjsunit/es6/classes.js
@@ -1046,3 +1046,40 @@ function testClassRestrictedProperties(C) {
assertEquals(42, usingYieldInExtends());
})();
+
+(function TestEvaluationOrder() {
+ var effects = [];
+
+ (class extends (effects.push(0), function(){ assertUnreachable(); }) {
+ [(effects.push(1), { toString(){ effects.push(2); } })](){}
+ static [(effects.push(3), { toString(){ effects.push(4); } })](){}
+ [(effects.push(5), { toString(){ effects.push(6); } })](){}
+ static [(effects.push(7), { toString(){ effects.push(8); } })](){}
+ });
+ assertArrayEquals([0, 1, 2, 3, 4, 5, 6, 7, 8], effects);
+})();
+
+(function TestComputedPropertyNamedConstructor() {
+ const constructor_sigil = {};
+ const nonconstructor_sigil = {};
+
+ class DefaultConstructor {
+ ["constructor"](){ return nonconstructor_sigil; }
+ }
+ assertInstanceof(new DefaultConstructor, DefaultConstructor);
+ assertEquals((new DefaultConstructor).constructor(), nonconstructor_sigil);
+
+ class PreceedingConstructor {
+ constructor(){ return constructor_sigil; }
+ ["constructor"](){ return nonconstructor_sigil; }
+ }
+ assertEquals(new PreceedingConstructor, constructor_sigil);
+ assertEquals((new PreceedingConstructor).constructor(), nonconstructor_sigil);
+
+ class FollowingConstructor {
+ ["constructor"](){ return nonconstructor_sigil; }
+ constructor(){ return constructor_sigil; }
+ }
+ assertEquals(new FollowingConstructor, constructor_sigil);
+ assertEquals((new FollowingConstructor).constructor(), nonconstructor_sigil);
+})();
« src/parsing/parser.cc ('K') | « test/cctest/test-parsing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698