| 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 // Test that tree-shaking hasn't been turned off. | 5 // Test that tree-shaking hasn't been turned off. |
| 6 | 6 |
| 7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
| 8 import 'package:compiler/src/compiler.dart'; | 8 import 'package:compiler/src/compiler.dart'; |
| 9 import 'package:compiler/src/js_backend/js_backend.dart' | 9 import 'package:compiler/src/js_backend/js_backend.dart' show JavaScriptBackend; |
| 10 show JavaScriptBackend; | |
| 11 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
| 12 import 'memory_compiler.dart'; | 11 import 'memory_compiler.dart'; |
| 13 | 12 |
| 14 main() { | 13 main() { |
| 15 DiagnosticCollector collector = new DiagnosticCollector(); | 14 DiagnosticCollector collector = new DiagnosticCollector(); |
| 16 asyncTest(() async { | 15 asyncTest(() async { |
| 17 CompilationResult result = await runCompiler( | 16 CompilationResult result = await runCompiler( |
| 18 memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector); | 17 memorySourceFiles: MEMORY_SOURCE_FILES, diagnosticHandler: collector); |
| 19 Compiler compiler = result.compiler; | 18 Compiler compiler = result.compiler; |
| 20 Expect.isTrue(collector.errors.isEmpty); | 19 Expect.isTrue(collector.errors.isEmpty); |
| 21 Expect.isTrue(collector.infos.isEmpty); | 20 Expect.isTrue(collector.infos.isEmpty); |
| 22 Expect.isFalse(compiler.compilationFailed); | 21 Expect.isFalse(compiler.compilationFailed); |
| 23 Expect.isFalse(compiler.enqueuer.resolution.hasEnqueuedReflectiveElements); | 22 Expect.isFalse(compiler.enqueuer.resolution.hasEnqueuedReflectiveElements); |
| 24 Expect.isFalse( | 23 Expect.isFalse( |
| 25 compiler.enqueuer.resolution.hasEnqueuedReflectiveStaticFields); | 24 compiler.enqueuer.resolution.hasEnqueuedReflectiveStaticFields); |
| 26 JavaScriptBackend backend = compiler.backend; | 25 JavaScriptBackend backend = compiler.backend; |
| 27 Expect.isFalse(backend.codegenEnqueuer.hasEnqueuedReflectiveElements); | 26 Expect.isFalse(backend.codegenEnqueuer.hasEnqueuedReflectiveElements); |
| 28 Expect.isFalse(backend.codegenEnqueuer.hasEnqueuedReflectiveStaticFields); | 27 Expect.isFalse(backend.codegenEnqueuer.hasEnqueuedReflectiveStaticFields); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 40 print('Invoked ${MirrorSystem.getName(invocation.memberName)}'); | 39 print('Invoked ${MirrorSystem.getName(invocation.memberName)}'); |
| 41 return reflect('foobar').delegate(invocation); | 40 return reflect('foobar').delegate(invocation); |
| 42 } | 41 } |
| 43 } | 42 } |
| 44 | 43 |
| 45 void main() { | 44 void main() { |
| 46 print(new Foo().substring(3)); | 45 print(new Foo().substring(3)); |
| 47 } | 46 } |
| 48 """, | 47 """, |
| 49 }; | 48 }; |
| OLD | NEW |