| 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 | 4 |
| 5 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
| 6 import "package:async_helper/async_helper.dart"; | 6 import "package:async_helper/async_helper.dart"; |
| 7 import 'compiler_helper.dart'; | 7 import 'compiler_helper.dart'; |
| 8 | 8 |
| 9 dummyImplTest() { | 9 dummyImplTest() { |
| 10 String source = """ | 10 String source = """ |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 var compiler = compilerFor(source, uri); | 224 var compiler = compilerFor(source, uri); |
| 225 asyncTest(() => compiler.runCompiler(uri).then((_) { | 225 asyncTest(() => compiler.runCompiler(uri).then((_) { |
| 226 Expect.isTrue(compiler.backend.enabledNoSuchMethod); | 226 Expect.isTrue(compiler.backend.enabledNoSuchMethod); |
| 227 ClassElement clsA = findElement(compiler, 'A'); | 227 ClassElement clsA = findElement(compiler, 'A'); |
| 228 Expect.isTrue( | 228 Expect.isTrue( |
| 229 compiler.backend.noSuchMethodRegistry.throwingImpls.contains( | 229 compiler.backend.noSuchMethodRegistry.throwingImpls.contains( |
| 230 clsA.lookupMember('noSuchMethod'))); | 230 clsA.lookupMember('noSuchMethod'))); |
| 231 })); | 231 })); |
| 232 } | 232 } |
| 233 | 233 |
| 234 dummyImplTest11() { |
| 235 String source = """ |
| 236 class A { |
| 237 noSuchMethod(Invocation x) { |
| 238 print('foo'); |
| 239 throw 'foo'; |
| 240 } |
| 241 } |
| 242 main() { |
| 243 print(new A().foo()); |
| 244 } |
| 245 """; |
| 246 Uri uri = new Uri(scheme: 'source'); |
| 247 var compiler = compilerFor(source, uri); |
| 248 asyncTest(() => compiler.runCompiler(uri).then((_) { |
| 249 Expect.isTrue(compiler.backend.enabledNoSuchMethod); |
| 250 ClassElement clsA = findElement(compiler, 'A'); |
| 251 Expect.isTrue( |
| 252 compiler.backend.noSuchMethodRegistry.otherImpls.contains( |
| 253 clsA.lookupMember('noSuchMethod'))); |
| 254 Expect.isTrue( |
| 255 compiler.backend.noSuchMethodRegistry.complexNoReturnImpls.contains( |
| 256 clsA.lookupMember('noSuchMethod'))); |
| 257 })); |
| 258 } |
| 259 |
| 260 dummyImplTest12() { |
| 261 String source = """ |
| 262 class A { |
| 263 noSuchMethod(Invocation x) { |
| 264 return toString(); |
| 265 } |
| 266 } |
| 267 main() { |
| 268 print(new A().foo()); |
| 269 } |
| 270 """; |
| 271 Uri uri = new Uri(scheme: 'source'); |
| 272 var compiler = compilerFor(source, uri); |
| 273 asyncTest(() => compiler.runCompiler(uri).then((_) { |
| 274 Expect.isTrue(compiler.backend.enabledNoSuchMethod); |
| 275 ClassElement clsA = findElement(compiler, 'A'); |
| 276 Expect.isTrue( |
| 277 compiler.backend.noSuchMethodRegistry.otherImpls.contains( |
| 278 clsA.lookupMember('noSuchMethod'))); |
| 279 Expect.isTrue( |
| 280 compiler.backend.noSuchMethodRegistry.complexReturningImpls.contains( |
| 281 clsA.lookupMember('noSuchMethod'))); |
| 282 })); |
| 283 } |
| 284 |
| 234 main() { | 285 main() { |
| 235 dummyImplTest(); | 286 dummyImplTest(); |
| 236 dummyImplTest2(); | 287 dummyImplTest2(); |
| 237 dummyImplTest3(); | 288 dummyImplTest3(); |
| 238 dummyImplTest4(); | 289 dummyImplTest4(); |
| 239 dummyImplTest5(); | 290 dummyImplTest5(); |
| 240 dummyImplTest6(); | 291 dummyImplTest6(); |
| 241 dummyImplTest7(); | 292 dummyImplTest7(); |
| 242 dummyImplTest8(); | 293 dummyImplTest8(); |
| 243 dummyImplTest9(); | 294 dummyImplTest9(); |
| 244 dummyImplTest10(); | 295 dummyImplTest10(); |
| 296 dummyImplTest11(); |
| 297 dummyImplTest12(); |
| 245 } | 298 } |
| OLD | NEW |