| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // VMOptions=-DUSE_CPS_IR=true | 4 // VMOptions=-DUSE_CPS_IR=true |
| 5 | 5 |
| 6 // Tests of interceptors. | 6 // Tests of interceptors. |
| 7 | 7 |
| 8 library constructor_test; | 8 library constructor_test; |
| 9 | 9 |
| 10 import 'js_backend_cps_ir.dart'; | 10 import 'js_backend_cps_ir.dart'; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 new Foo(); | 157 new Foo(); |
| 158 } | 158 } |
| 159 """, | 159 """, |
| 160 r""" | 160 r""" |
| 161 function() { | 161 function() { |
| 162 var v0; | 162 var v0; |
| 163 v0 = new V.Foo(); | 163 v0 = new V.Foo(); |
| 164 v0.Bar$5$q$w$y$z("x", null, "w", "y", "z"); | 164 v0.Bar$5$q$w$y$z("x", null, "w", "y", "z"); |
| 165 return v0; | 165 return v0; |
| 166 }"""), | 166 }"""), |
| 167 const TestEntry(r""" |
| 168 class C<T> { |
| 169 foo() => T; |
| 170 } |
| 171 main() { |
| 172 print(new C<int>().foo()); |
| 173 }""", r""" |
| 174 function() { |
| 175 P.print(V.C$(P.$int).foo$0()); |
| 176 return null; |
| 177 }"""), |
| 178 const TestEntry(r""" |
| 179 class C<T> { |
| 180 foo() => C; |
| 181 } |
| 182 main() { |
| 183 print(new C<int>().foo()); |
| 184 }""", r""" |
| 185 function() { |
| 186 P.print(V.C$().foo$0()); |
| 187 return null; |
| 188 }"""), |
| 189 const TestEntry.forMethod('generative_constructor(C#)', r""" |
| 190 class C<T> { |
| 191 C() { print(T); } |
| 192 foo() => print(T); |
| 193 } |
| 194 main() { |
| 195 new C<int>(); |
| 196 }""", r""" |
| 197 function($T) { |
| 198 var v0; |
| 199 v0 = H.setRuntimeTypeInfo(new V.C(), [$T]); |
| 200 v0.C$0(); |
| 201 return v0; |
| 202 }"""), |
| 203 const TestEntry.forMethod('generative_constructor(C#)', r""" |
| 204 class C<T> { |
| 205 var x; |
| 206 C() : x = new D<T>(); |
| 207 } |
| 208 class D<T> { |
| 209 foo() => T; |
| 210 } |
| 211 main() { |
| 212 print(new C<int>().x.foo()); |
| 213 }""", r""" |
| 214 function($T) { |
| 215 return H.setRuntimeTypeInfo(new V.C(V.D$($T)), [$T]); |
| 216 }"""), |
| 167 ]; | 217 ]; |
| 168 | 218 |
| 169 void main() { | 219 void main() { |
| 170 runTests(tests); | 220 runTests(tests); |
| 171 } | 221 } |
| OLD | NEW |