Index: test/mjsunit/harmony/super.js |
diff --git a/test/mjsunit/harmony/super.js b/test/mjsunit/harmony/super.js |
index 1af7ab2e234f97b3d48ef94935ab908a5cef034a..87fceafb299bceffd8fead995e1e4a45f03705c7 100644 |
--- a/test/mjsunit/harmony/super.js |
+++ b/test/mjsunit/harmony/super.js |
@@ -3,7 +3,7 @@ |
// found in the LICENSE file. |
// Flags: --harmony-classes --harmony-arrow-functions --allow-natives-syntax |
- |
+// Flags: --harmony-spreadcalls |
(function TestSuperNamedLoads() { |
function Base() { } |
@@ -2107,3 +2107,99 @@ TestKeyedSetterCreatingOwnPropertiesNonConfigurable(42, 43, 44); |
let d = new Derived(); |
assertSame(1, d.arrow()); |
})(); |
+ |
+ |
+(function TestSuperCallInEval() { |
+ 'use strict'; |
+ class Base { |
+ constructor(x) { |
+ this.x = x; |
+ } |
+ } |
+ class Derived extends Base { |
+ constructor(x) { |
+ eval('super(x)'); |
+ } |
+ } |
+ let d = new Derived(42); |
+ assertSame(42, d.x); |
+})(); |
+ |
+ |
+(function TestSuperCallInArrow() { |
+ 'use strict'; |
+ class Base { |
+ constructor(x) { |
+ this.x = x; |
+ } |
+ } |
+ class Derived extends Base { |
+ constructor(x) { |
+ (() => super(x))(); |
+ } |
+ } |
+ let d = new Derived(42); |
+ assertSame(42, d.x); |
+})(); |
+ |
+ |
+(function TestSuperCallEscapes() { |
+ 'use strict'; |
+ class Base { |
+ constructor(x) { |
+ this.x = x; |
+ } |
+ } |
+ |
+ let f; |
+ class Derived extends Base { |
+ constructor() { |
+ f = () => super(2); |
+ } |
+ } |
+ assertThrows(function() { |
+ new Derived(); |
+ }, ReferenceError); |
+ |
+ let o = f(); |
+ assertEquals(2, o.x); |
+ assertInstanceof(o, Derived); |
+ |
+ assertThrows(function() { |
+ f(); |
+ }, ReferenceError); |
+})(); |
+ |
+ |
+(function TestSuperCallSpreadInEval() { |
+ 'use strict'; |
+ class Base { |
+ constructor(x) { |
+ this.x = x; |
+ } |
+ } |
+ class Derived extends Base { |
+ constructor(x) { |
+ eval('super(...[x])'); |
+ } |
+ } |
+ let d = new Derived(42); |
+ assertSame(42, d.x); |
+})(); |
+ |
+ |
+(function TestSuperCallSpreadInArrow() { |
+ 'use strict'; |
+ class Base { |
+ constructor(x) { |
+ this.x = x; |
+ } |
+ } |
+ class Derived extends Base { |
+ constructor(x) { |
+ (() => super(...[x]))(); |
+ } |
+ } |
+ let d = new Derived(42); |
+ assertSame(42, d.x); |
+})(); |