| 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:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
| 9 import 'compiler_helper.dart'; | 9 import 'compiler_helper.dart'; |
| 10 import 'parser_helper.dart'; | 10 import 'parser_helper.dart'; |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 const String HAS_RUNTIME_TYPE_6 = r""" | 85 const String HAS_RUNTIME_TYPE_6 = r""" |
| 86 class A { | 86 class A { |
| 87 static var foo; | 87 static var foo; |
| 88 } | 88 } |
| 89 main() { | 89 main() { |
| 90 (A).foo; | 90 (A).foo; |
| 91 } | 91 } |
| 92 """; | 92 """; |
| 93 | 93 |
| 94 void test(String code, void check(Compiler compiler)) { | 94 void test(String code, void check(Compiler compiler)) { |
| 95 Uri uri = new Uri.fromComponents(scheme: 'source'); | 95 Uri uri = new Uri(scheme: 'source'); |
| 96 var compiler = compilerFor(code, uri); | 96 var compiler = compilerFor(code, uri); |
| 97 compiler.runCompiler(uri); | 97 compiler.runCompiler(uri); |
| 98 check(compiler); | 98 check(compiler); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void testHasRuntimeType(String code) { | 101 void testHasRuntimeType(String code) { |
| 102 test(code, (compiler) { | 102 test(code, (compiler) { |
| 103 var element = compiler.findHelper(buildSourceString('createRuntimeType')); | 103 var element = compiler.findHelper(buildSourceString('createRuntimeType')); |
| 104 Expect.isTrue(compiler.enqueuer.resolution.isProcessed(element)); | 104 Expect.isTrue(compiler.enqueuer.resolution.isProcessed(element)); |
| 105 }); | 105 }); |
| 106 } | 106 } |
| 107 | 107 |
| 108 main() { | 108 main() { |
| 109 test(NO_RUNTIME_TYPE, (compiler) { | 109 test(NO_RUNTIME_TYPE, (compiler) { |
| 110 var element = compiler.findHelper(buildSourceString('createRuntimeType')); | 110 var element = compiler.findHelper(buildSourceString('createRuntimeType')); |
| 111 Expect.isFalse(compiler.enqueuer.resolution.isProcessed(element)); | 111 Expect.isFalse(compiler.enqueuer.resolution.isProcessed(element)); |
| 112 }); | 112 }); |
| 113 | 113 |
| 114 testHasRuntimeType(HAS_RUNTIME_TYPE_1); | 114 testHasRuntimeType(HAS_RUNTIME_TYPE_1); |
| 115 testHasRuntimeType(HAS_RUNTIME_TYPE_2); | 115 testHasRuntimeType(HAS_RUNTIME_TYPE_2); |
| 116 testHasRuntimeType(HAS_RUNTIME_TYPE_3); | 116 testHasRuntimeType(HAS_RUNTIME_TYPE_3); |
| 117 testHasRuntimeType(HAS_RUNTIME_TYPE_4); | 117 testHasRuntimeType(HAS_RUNTIME_TYPE_4); |
| 118 testHasRuntimeType(HAS_RUNTIME_TYPE_5); | 118 testHasRuntimeType(HAS_RUNTIME_TYPE_5); |
| 119 testHasRuntimeType(HAS_RUNTIME_TYPE_6); | 119 testHasRuntimeType(HAS_RUNTIME_TYPE_6); |
| 120 } | 120 } |
| OLD | NEW |