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 // Flags: --harmony-spreadcalls --harmony-sloppy --harmony-rest-parameters | 5 // Flags: --harmony-spreadcalls --harmony-sloppy --harmony-rest-parameters |
6 | 6 |
7 (function testCallSuperProperty() { | 7 (function testCallSuperPropertyStrict() { |
| 8 "use strict"; |
8 class BaseClass { | 9 class BaseClass { |
9 strict_method(...args) { "use strict"; return [this].concat(args); } | 10 method(...args) { return [this].concat(args); } |
10 sloppy_method(...args) { return [this].concat(args); } | |
11 } | 11 } |
12 class SubClass extends BaseClass { | 12 class SubClass extends BaseClass { |
13 strict_m(...args) { return super.strict_method(...args); } | 13 method(...args) { return super.method(...args); } |
14 sloppy_m(...args) { return super.sloppy_method(...args); } | |
15 } | 14 } |
16 | 15 |
17 var c = new SubClass(); | 16 var c = new SubClass(); |
18 assertEquals([c, 1, 2, 3, 4, 5], c.strict_m(1, 2, 3, 4, 5)); | 17 assertEquals([c, 1, 2, 3, 4, 5], c.method(1, 2, 3, 4, 5)); |
19 assertEquals([c, 1, 2, 3, 4, 5], c.sloppy_m(1, 2, 3, 4, 5)); | |
20 })(); | 18 })(); |
| 19 |
| 20 |
| 21 (function testCallSuperPropertySloppy() { |
| 22 class BaseClass { |
| 23 method(...args) { return [this].concat(args); } |
| 24 } |
| 25 class SubClass extends BaseClass { |
| 26 method(...args) { return super.method(...args); } |
| 27 } |
| 28 |
| 29 var c = new SubClass(); |
| 30 assertEquals([c, 1, 2, 3, 4, 5], c.method(1, 2, 3, 4, 5)); |
| 31 })(); |
OLD | NEW |