| 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'; |
| (...skipping 732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 ]); | 743 ]); |
| 744 compiler.resolution.retainCachesForTesting = true; | 744 compiler.resolution.retainCachesForTesting = true; |
| 745 Expect.isTrue(await compiler.run(entryPoint)); | 745 Expect.isTrue(await compiler.run(entryPoint)); |
| 746 JavaScriptBackend backend = compiler.backend; | 746 JavaScriptBackend backend = compiler.backend; |
| 747 KernelToElementMapImpl kernelElementMap = | 747 KernelToElementMapImpl kernelElementMap = |
| 748 new KernelToElementMapImpl(compiler.reporter, compiler.environment); | 748 new KernelToElementMapImpl(compiler.reporter, compiler.environment); |
| 749 kernelElementMap.addProgram(backend.kernelTask.program); | 749 kernelElementMap.addProgram(backend.kernelTask.program); |
| 750 | 750 |
| 751 checkLibrary(compiler, kernelElementMap, compiler.mainApp, | 751 checkLibrary(compiler, kernelElementMap, compiler.mainApp, |
| 752 fullTest: fullTest); | 752 fullTest: fullTest); |
| 753 compiler.libraryLoader.libraries.forEach((LibraryElement library) { | 753 compiler.libraryLoader.libraries.forEach((library) { |
| 754 if (library == compiler.mainApp) return; | 754 if (library == compiler.mainApp) return; |
| 755 checkLibrary(compiler, kernelElementMap, library, fullTest: fullTest); | 755 checkLibrary(compiler, kernelElementMap, library, fullTest: fullTest); |
| 756 }); | 756 }); |
| 757 }); | 757 }); |
| 758 } | 758 } |
| 759 | 759 |
| 760 void checkLibrary(Compiler compiler, KernelToElementMapMixin elementMap, | 760 void checkLibrary(Compiler compiler, KernelToElementMapMixin elementMap, |
| 761 LibraryElement library, | 761 LibraryElement library, |
| 762 {bool fullTest: false}) { | 762 {bool fullTest: false}) { |
| 763 library.forEachLocalMember((AstElement element) { | 763 library.forEachLocalMember((_element) { |
| 764 AstElement element = _element; |
| 764 if (element.isClass) { | 765 if (element.isClass) { |
| 765 ClassElement cls = element; | 766 ClassElement cls = element; |
| 766 cls.forEachLocalMember((AstElement member) { | 767 cls.forEachLocalMember((_member) { |
| 768 AstElement member = _member; |
| 767 checkElement(compiler, elementMap, member, fullTest: fullTest); | 769 checkElement(compiler, elementMap, member, fullTest: fullTest); |
| 768 }); | 770 }); |
| 769 } else if (element.isTypedef) { | 771 } else if (element.isTypedef) { |
| 770 // Skip typedefs. | 772 // Skip typedefs. |
| 771 } else { | 773 } else { |
| 772 checkElement(compiler, elementMap, element, fullTest: fullTest); | 774 checkElement(compiler, elementMap, element, fullTest: fullTest); |
| 773 } | 775 } |
| 774 }); | 776 }); |
| 775 } | 777 } |
| 776 | 778 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 in element.enclosingClass.constructors) { | 858 in element.enclosingClass.constructors) { |
| 857 if (constructor.isGenerativeConstructor && | 859 if (constructor.isGenerativeConstructor && |
| 858 !constructor.isRedirectingGenerative) { | 860 !constructor.isRedirectingGenerative) { |
| 859 for (ParameterElement parameter in constructor.parameters) { | 861 for (ParameterElement parameter in constructor.parameters) { |
| 860 if (parameter is InitializingFormalElement && | 862 if (parameter is InitializingFormalElement && |
| 861 parameter.fieldElement == element) { | 863 parameter.fieldElement == element) { |
| 862 continue OUTER; | 864 continue OUTER; |
| 863 } | 865 } |
| 864 } | 866 } |
| 865 if (constructor.resolvedAst.kind == ResolvedAstKind.PARSED) { | 867 if (constructor.resolvedAst.kind == ResolvedAstKind.PARSED) { |
| 866 var function = constructor.resolvedAst.node; | 868 dynamic function = constructor.resolvedAst.node; |
| 867 if (function.initializers != null) { | 869 if (function.initializers != null) { |
| 868 TreeElements elements = constructor.resolvedAst.elements; | 870 TreeElements elements = constructor.resolvedAst.elements; |
| 869 for (var initializer in function.initializers) { | 871 for (var initializer in function.initializers) { |
| 870 if (elements[initializer] == element) { | 872 if (elements[initializer] == element) { |
| 871 continue OUTER; | 873 continue OUTER; |
| 872 } | 874 } |
| 873 } | 875 } |
| 874 } | 876 } |
| 875 } | 877 } |
| 876 missing = true; | 878 missing = true; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 898 builder.registerFeature(Feature.THROW_EXPRESSION); | 900 builder.registerFeature(Feature.THROW_EXPRESSION); |
| 899 break; | 901 break; |
| 900 default: | 902 default: |
| 901 builder.registerFeature(feature); | 903 builder.registerFeature(feature); |
| 902 break; | 904 break; |
| 903 } | 905 } |
| 904 } | 906 } |
| 905 impact.nativeData.forEach(builder.registerNativeData); | 907 impact.nativeData.forEach(builder.registerNativeData); |
| 906 return builder; | 908 return builder; |
| 907 } | 909 } |
| OLD | NEW |