| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // Tests of interceptors. | 5 // Tests of interceptors. |
| 6 | 6 |
| 7 library supercall_test; | 7 library supercall_test; |
| 8 | 8 |
| 9 import 'js_backend_cps_ir.dart'; | 9 import 'js_backend_cps_ir.dart'; |
| 10 | 10 |
| 11 const List<TestEntry> tests = const [ | 11 const List<TestEntry> tests = const [ |
| 12 const TestEntry.forMethod('function(Sub#m)', """ | 12 const TestEntry.forMethod('function(Sub#m)', """ |
| 13 class Base { | 13 class Base { |
| 14 m(x) { | 14 m(x) { |
| 15 print(x+1); | 15 print(x+1); |
| 16 } | 16 } |
| 17 } | 17 } |
| 18 class Sub extends Base { | 18 class Sub extends Base { |
| 19 m(x) => super.m(x+10); | 19 m(x) => super.m(x+10); |
| 20 } | 20 } |
| 21 main() { | 21 main() { |
| 22 new Sub().m(100); | 22 new Sub().m(100); |
| 23 }""", | 23 }""", |
| 24 r""" | 24 r""" |
| 25 function(x) { | 25 function(x) { |
| 26 return V.Base.prototype.m$1.call(this, J.getInterceptor$ns(x).$add(x, 10)); | 26 return V.Base.prototype.m$1.call(this, x + 10); |
| 27 }"""), | 27 }"""), |
| 28 | 28 |
| 29 // Reenable when we support compiling functions that | 29 // Reenable when we support compiling functions that |
| 30 // need interceptor calling convention. | 30 // need interceptor calling convention. |
| 31 // const TestEntry.forMethod('function(Sub#+)', """ | 31 // const TestEntry.forMethod('function(Sub#+)', """ |
| 32 // class Base { | 32 // class Base { |
| 33 // m(x) { | 33 // m(x) { |
| 34 // print(x+1000); | 34 // print(x+1000); |
| 35 // } | 35 // } |
| 36 // operator+(x) => m(x+10); | 36 // operator+(x) => m(x+10); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 65 function(x) { | 65 function(x) { |
| 66 return J.getInterceptor$ns(x).$add(x, this.field); | 66 return J.getInterceptor$ns(x).$add(x, this.field); |
| 67 }"""), | 67 }"""), |
| 68 | 68 |
| 69 | 69 |
| 70 ]; | 70 ]; |
| 71 | 71 |
| 72 void main() { | 72 void main() { |
| 73 runTests(tests); | 73 runTests(tests); |
| 74 } | 74 } |
| OLD | NEW |