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

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

Issue 885643004: new classes: assert that constructors are not callable and rewrite 'return;' (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix bit width 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/runtime/runtime-classes.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 5a3c3e5558319941e0098dabdc712ebfd1be0e93..ed720d97b6275462e397d3f55e81746a450839f1 100644
--- a/test/mjsunit/harmony/classes-experimental.js
+++ b/test/mjsunit/harmony/classes-experimental.js
@@ -34,15 +34,18 @@ class Subclass extends Base {
let b = new Base(1, 2);
assertSame(3, b.prp);
+
let s = new Subclass(2, -1);
assertSame(1, s.prp);
assertSame(undefined, s.prp1);
assertFalse(s.hasOwnProperty("prp1"));
class Subclass2 extends Base {
- constructor() {
+ constructor(x) {
super(1,2);
+ if (x < 0) return;
+
let called = false;
function tmp() { called = true; return 3; }
var exn = null;
@@ -54,4 +57,11 @@ class Subclass2 extends Base {
}
}
-new Subclass2();
+var s2 = new Subclass2(1);
+assertSame(3, s2.prp);
+
+var s3 = new Subclass2(-1);
+assertSame(3, s3.prp);
+
+assertThrows(function() { Subclass.call(new Object(), 1, 2); }, TypeError);
+assertThrows(function() { Base.call(new Object(), 1, 2); }, TypeError);
« no previous file with comments | « src/runtime/runtime-classes.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698