Index: test/mjsunit/harmony/classes.js |
diff --git a/test/mjsunit/harmony/classes.js b/test/mjsunit/harmony/classes.js |
index 42917704a5b3430e02cf214f8a9b673ee0426a84..5cea2a98e5901990a0f9caeb36b3e57750770768 100644 |
--- a/test/mjsunit/harmony/classes.js |
+++ b/test/mjsunit/harmony/classes.js |
@@ -777,3 +777,75 @@ function assertAccessorDescriptor(object, name) { |
var x = (class x extends x {}); |
}, ReferenceError); |
})(); |
+ |
+ |
+(function TestSuperCallSyntacticRestriction() { |
+ assertThrows(function() { |
+ class C { |
+ constructor() { |
+ var y; |
arv (Not doing code reviews)
2014/12/01 15:14:07
Why should this throw? I thought the design we agr
|
+ 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); |
+ assertThrows(function() { |
+ class C { |
+ constructor() { |
+ { super(1, 2); } |
+ } |
+ }; new C(); |
+ }, TypeError); |
+ assertThrows(function() { |
+ class C { |
+ constructor() { |
+ if (1) super(); |
+ } |
+ }; 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(); |
+}()); |
arv (Not doing code reviews)
2014/12/01 15:14:07
Can you add a test for `super.method()` too?
clas
|