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 resolution does not resolve things we know will not be | 5 // Test that resolution does not resolve things we know will not be |
6 // needed by the backend. | 6 // needed by the backend. |
7 | 7 |
8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
10 import 'package:compiler/src/apiimpl.dart'; | 10 import 'package:compiler/src/apiimpl.dart'; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 static var foo; | 88 static var foo; |
89 } | 89 } |
90 main() { | 90 main() { |
91 (A).foo; | 91 (A).foo; |
92 } | 92 } |
93 """; | 93 """; |
94 | 94 |
95 void test(String code, void check(CompilerImpl compiler)) { | 95 void test(String code, void check(CompilerImpl compiler)) { |
96 Uri uri = new Uri(scheme: 'source'); | 96 Uri uri = new Uri(scheme: 'source'); |
97 var compiler = compilerFor(code, uri); | 97 var compiler = compilerFor(code, uri); |
98 asyncTest(() => compiler.runCompiler(uri).then((_) { | 98 asyncTest(() => compiler.run(uri).then((_) { |
99 check(compiler); | 99 check(compiler); |
100 })); | 100 })); |
101 } | 101 } |
102 | 102 |
103 void testHasRuntimeType(String code) { | 103 void testHasRuntimeType(String code) { |
104 test(code, (compiler) { | 104 test(code, (compiler) { |
105 var element = compiler.backend.helpers.createRuntimeType; | 105 var element = compiler.backend.helpers.createRuntimeType; |
106 Expect.isTrue(compiler.enqueuer.resolution.isProcessed(element)); | 106 Expect.isTrue(compiler.enqueuer.resolution.isProcessed(element)); |
107 }); | 107 }); |
108 } | 108 } |
109 | 109 |
110 main() { | 110 main() { |
111 test(NO_RUNTIME_TYPE, (compiler) { | 111 test(NO_RUNTIME_TYPE, (compiler) { |
112 var element = compiler.backend.helpers.createRuntimeType; | 112 var element = compiler.backend.helpers.createRuntimeType; |
113 Expect.isFalse(compiler.enqueuer.resolution.isProcessed(element)); | 113 Expect.isFalse(compiler.enqueuer.resolution.isProcessed(element)); |
114 }); | 114 }); |
115 | 115 |
116 testHasRuntimeType(HAS_RUNTIME_TYPE_1); | 116 testHasRuntimeType(HAS_RUNTIME_TYPE_1); |
117 testHasRuntimeType(HAS_RUNTIME_TYPE_2); | 117 testHasRuntimeType(HAS_RUNTIME_TYPE_2); |
118 testHasRuntimeType(HAS_RUNTIME_TYPE_3); | 118 testHasRuntimeType(HAS_RUNTIME_TYPE_3); |
119 testHasRuntimeType(HAS_RUNTIME_TYPE_4); | 119 testHasRuntimeType(HAS_RUNTIME_TYPE_4); |
120 testHasRuntimeType(HAS_RUNTIME_TYPE_5); | 120 testHasRuntimeType(HAS_RUNTIME_TYPE_5); |
121 testHasRuntimeType(HAS_RUNTIME_TYPE_6); | 121 testHasRuntimeType(HAS_RUNTIME_TYPE_6); |
122 } | 122 } |
OLD | NEW |