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 'memory_source_file_helper.dart'; | 8 import 'memory_source_file_helper.dart'; |
9 | 9 |
10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 10 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' |
(...skipping 22 matching lines...) Expand all Loading... |
33 EventSink<String> outputProvider(String name, String extension) { | 33 EventSink<String> outputProvider(String name, String extension) { |
34 return new NullSink('$name.$extension'); | 34 return new NullSink('$name.$extension'); |
35 } | 35 } |
36 | 36 |
37 Compiler compiler = new Compiler(provider.readStringFromUri, | 37 Compiler compiler = new Compiler(provider.readStringFromUri, |
38 outputProvider, | 38 outputProvider, |
39 diagnosticHandler, | 39 diagnosticHandler, |
40 libraryRoot, | 40 libraryRoot, |
41 packageRoot, | 41 packageRoot, |
42 []); | 42 []); |
43 compiler.run(Uri.parse('memory:main.dart')); | 43 compiler.run(Uri.parse('memory:main.dart')).then((_) { |
44 Expect.isFalse(compiler.compilationFailed); | 44 Expect.isFalse(compiler.compilationFailed); |
45 Expect.isFalse(compiler.enqueuer.resolution.hasEnqueuedEverything); | 45 Expect.isFalse(compiler.enqueuer.resolution.hasEnqueuedEverything); |
46 Expect.isFalse(compiler.enqueuer.codegen.hasEnqueuedEverything); | 46 Expect.isFalse(compiler.enqueuer.codegen.hasEnqueuedEverything); |
47 Expect.isFalse(compiler.disableTypeInference); | 47 Expect.isFalse(compiler.disableTypeInference); |
| 48 }); |
48 } | 49 } |
49 | 50 |
50 const Map MEMORY_SOURCE_FILES = const { | 51 const Map MEMORY_SOURCE_FILES = const { |
51 'main.dart': r""" | 52 'main.dart': r""" |
52 import 'dart:mirrors'; | 53 import 'dart:mirrors'; |
53 | 54 |
54 class Foo { | 55 class Foo { |
55 noSuchMethod(invocation) { | 56 noSuchMethod(invocation) { |
56 print('Invoked ${MirrorSystem.getName(invocation.memberName)}'); | 57 print('Invoked ${MirrorSystem.getName(invocation.memberName)}'); |
57 return reflect('foobar').delegate(invocation); | 58 return reflect('foobar').delegate(invocation); |
58 } | 59 } |
59 } | 60 } |
60 | 61 |
61 void main() { | 62 void main() { |
62 print(new Foo().substring(3)); | 63 print(new Foo().substring(3)); |
63 } | 64 } |
64 """, | 65 """, |
65 }; | 66 }; |
OLD | NEW |