| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 class D<T> { | 199 class D<T> { |
| 200 foo() => T; | 200 foo() => T; |
| 201 } | 201 } |
| 202 main() { | 202 main() { |
| 203 print(new C<int>().x.foo()); | 203 print(new C<int>().x.foo()); |
| 204 }""", r""" | 204 }""", r""" |
| 205 function($T) { | 205 function($T) { |
| 206 return H.setRuntimeTypeInfo(new V.C(V.D$($T)), [$T]); | 206 return H.setRuntimeTypeInfo(new V.C(V.D$($T)), [$T]); |
| 207 }"""), | 207 }"""), |
| 208 |
| 209 |
| 210 const TestEntry.forMethod('generative_constructor(A#)', r""" |
| 211 class A { |
| 212 var x; |
| 213 A() : this.b(1); |
| 214 A.b(this.x); |
| 215 } |
| 216 main() { |
| 217 print(new A().x); |
| 218 }""", r""" |
| 219 function() { |
| 220 return new V.A(1); |
| 221 }"""), |
| 222 |
| 223 |
| 224 const TestEntry.forMethod('function(Foo#make)', r""" |
| 225 class Foo { |
| 226 factory Foo.make(x) { |
| 227 print('Foo'); |
| 228 return new Foo.create(x); |
| 229 } |
| 230 var x; |
| 231 Foo.create(this.x); |
| 232 } |
| 233 main() { |
| 234 print(new Foo.make(5)); |
| 235 }""", r""" |
| 236 function(x) { |
| 237 P.print("Foo"); |
| 238 return V.Foo$create(x); |
| 239 }"""), |
| 240 const TestEntry(r""" |
| 241 class Foo { |
| 242 factory Foo.make(x) = Foo.create; |
| 243 var x; |
| 244 Foo.create(this.x); |
| 245 } |
| 246 main() { |
| 247 print(new Foo.make(5)); |
| 248 }""", r""" |
| 249 function() { |
| 250 P.print(V.Foo$create(5)); |
| 251 return null; |
| 252 }"""), |
| 253 const TestEntry(r""" |
| 254 class A { |
| 255 factory A(x) = B<int>; |
| 256 get typevar; |
| 257 } |
| 258 class B<T> implements A { |
| 259 var x; |
| 260 B(this.x); |
| 261 |
| 262 get typevar => T; |
| 263 } |
| 264 main() { |
| 265 new A(5).typevar; |
| 266 }""", r""" |
| 267 function() { |
| 268 V.B$(5, P.$int).get$typevar(); |
| 269 return null; |
| 270 }"""), |
| 208 ]; | 271 ]; |
| 209 | 272 |
| 210 void main() { | 273 void main() { |
| 211 runTests(tests); | 274 runTests(tests); |
| 212 } | 275 } |
| OLD | NEW |