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

Unified Diff: test/mjsunit/harmony/classes-experimental.js

Issue 918603004: new classes: implement correct check for uninitialized this in 'super()' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Created 5 years, 10 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 | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/classes-experimental.js
diff --git a/test/mjsunit/harmony/classes-experimental.js b/test/mjsunit/harmony/classes-experimental.js
index c37dee2b009fe2a8a38247412c674da975da933c..cccd8ca48b0b98a47aef64d2f0c9987ad649f97f 100644
--- a/test/mjsunit/harmony/classes-experimental.js
+++ b/test/mjsunit/harmony/classes-experimental.js
@@ -89,8 +89,7 @@
super(tmp(),4);
} catch (e) { exn = e; }
assertTrue(exn instanceof ReferenceError);
- // TODO(dslomov): should be 'true'.
- assertFalse(called);
+ assertTrue(called);
}
}
@@ -110,6 +109,61 @@
assertThrows(function() { new BadSubclass(); }, ReferenceError);
}());
+(function TestThisCheckOrdering() {
+ let baseCalled = 0;
+ class Base {
+ constructor() { baseCalled++ }
+ }
+
+ let fCalled = 0;
+ function f() { fCalled++; return 3; }
+
+ class Subclass1 extends Base {
+ constructor() {
+ baseCalled = 0;
+ super();
+ assertEquals(1, baseCalled);
+ let obj = this;
+
+ let exn = null;
+ baseCalled = 0;
+ fCalled = 0;
+ try {
+ super(f());
+ } catch (e) { exn = e; }
+ assertTrue(exn instanceof ReferenceError);
+ assertEquals(1, fCalled);
+ assertEquals(1, baseCalled);
+ assertSame(obj, this);
+
+ exn = null;
+ baseCalled = 0;
+ fCalled = 0;
+ try {
+ super(super(), f());
+ } catch (e) { exn = e; }
+ assertTrue(exn instanceof ReferenceError);
+ assertEquals(0, fCalled);
+ assertEquals(1, baseCalled);
+ assertSame(obj, this);
+
+ exn = null;
+ baseCalled = 0;
+ fCalled = 0;
+ try {
+ super(f(), super());
+ } catch (e) { exn = e; }
+ assertTrue(exn instanceof ReferenceError);
+ assertEquals(1, fCalled);
+ assertEquals(1, baseCalled);
+ assertSame(obj, this);
+ }
+ }
+
+ new Subclass1();
+}());
+
+
(function TestPrototypeWiring() {
class Base {
constructor(x) {
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698