| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'package:expect/expect.dart'; | 6 import 'package:expect/expect.dart'; |
| 7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
| 8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
| 9 | 9 |
| 10 const String TEST_ONE = r""" | 10 const String TEST_ONE = r""" |
| 11 main() { | 11 main() { |
| 12 var f = use; | 12 var f = use; |
| 13 if (false) { | 13 if (false) { |
| 14 // This statement and the use of 'foo' should be optimized away, causing | 14 // This statement and the use of 'foo' should be optimized away, causing |
| 15 // 'foo' to be absent from the final code. | 15 // 'foo' to be absent from the final code. |
| 16 f(foo); | 16 f(foo); |
| 17 } | 17 } |
| 18 f(bar); | 18 f(bar); |
| 19 } | 19 } |
| 20 | 20 |
| 21 foo() => 'Tarantula!'; | 21 foo() => 'Tarantula!'; |
| 22 bar() => 'Coelacanth!'; | 22 bar() => 'Coelacanth!'; |
| 23 | 23 |
| 24 use(x) { | 24 use(x) { |
| 25 print(x()); | 25 print(x()); |
| 26 } | 26 } |
| 27 """; | 27 """; |
| 28 | 28 |
| 29 | |
| 30 main() { | 29 main() { |
| 31 asyncTest(() => Future.wait([ | 30 asyncTest(() => Future.wait([ |
| 32 compileAll(TEST_ONE).then((String generated) { | 31 compileAll(TEST_ONE).then((String generated) { |
| 33 Expect.isFalse(generated.contains('Tarantula!'), | 32 Expect.isFalse( |
| 34 "failed to remove 'foo'"); | 33 generated.contains('Tarantula!'), "failed to remove 'foo'"); |
| 35 Expect.isTrue(generated.contains('Coelacanth!')); | 34 Expect.isTrue(generated.contains('Coelacanth!')); |
| 36 }), | 35 }), |
| 37 ])); | 36 ])); |
| 38 } | 37 } |
| OLD | NEW |