Index: test/mjsunit/harmony/classes.js |
diff --git a/test/mjsunit/harmony/classes.js b/test/mjsunit/harmony/classes.js |
index 42917704a5b3430e02cf214f8a9b673ee0426a84..a6df8e1a75914acce3565b50114751be031300cc 100644 |
--- a/test/mjsunit/harmony/classes.js |
+++ b/test/mjsunit/harmony/classes.js |
@@ -777,3 +777,61 @@ function assertAccessorDescriptor(object, name) { |
var x = (class x extends x {}); |
}, ReferenceError); |
})(); |
+ |
+ |
+(function TestSuperCallSyntacticRestriction() { |
rossberg
2014/11/27 19:04:40
Add tests for nested calls, e.g.:
constructor()
Dmitry Lomov (no reviews)
2014/11/27 19:41:57
Done.
|
+ assertThrows(function() { |
+ class C { |
+ constructor() { |
+ var y; |
+ super(); |
+ } |
+ }; new C(); |
+ }, TypeError); |
+ assertThrows(function() { |
+ class C { |
+ constructor() { |
+ super(this.x); |
+ } |
+ }; new C(); |
+ }, TypeError); |
+ assertThrows(function() { |
+ class C { |
+ constructor() { |
+ super(this); |
+ } |
+ }; new C(); |
+ }, TypeError); |
+ assertThrows(function() { |
+ class C { |
+ constructor() { |
+ super(1, 2, Object.getPrototypeOf(this)); |
+ } |
+ }; new C(); |
+ }, TypeError); |
+ |
+ class C1 extends Object { |
+ constructor() { |
+ 'use strict'; |
+ super(); |
+ } |
+ }; |
+ new C1(); |
+ |
+ class C2 extends Object { |
+ constructor() { |
+ ; 'use strict';;;;; |
+ super(); |
+ } |
+ }; |
+ new C2(); |
+ |
+ class C3 extends Object { |
+ constructor() { |
+ ; 'use strict';;;;; |
+ // This is a comment. |
+ super(); |
+ } |
+ }; |
+ new C3(); |
+}()); |