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:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
8 import "package:async_helper/async_helper.dart"; | 8 import "package:async_helper/async_helper.dart"; |
9 import 'memory_source_file_helper.dart'; | 9 import 'memory_source_file_helper.dart'; |
10 | 10 |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 Compiler compiler = new Compiler(provider.readStringFromUri, | 41 Compiler compiler = new Compiler(provider.readStringFromUri, |
42 outputProvider, | 42 outputProvider, |
43 diagnosticHandler, | 43 diagnosticHandler, |
44 libraryRoot, | 44 libraryRoot, |
45 packageRoot, | 45 packageRoot, |
46 [], | 46 [], |
47 {}); | 47 {}); |
48 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { | 48 asyncTest(() => compiler.run(Uri.parse('memory:main.dart')).then((_) { |
49 Expect.isFalse(compiler.compilationFailed); | 49 Expect.isFalse(compiler.compilationFailed); |
50 Expect.isFalse(compiler.enqueuer.resolution.hasEnqueuedEverything); | 50 Expect.isFalse(compiler.enqueuer.resolution.hasEnqueuedReflectiveElements); |
51 Expect.isFalse(compiler.enqueuer.resolution.hasEnqueuedReflectiveStaticField
s); | 51 Expect.isFalse(compiler.enqueuer.resolution.hasEnqueuedReflectiveStaticField
s); |
52 Expect.isFalse(compiler.enqueuer.codegen.hasEnqueuedEverything); | 52 Expect.isFalse(compiler.enqueuer.codegen.hasEnqueuedReflectiveElements); |
53 Expect.isFalse(compiler.enqueuer.codegen.hasEnqueuedReflectiveStaticFields); | 53 Expect.isFalse(compiler.enqueuer.codegen.hasEnqueuedReflectiveStaticFields); |
54 Expect.isFalse(compiler.disableTypeInference); | 54 Expect.isFalse(compiler.disableTypeInference); |
55 JavaScriptBackend backend = compiler.backend; | 55 JavaScriptBackend backend = compiler.backend; |
56 Expect.isFalse(backend.hasRetainedMetadata); | 56 Expect.isFalse(backend.hasRetainedMetadata); |
57 })); | 57 })); |
58 } | 58 } |
59 | 59 |
60 const Map MEMORY_SOURCE_FILES = const { | 60 const Map MEMORY_SOURCE_FILES = const { |
61 'main.dart': r""" | 61 'main.dart': r""" |
62 import 'dart:mirrors'; | 62 import 'dart:mirrors'; |
63 | 63 |
64 class Foo { | 64 class Foo { |
65 noSuchMethod(invocation) { | 65 noSuchMethod(invocation) { |
66 print('Invoked ${MirrorSystem.getName(invocation.memberName)}'); | 66 print('Invoked ${MirrorSystem.getName(invocation.memberName)}'); |
67 return reflect('foobar').delegate(invocation); | 67 return reflect('foobar').delegate(invocation); |
68 } | 68 } |
69 } | 69 } |
70 | 70 |
71 void main() { | 71 void main() { |
72 print(new Foo().substring(3)); | 72 print(new Foo().substring(3)); |
73 } | 73 } |
74 """, | 74 """, |
75 }; | 75 }; |
OLD | NEW |