| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 (function StoreToSuper () { | 5 (function StoreToSuper () { |
| 6 "use strict"; | 6 "use strict"; |
| 7 class A { | 7 class A { |
| 8 s() { | 8 s() { |
| 9 super.bla = 10; | 9 super.bla = 10; |
| 10 } | 10 } |
| 11 }; | 11 }; |
| 12 | 12 |
| 13 let a = new A(); | 13 let a = new A(); |
| 14 (new A).s.call(a); | 14 (new A).s.call(a); |
| 15 assertEquals(10, a.bla); | 15 assertEquals(10, a.bla); |
| 16 assertThrows(function() { (new A).s.call(undefined); }, TypeError); | 16 assertThrows(function() { (new A).s.call(undefined); }, TypeError); |
| 17 assertThrows(function() { (new A).s.call(42); }, TypeError); | 17 assertThrows(function() { (new A).s.call(42); }, TypeError); |
| 18 assertThrows(function() { (new A).s.call(null); }, TypeError); | 18 assertThrows(function() { (new A).s.call(null); }, TypeError); |
| 19 assertThrows(function() { (new A).s.call("abc"); }, TypeError); | 19 assertThrows(function() { (new A).s.call("abc"); }, TypeError); |
| 20 })(); | 20 })(); |
| 21 | 21 |
| 22 | 22 |
| 23 (function LoadFromSuper () { | 23 (function LoadFromSuper () { |
| 24 "use strict"; | 24 "use strict"; |
| 25 class A { | 25 class A { |
| 26 s() { | 26 s() { |
| 27 return super.bla; | 27 return super.bla; |
| 28 } | 28 } |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 let a = new A(); | 31 let a = new A(); |
| 32 assertSame(undefined, (new A).s.call(a)); | 32 assertSame(undefined, (new A).s.call(a)); |
| 33 assertSame(undefined, (new A).s.call(undefined)); | 33 assertSame(undefined, (new A).s.call(undefined)); |
| 34 assertSame(undefined, (new A).s.call(42)); | 34 assertSame(undefined, (new A).s.call(42)); |
| 35 assertSame(undefined, (new A).s.call(null)); | 35 assertSame(undefined, (new A).s.call(null)); |
| 36 assertSame(undefined, (new A).s.call("abc")); | 36 assertSame(undefined, (new A).s.call("abc")); |
| 37 })(); | 37 })(); |
| OLD | NEW |