| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library dart2js.kernel.impact_test; | 5 library dart2js.kernel.impact_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
| 9 import 'package:compiler/src/common.dart'; | 9 import 'package:compiler/src/common.dart'; |
| 10 import 'package:compiler/src/commandline_options.dart'; | 10 import 'package:compiler/src/commandline_options.dart'; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 ''' | 157 ''' |
| 158 }; | 158 }; |
| 159 | 159 |
| 160 main(List<String> args) { | 160 main(List<String> args) { |
| 161 asyncTest(() async { | 161 asyncTest(() async { |
| 162 enableDebugMode(); | 162 enableDebugMode(); |
| 163 Uri entryPoint = Uri.parse('memory:main.dart'); | 163 Uri entryPoint = Uri.parse('memory:main.dart'); |
| 164 Compiler compiler = compilerFor( | 164 Compiler compiler = compilerFor( |
| 165 entryPoint: entryPoint, | 165 entryPoint: entryPoint, |
| 166 memorySourceFiles: SOURCE, | 166 memorySourceFiles: SOURCE, |
| 167 options: | 167 options: [ |
| 168 [Flags.analyzeAll, Flags.useKernel, Flags.enableAssertMessage]); | 168 Flags.analyzeAll, |
| 169 Flags.useKernel, |
| 170 Flags.enableAssertMessage |
| 171 ]); |
| 169 compiler.resolution.retainCachesForTesting = true; | 172 compiler.resolution.retainCachesForTesting = true; |
| 170 await compiler.run(entryPoint); | 173 await compiler.run(entryPoint); |
| 171 checkLibrary(compiler, compiler.mainApp); | 174 checkLibrary(compiler, compiler.mainApp); |
| 172 }); | 175 }); |
| 173 } | 176 } |
| 174 | 177 |
| 175 void checkLibrary(Compiler compiler, LibraryElement library) { | 178 void checkLibrary(Compiler compiler, LibraryElement library) { |
| 176 library.forEachLocalMember((AstElement element) { | 179 library.forEachLocalMember((AstElement element) { |
| 177 if (element.isClass) { | 180 if (element.isClass) { |
| 178 // TODO(johnniwinther): Handle class members. | 181 // TODO(johnniwinther): Handle class members. |
| 179 } else { | 182 } else { |
| 180 checkElement(compiler, element); | 183 checkElement(compiler, element); |
| 181 } | 184 } |
| 182 }); | 185 }); |
| 183 } | 186 } |
| 184 | 187 |
| 185 void checkElement(Compiler compiler, AstElement element) { | 188 void checkElement(Compiler compiler, AstElement element) { |
| 186 ResolutionImpact astImpact = compiler.resolution.getResolutionImpact(element); | 189 ResolutionImpact astImpact = compiler.resolution.getResolutionImpact(element); |
| 187 ResolutionImpact kernelImpact = build(compiler, element.resolvedAst); | 190 ResolutionImpact kernelImpact = build(compiler, element.resolvedAst); |
| 188 testResolutionImpactEquivalence( | 191 testResolutionImpactEquivalence( |
| 189 astImpact, kernelImpact, const CheckStrategy()); | 192 astImpact, kernelImpact, const CheckStrategy()); |
| 190 } | 193 } |
| OLD | NEW |