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 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
8 import 'package:compiler/src/commandline_options.dart'; | 8 import 'package:compiler/src/commandline_options.dart'; |
9 import 'package:compiler/src/common.dart'; | 9 import 'package:compiler/src/common.dart'; |
10 import 'package:compiler/src/common/names.dart'; | 10 import 'package:compiler/src/common/names.dart'; |
11 import 'package:compiler/src/common/resolution.dart'; | 11 import 'package:compiler/src/common/resolution.dart'; |
12 import 'package:compiler/src/compiler.dart'; | 12 import 'package:compiler/src/compiler.dart'; |
13 import 'package:compiler/src/constants/expressions.dart'; | 13 import 'package:compiler/src/constants/expressions.dart'; |
14 import 'package:compiler/src/elements/elements.dart'; | 14 import 'package:compiler/src/elements/elements.dart'; |
| 15 import 'package:compiler/src/elements/entities.dart'; |
15 import 'package:compiler/src/elements/resolution_types.dart'; | 16 import 'package:compiler/src/elements/resolution_types.dart'; |
16 import 'package:compiler/src/js_backend/backend.dart'; | 17 import 'package:compiler/src/js_backend/backend.dart'; |
17 import 'package:compiler/src/kernel/element_map.dart'; | 18 import 'package:compiler/src/kernel/element_map.dart'; |
18 import 'package:compiler/src/kernel/element_map_impl.dart'; | 19 import 'package:compiler/src/kernel/element_map_impl.dart'; |
19 import 'package:compiler/src/resolution/registry.dart'; | 20 import 'package:compiler/src/resolution/registry.dart'; |
20 import 'package:compiler/src/resolution/tree_elements.dart'; | 21 import 'package:compiler/src/resolution/tree_elements.dart'; |
21 import 'package:compiler/src/ssa/kernel_impact.dart'; | 22 import 'package:compiler/src/ssa/kernel_impact.dart'; |
22 import 'package:compiler/src/serialization/equivalence.dart'; | 23 import 'package:compiler/src/serialization/equivalence.dart'; |
23 import 'package:compiler/src/universe/call_structure.dart'; | 24 import 'package:compiler/src/universe/call_structure.dart'; |
24 import 'package:compiler/src/universe/feature.dart'; | 25 import 'package:compiler/src/universe/feature.dart'; |
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 Flags.useKernel, | 742 Flags.useKernel, |
742 Flags.enableAssertMessage | 743 Flags.enableAssertMessage |
743 ]); | 744 ]); |
744 compiler.resolution.retainCachesForTesting = true; | 745 compiler.resolution.retainCachesForTesting = true; |
745 Expect.isTrue(await compiler.run(entryPoint)); | 746 Expect.isTrue(await compiler.run(entryPoint)); |
746 JavaScriptBackend backend = compiler.backend; | 747 JavaScriptBackend backend = compiler.backend; |
747 KernelToElementMapImpl kernelElementMap = | 748 KernelToElementMapImpl kernelElementMap = |
748 new KernelToElementMapImpl(compiler.reporter, compiler.environment); | 749 new KernelToElementMapImpl(compiler.reporter, compiler.environment); |
749 kernelElementMap.addProgram(backend.kernelTask.program); | 750 kernelElementMap.addProgram(backend.kernelTask.program); |
750 | 751 |
751 checkLibrary(compiler, kernelElementMap, compiler.mainApp, | 752 LibraryElement mainApp = |
752 fullTest: fullTest); | 753 compiler.frontendStrategy.elementEnvironment.mainLibrary; |
753 compiler.libraryLoader.libraries.forEach((library) { | 754 checkLibrary(compiler, kernelElementMap, mainApp, fullTest: fullTest); |
754 if (library == compiler.mainApp) return; | 755 compiler.libraryLoader.libraries.forEach((LibraryEntity library) { |
| 756 if (library == mainApp) return; |
755 checkLibrary(compiler, kernelElementMap, library, fullTest: fullTest); | 757 checkLibrary(compiler, kernelElementMap, library, fullTest: fullTest); |
756 }); | 758 }); |
757 }); | 759 }); |
758 } | 760 } |
759 | 761 |
760 void checkLibrary(Compiler compiler, KernelToElementMapMixin elementMap, | 762 void checkLibrary(Compiler compiler, KernelToElementMapMixin elementMap, |
761 LibraryElement library, | 763 LibraryElement library, |
762 {bool fullTest: false}) { | 764 {bool fullTest: false}) { |
763 library.forEachLocalMember((_element) { | 765 library.forEachLocalMember((_element) { |
764 AstElement element = _element; | 766 AstElement element = _element; |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 builder.registerFeature(Feature.THROW_EXPRESSION); | 902 builder.registerFeature(Feature.THROW_EXPRESSION); |
901 break; | 903 break; |
902 default: | 904 default: |
903 builder.registerFeature(feature); | 905 builder.registerFeature(feature); |
904 break; | 906 break; |
905 } | 907 } |
906 } | 908 } |
907 impact.nativeData.forEach(builder.registerNativeData); | 909 impact.nativeData.forEach(builder.registerNativeData); |
908 return builder; | 910 return builder; |
909 } | 911 } |
OLD | NEW |