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 closures. | 5 // Tests of closures. |
6 | 6 |
7 library closures_test; | 7 library closures_test; |
8 | 8 |
9 import 'js_backend_cps_ir.dart'; | 9 import 'js_backend_cps_ir.dart'; |
10 | 10 |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 b() => () => a(); | 99 b() => () => a(); |
100 } | 100 } |
101 main() { | 101 main() { |
102 print(new A().b()()); | 102 print(new A().b()()); |
103 } | 103 } |
104 """, | 104 """, |
105 r""" | 105 r""" |
106 function() { | 106 function() { |
107 return new V.A_b_closure(this); | 107 return new V.A_b_closure(this); |
108 }"""), | 108 }"""), |
| 109 |
| 110 const TestEntry(""" |
| 111 staticMethod(x) => x; |
| 112 main(x) { |
| 113 var tearOff = staticMethod; |
| 114 print(tearOff(123)); |
| 115 } |
| 116 """, |
| 117 r""" |
| 118 function(x) { |
| 119 P.print(V.staticMethod(123)); |
| 120 }"""), |
| 121 |
| 122 const TestEntry(""" |
| 123 class Foo { |
| 124 instanceMethod(x) => x; |
| 125 } |
| 126 main(x) { |
| 127 var tearOff = new Foo().instanceMethod; |
| 128 print(tearOff(123)); |
| 129 } |
| 130 """, |
| 131 r""" |
| 132 function(x) { |
| 133 P.print(V.Foo$().instanceMethod$1(123)); |
| 134 }"""), |
109 ]; | 135 ]; |
110 | 136 |
111 void main() { | 137 void main() { |
112 runTests(tests); | 138 runTests(tests); |
113 } | 139 } |
OLD | NEW |