| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer.src.task.dart; | 5 library analyzer.src.task.dart; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 /** | 216 /** |
| 217 * The flag specifying that [RESOLVED_UNIT11] has been been computed for this | 217 * The flag specifying that [RESOLVED_UNIT11] has been been computed for this |
| 218 * compilation unit (without requiring that the AST for it still be in cache). | 218 * compilation unit (without requiring that the AST for it still be in cache). |
| 219 * | 219 * |
| 220 * The result is only available for [LibrarySpecificUnit]s. | 220 * The result is only available for [LibrarySpecificUnit]s. |
| 221 */ | 221 */ |
| 222 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT11 = | 222 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT11 = |
| 223 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT11', false); | 223 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT11', false); |
| 224 | 224 |
| 225 /** | 225 /** |
| 226 * The flag specifying that [RESOLVED_UNIT12] has been been computed for this |
| 227 * compilation unit (without requiring that the AST for it still be in cache). |
| 228 * |
| 229 * The result is only available for [LibrarySpecificUnit]s. |
| 230 */ |
| 231 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT12 = |
| 232 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT12', false); |
| 233 |
| 234 /** |
| 226 * The flag specifying that [RESOLVED_UNIT2] has been been computed for this | 235 * The flag specifying that [RESOLVED_UNIT2] has been been computed for this |
| 227 * compilation unit (without requiring that the AST for it still be in cache). | 236 * compilation unit (without requiring that the AST for it still be in cache). |
| 228 * | 237 * |
| 229 * The result is only available for [LibrarySpecificUnit]s. | 238 * The result is only available for [LibrarySpecificUnit]s. |
| 230 */ | 239 */ |
| 231 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT2 = | 240 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT2 = |
| 232 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT2', false); | 241 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT2', false); |
| 233 | 242 |
| 234 /** | 243 /** |
| 235 * The flag specifying that [RESOLVED_UNIT3] has been been computed for this | 244 * The flag specifying that [RESOLVED_UNIT3] has been been computed for this |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 635 * at all declaration sites have been bound to the element defined by the | 644 * at all declaration sites have been bound to the element defined by the |
| 636 * declaration, except for the constants defined in an 'enum' declaration. | 645 * declaration, except for the constants defined in an 'enum' declaration. |
| 637 * | 646 * |
| 638 * The result is only available for [LibrarySpecificUnit]s. | 647 * The result is only available for [LibrarySpecificUnit]s. |
| 639 */ | 648 */ |
| 640 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT1 = | 649 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT1 = |
| 641 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT1', null, | 650 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT1', null, |
| 642 cachingPolicy: AST_CACHING_POLICY); | 651 cachingPolicy: AST_CACHING_POLICY); |
| 643 | 652 |
| 644 /** | 653 /** |
| 645 * The resolved [CompilationUnit] associated with a compilation unit, with | 654 * The resolved [CompilationUnit] associated with a compilation unit in which |
| 646 * constants not yet resolved. | 655 * the types of class members have been inferred in addition to everything that |
| 656 * is true of a [RESOLVED_UNIT9]. |
| 647 * | 657 * |
| 648 * The result is only available for [LibrarySpecificUnit]s. | 658 * The result is only available for [LibrarySpecificUnit]s. |
| 649 */ | 659 */ |
| 650 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT10 = | 660 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT10 = |
| 651 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT10', null, | 661 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT10', null, |
| 652 cachingPolicy: AST_CACHING_POLICY); | 662 cachingPolicy: AST_CACHING_POLICY); |
| 653 | 663 |
| 654 /** | 664 /** |
| 655 * The resolved [CompilationUnit] associated with a compilation unit, with | 665 * The resolved [CompilationUnit] associated with a compilation unit, with |
| 656 * constants resolved. | 666 * constants not yet resolved. |
| 657 * | 667 * |
| 658 * The result is only available for [LibrarySpecificUnit]s. | 668 * The result is only available for [LibrarySpecificUnit]s. |
| 659 */ | 669 */ |
| 660 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT11 = | 670 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT11 = |
| 661 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT11', null, | 671 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT11', null, |
| 662 cachingPolicy: AST_CACHING_POLICY); | 672 cachingPolicy: AST_CACHING_POLICY); |
| 663 | 673 |
| 664 /** | 674 /** |
| 675 * The resolved [CompilationUnit] associated with a compilation unit, with |
| 676 * constants resolved. |
| 677 * |
| 678 * The result is only available for [LibrarySpecificUnit]s. |
| 679 */ |
| 680 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT12 = |
| 681 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT12', null, |
| 682 cachingPolicy: AST_CACHING_POLICY); |
| 683 |
| 684 /** |
| 665 * The partially resolved [CompilationUnit] associated with a compilation unit. | 685 * The partially resolved [CompilationUnit] associated with a compilation unit. |
| 666 * | 686 * |
| 667 * Tasks that use this value as an input can assume that the [SimpleIdentifier]s | 687 * In addition to what is true of a [RESOLVED_UNIT1], tasks that use this value |
| 668 * at all declaration sites have been bound to the element defined by the | 688 * as an input can assume that its directives have been resolved. |
| 669 * declaration, including the constants defined in an 'enum' declaration. | |
| 670 * | 689 * |
| 671 * The result is only available for [LibrarySpecificUnit]s. | 690 * The result is only available for [LibrarySpecificUnit]s. |
| 672 */ | 691 */ |
| 673 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT2 = | 692 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT2 = |
| 674 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT2', null, | 693 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT2', null, |
| 675 cachingPolicy: AST_CACHING_POLICY); | 694 cachingPolicy: AST_CACHING_POLICY); |
| 676 | 695 |
| 677 /** | 696 /** |
| 678 * The partially resolved [CompilationUnit] associated with a compilation unit. | 697 * The partially resolved [CompilationUnit] associated with a compilation unit. |
| 679 * | 698 * |
| 680 * In addition to what is true of a [RESOLVED_UNIT2], tasks that use this value | 699 * Tasks that use this value as an input can assume that the [SimpleIdentifier]s |
| 681 * as an input can assume that the types associated with declarations have been | 700 * at all declaration sites have been bound to the element defined by the |
| 682 * resolved. This includes the types of superclasses, mixins, interfaces, | 701 * declaration, including the constants defined in an 'enum' declaration. |
| 683 * fields, return types, parameters, and local variables. | |
| 684 * | 702 * |
| 685 * The result is only available for [LibrarySpecificUnit]s. | 703 * The result is only available for [LibrarySpecificUnit]s. |
| 686 */ | 704 */ |
| 687 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT3 = | 705 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT3 = |
| 688 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT3', null, | 706 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT3', null, |
| 689 cachingPolicy: AST_CACHING_POLICY); | 707 cachingPolicy: AST_CACHING_POLICY); |
| 690 | 708 |
| 691 /** | 709 /** |
| 692 * The partially resolved [CompilationUnit] associated with a compilation unit. | 710 * The partially resolved [CompilationUnit] associated with a compilation unit. |
| 693 * | 711 * |
| 694 * In addition to what is true of a [RESOLVED_UNIT3], tasks that use this value | 712 * In addition to what is true of a [RESOLVED_UNIT3], tasks that use this value |
| 695 * as an input can assume that references to local variables and formal | 713 * as an input can assume that the types associated with declarations have been |
| 696 * parameters have been resolved. | 714 * resolved. This includes the types of superclasses, mixins, interfaces, |
| 715 * fields, return types, parameters, and local variables. |
| 697 * | 716 * |
| 698 * The result is only available for [LibrarySpecificUnit]s. | 717 * The result is only available for [LibrarySpecificUnit]s. |
| 699 */ | 718 */ |
| 700 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT4 = | 719 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT4 = |
| 701 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT4', null, | 720 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT4', null, |
| 702 cachingPolicy: AST_CACHING_POLICY); | 721 cachingPolicy: AST_CACHING_POLICY); |
| 703 | 722 |
| 704 /** | 723 /** |
| 705 * The partially resolved [CompilationUnit] associated with a compilation unit. | 724 * The partially resolved [CompilationUnit] associated with a compilation unit. |
| 706 * | 725 * |
| 707 * In addition to what is true of a [RESOLVED_UNIT4], tasks that use this value | 726 * In addition to what is true of a [RESOLVED_UNIT4], tasks that use this value |
| 708 * as an input can assume that elements and types associated with expressions | 727 * as an input can assume that references to local variables and formal |
| 709 * outside of method bodies (essentially initializers) have been initially | 728 * parameters have been resolved. |
| 710 * resolved. | |
| 711 * | 729 * |
| 712 * The result is only available for [LibrarySpecificUnit]s. | 730 * The result is only available for [LibrarySpecificUnit]s. |
| 713 */ | 731 */ |
| 714 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 = | 732 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 = |
| 715 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, | 733 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, |
| 716 cachingPolicy: AST_CACHING_POLICY); | 734 cachingPolicy: AST_CACHING_POLICY); |
| 717 | 735 |
| 718 /** | 736 /** |
| 719 * The partially resolved [CompilationUnit] associated with a compilation unit. | 737 * The partially resolved [CompilationUnit] associated with a compilation unit. |
| 720 * | 738 * |
| 721 * In addition to what is true of a [RESOLVED_UNIT5], tasks that use this value | 739 * In addition to what is true of a [RESOLVED_UNIT5], tasks that use this value |
| 722 * as an input can assume that the types of final variables have been | 740 * as an input can assume that elements and types associated with expressions |
| 723 * propagated. | 741 * outside of method bodies (essentially initializers) have been initially |
| 742 * resolved. |
| 724 * | 743 * |
| 725 * The result is only available for [LibrarySpecificUnit]s. | 744 * The result is only available for [LibrarySpecificUnit]s. |
| 726 */ | 745 */ |
| 727 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT6 = | 746 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT6 = |
| 728 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT6', null, | 747 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT6', null, |
| 729 cachingPolicy: AST_CACHING_POLICY); | 748 cachingPolicy: AST_CACHING_POLICY); |
| 730 | 749 |
| 731 /** | 750 /** |
| 732 * The partially resolved [CompilationUnit] associated with a compilation unit. | 751 * The partially resolved [CompilationUnit] associated with a compilation unit. |
| 733 * | 752 * |
| 734 * In addition to what is true of a [RESOLVED_UNIT6], tasks that use this value | 753 * In addition to what is true of a [RESOLVED_UNIT6], tasks that use this value |
| 735 * as an input can assume that the types of static variables have been inferred. | 754 * as an input can assume that the types of final variables have been |
| 755 * propagated. |
| 736 * | 756 * |
| 737 * The result is only available for [LibrarySpecificUnit]s. | 757 * The result is only available for [LibrarySpecificUnit]s. |
| 738 */ | 758 */ |
| 739 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT7 = | 759 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT7 = |
| 740 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT7', null, | 760 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT7', null, |
| 741 cachingPolicy: AST_CACHING_POLICY); | 761 cachingPolicy: AST_CACHING_POLICY); |
| 742 | 762 |
| 743 /** | 763 /** |
| 744 * The partially resolved [CompilationUnit] associated with a compilation unit. | 764 * The partially resolved [CompilationUnit] associated with a compilation unit. |
| 745 * | 765 * |
| 746 * In addition to what is true of a [RESOLVED_UNIT7], tasks that use this value | 766 * In addition to what is true of a [RESOLVED_UNIT7], tasks that use this value |
| 747 * as an input can assume that the initializers of instance variables have been | 767 * as an input can assume that the types of static variables have been inferred. |
| 748 * re-resolved. | |
| 749 * | 768 * |
| 750 * The result is only available for [LibrarySpecificUnit]s. | 769 * The result is only available for [LibrarySpecificUnit]s. |
| 751 */ | 770 */ |
| 752 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT8 = | 771 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT8 = |
| 753 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT8', null, | 772 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT8', null, |
| 754 cachingPolicy: AST_CACHING_POLICY); | 773 cachingPolicy: AST_CACHING_POLICY); |
| 755 | 774 |
| 756 /** | 775 /** |
| 757 * The resolved [CompilationUnit] associated with a compilation unit in which | 776 * The partially resolved [CompilationUnit] associated with a compilation unit. |
| 758 * the types of class members have been inferred in addition to everything that | 777 * |
| 759 * is true of a [RESOLVED_UNIT8]. | 778 * In addition to what is true of a [RESOLVED_UNIT8], tasks that use this value |
| 779 * as an input can assume that the initializers of instance variables have been |
| 780 * re-resolved. |
| 760 * | 781 * |
| 761 * The result is only available for [LibrarySpecificUnit]s. | 782 * The result is only available for [LibrarySpecificUnit]s. |
| 762 */ | 783 */ |
| 763 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT9 = | 784 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT9 = |
| 764 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT9', null, | 785 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT9', null, |
| 765 cachingPolicy: AST_CACHING_POLICY); | 786 cachingPolicy: AST_CACHING_POLICY); |
| 766 | 787 |
| 767 /** | 788 /** |
| 768 * The errors produced while scanning a compilation unit. | 789 * The errors produced while scanning a compilation unit. |
| 769 * | 790 * |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 */ | 1139 */ |
| 1119 static const String UNIT_INPUT = 'UNIT_INPUT'; | 1140 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 1120 | 1141 |
| 1121 /** | 1142 /** |
| 1122 * The task descriptor describing this kind of task. | 1143 * The task descriptor describing this kind of task. |
| 1123 */ | 1144 */ |
| 1124 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1145 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1125 'BuildEnumMemberElementsTask', | 1146 'BuildEnumMemberElementsTask', |
| 1126 createTask, | 1147 createTask, |
| 1127 buildInputs, | 1148 buildInputs, |
| 1128 <ResultDescriptor>[CREATED_RESOLVED_UNIT2, RESOLVED_UNIT2]); | 1149 <ResultDescriptor>[CREATED_RESOLVED_UNIT3, RESOLVED_UNIT3]); |
| 1129 | 1150 |
| 1130 BuildEnumMemberElementsTask( | 1151 BuildEnumMemberElementsTask( |
| 1131 InternalAnalysisContext context, AnalysisTarget target) | 1152 InternalAnalysisContext context, AnalysisTarget target) |
| 1132 : super(context, target); | 1153 : super(context, target); |
| 1133 | 1154 |
| 1134 @override | 1155 @override |
| 1135 TaskDescriptor get descriptor => DESCRIPTOR; | 1156 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1136 | 1157 |
| 1137 @override | 1158 @override |
| 1138 void internalPerform() { | 1159 void internalPerform() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1153 return null; | 1174 return null; |
| 1154 } | 1175 } |
| 1155 EnumDeclaration firstEnum = findFirstEnum(); | 1176 EnumDeclaration firstEnum = findFirstEnum(); |
| 1156 if (firstEnum != null && firstEnum.element.accessors.isEmpty) { | 1177 if (firstEnum != null && firstEnum.element.accessors.isEmpty) { |
| 1157 EnumMemberBuilder builder = new EnumMemberBuilder(typeProvider); | 1178 EnumMemberBuilder builder = new EnumMemberBuilder(typeProvider); |
| 1158 unit.accept(builder); | 1179 unit.accept(builder); |
| 1159 } | 1180 } |
| 1160 // | 1181 // |
| 1161 // Record outputs. | 1182 // Record outputs. |
| 1162 // | 1183 // |
| 1163 outputs[CREATED_RESOLVED_UNIT2] = true; | 1184 outputs[CREATED_RESOLVED_UNIT3] = true; |
| 1164 outputs[RESOLVED_UNIT2] = unit; | 1185 outputs[RESOLVED_UNIT3] = unit; |
| 1165 } | 1186 } |
| 1166 | 1187 |
| 1167 /** | 1188 /** |
| 1168 * Return a map from the names of the inputs of this kind of task to the task | 1189 * Return a map from the names of the inputs of this kind of task to the task |
| 1169 * input descriptors describing those inputs for a task with the | 1190 * input descriptors describing those inputs for a task with the |
| 1170 * given [target]. | 1191 * given [target]. |
| 1171 */ | 1192 */ |
| 1172 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 1193 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 1173 LibrarySpecificUnit unit = target; | 1194 LibrarySpecificUnit unit = target; |
| 1174 return <String, TaskInput>{ | 1195 return <String, TaskInput>{ |
| 1175 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 1196 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 1176 UNIT_INPUT: RESOLVED_UNIT1.of(unit) | 1197 UNIT_INPUT: RESOLVED_UNIT2.of(unit) |
| 1177 }; | 1198 }; |
| 1178 } | 1199 } |
| 1179 | 1200 |
| 1180 /** | 1201 /** |
| 1181 * Create a [BuildEnumMemberElementsTask] based on the given [target] in | 1202 * Create a [BuildEnumMemberElementsTask] based on the given [target] in |
| 1182 * the given [context]. | 1203 * the given [context]. |
| 1183 */ | 1204 */ |
| 1184 static BuildEnumMemberElementsTask createTask( | 1205 static BuildEnumMemberElementsTask createTask( |
| 1185 AnalysisContext context, AnalysisTarget target) { | 1206 AnalysisContext context, AnalysisTarget target) { |
| 1186 return new BuildEnumMemberElementsTask(context, target); | 1207 return new BuildEnumMemberElementsTask(context, target); |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1871 } | 1892 } |
| 1872 } | 1893 } |
| 1873 | 1894 |
| 1874 /** | 1895 /** |
| 1875 * A task that computes the [INFERABLE_STATIC_VARIABLE_DEPENDENCIES] for a | 1896 * A task that computes the [INFERABLE_STATIC_VARIABLE_DEPENDENCIES] for a |
| 1876 * static variable whose type should be inferred. | 1897 * static variable whose type should be inferred. |
| 1877 */ | 1898 */ |
| 1878 class ComputeInferableStaticVariableDependenciesTask | 1899 class ComputeInferableStaticVariableDependenciesTask |
| 1879 extends InferStaticVariableTask { | 1900 extends InferStaticVariableTask { |
| 1880 /** | 1901 /** |
| 1881 * The name of the [RESOLVED_UNIT5] input. | 1902 * The name of the [RESOLVED_UNIT6] input. |
| 1882 */ | 1903 */ |
| 1883 static const String UNIT_INPUT = 'UNIT_INPUT'; | 1904 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 1884 | 1905 |
| 1885 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1906 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1886 'ComputeInferableStaticVariableDependenciesTask', | 1907 'ComputeInferableStaticVariableDependenciesTask', |
| 1887 createTask, | 1908 createTask, |
| 1888 buildInputs, | 1909 buildInputs, |
| 1889 <ResultDescriptor>[INFERABLE_STATIC_VARIABLE_DEPENDENCIES]); | 1910 <ResultDescriptor>[INFERABLE_STATIC_VARIABLE_DEPENDENCIES]); |
| 1890 | 1911 |
| 1891 ComputeInferableStaticVariableDependenciesTask( | 1912 ComputeInferableStaticVariableDependenciesTask( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1925 /** | 1946 /** |
| 1926 * Return a map from the names of the inputs of this kind of task to the task | 1947 * Return a map from the names of the inputs of this kind of task to the task |
| 1927 * input descriptors describing those inputs for a task with the | 1948 * input descriptors describing those inputs for a task with the |
| 1928 * given [target]. | 1949 * given [target]. |
| 1929 */ | 1950 */ |
| 1930 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 1951 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 1931 if (target is VariableElement) { | 1952 if (target is VariableElement) { |
| 1932 CompilationUnitElementImpl unit = target | 1953 CompilationUnitElementImpl unit = target |
| 1933 .getAncestor((Element element) => element is CompilationUnitElement); | 1954 .getAncestor((Element element) => element is CompilationUnitElement); |
| 1934 return <String, TaskInput>{ | 1955 return <String, TaskInput>{ |
| 1935 UNIT_INPUT: RESOLVED_UNIT5 | 1956 UNIT_INPUT: RESOLVED_UNIT6 |
| 1936 .of(new LibrarySpecificUnit(unit.librarySource, unit.source)) | 1957 .of(new LibrarySpecificUnit(unit.librarySource, unit.source)) |
| 1937 }; | 1958 }; |
| 1938 } | 1959 } |
| 1939 throw new AnalysisException( | 1960 throw new AnalysisException( |
| 1940 'Cannot build inputs for a ${target.runtimeType}'); | 1961 'Cannot build inputs for a ${target.runtimeType}'); |
| 1941 } | 1962 } |
| 1942 | 1963 |
| 1943 /** | 1964 /** |
| 1944 * Create a [ComputeInferableStaticVariableDependenciesTask] based on the | 1965 * Create a [ComputeInferableStaticVariableDependenciesTask] based on the |
| 1945 * given [target] in the given [context]. | 1966 * given [target] in the given [context]. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2055 return new ComputeLibraryCycleTask(context, target); | 2076 return new ComputeLibraryCycleTask(context, target); |
| 2056 } | 2077 } |
| 2057 } | 2078 } |
| 2058 | 2079 |
| 2059 /** | 2080 /** |
| 2060 * A task that computes the [PROPAGABLE_VARIABLE_DEPENDENCIES] for a variable. | 2081 * A task that computes the [PROPAGABLE_VARIABLE_DEPENDENCIES] for a variable. |
| 2061 */ | 2082 */ |
| 2062 class ComputePropagableVariableDependenciesTask | 2083 class ComputePropagableVariableDependenciesTask |
| 2063 extends InferStaticVariableTask { | 2084 extends InferStaticVariableTask { |
| 2064 /** | 2085 /** |
| 2065 * The name of the [RESOLVED_UNIT5] input. | 2086 * The name of the [RESOLVED_UNIT6] input. |
| 2066 */ | 2087 */ |
| 2067 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2088 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2068 | 2089 |
| 2069 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2090 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2070 'ComputePropagableVariableDependenciesTask', | 2091 'ComputePropagableVariableDependenciesTask', |
| 2071 createTask, | 2092 createTask, |
| 2072 buildInputs, | 2093 buildInputs, |
| 2073 <ResultDescriptor>[PROPAGABLE_VARIABLE_DEPENDENCIES]); | 2094 <ResultDescriptor>[PROPAGABLE_VARIABLE_DEPENDENCIES]); |
| 2074 | 2095 |
| 2075 ComputePropagableVariableDependenciesTask( | 2096 ComputePropagableVariableDependenciesTask( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2110 /** | 2131 /** |
| 2111 * Return a map from the names of the inputs of this kind of task to the task | 2132 * Return a map from the names of the inputs of this kind of task to the task |
| 2112 * input descriptors describing those inputs for a task with the | 2133 * input descriptors describing those inputs for a task with the |
| 2113 * given [target]. | 2134 * given [target]. |
| 2114 */ | 2135 */ |
| 2115 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 2136 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2116 if (target is VariableElement) { | 2137 if (target is VariableElement) { |
| 2117 CompilationUnitElementImpl unit = target | 2138 CompilationUnitElementImpl unit = target |
| 2118 .getAncestor((Element element) => element is CompilationUnitElement); | 2139 .getAncestor((Element element) => element is CompilationUnitElement); |
| 2119 return <String, TaskInput>{ | 2140 return <String, TaskInput>{ |
| 2120 UNIT_INPUT: RESOLVED_UNIT5 | 2141 UNIT_INPUT: RESOLVED_UNIT6 |
| 2121 .of(new LibrarySpecificUnit(unit.librarySource, unit.source)) | 2142 .of(new LibrarySpecificUnit(unit.librarySource, unit.source)) |
| 2122 }; | 2143 }; |
| 2123 } | 2144 } |
| 2124 throw new AnalysisException( | 2145 throw new AnalysisException( |
| 2125 'Cannot build inputs for a ${target.runtimeType}'); | 2146 'Cannot build inputs for a ${target.runtimeType}'); |
| 2126 } | 2147 } |
| 2127 | 2148 |
| 2128 /** | 2149 /** |
| 2129 * Create a [ComputePropagableVariableDependenciesTask] based on the | 2150 * Create a [ComputePropagableVariableDependenciesTask] based on the |
| 2130 * given [target] in the given [context]. | 2151 * given [target] in the given [context]. |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2476 * Create a [DartErrorsTask] based on the given [target] in the given | 2497 * Create a [DartErrorsTask] based on the given [target] in the given |
| 2477 * [context]. | 2498 * [context]. |
| 2478 */ | 2499 */ |
| 2479 static DartErrorsTask createTask( | 2500 static DartErrorsTask createTask( |
| 2480 AnalysisContext context, AnalysisTarget target) { | 2501 AnalysisContext context, AnalysisTarget target) { |
| 2481 return new DartErrorsTask(context, target); | 2502 return new DartErrorsTask(context, target); |
| 2482 } | 2503 } |
| 2483 } | 2504 } |
| 2484 | 2505 |
| 2485 /** | 2506 /** |
| 2486 * A task that builds [RESOLVED_UNIT11] for a unit. | 2507 * A task that builds [RESOLVED_UNIT12] for a unit. |
| 2487 */ | 2508 */ |
| 2488 class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { | 2509 class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { |
| 2489 /** | 2510 /** |
| 2490 * The name of the [RESOLVED_UNIT10] input. | 2511 * The name of the [RESOLVED_UNIT11] input. |
| 2491 */ | 2512 */ |
| 2492 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2513 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2493 | 2514 |
| 2494 /** | 2515 /** |
| 2495 * The name of the [CONSTANT_VALUE] input. | 2516 * The name of the [CONSTANT_VALUE] input. |
| 2496 */ | 2517 */ |
| 2497 static const String CONSTANT_VALUES = 'CONSTANT_VALUES'; | 2518 static const String CONSTANT_VALUES = 'CONSTANT_VALUES'; |
| 2498 | 2519 |
| 2499 /** | 2520 /** |
| 2500 * The task descriptor describing this kind of task. | 2521 * The task descriptor describing this kind of task. |
| 2501 */ | 2522 */ |
| 2502 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2523 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2503 'EvaluateUnitConstantsTask', | 2524 'EvaluateUnitConstantsTask', |
| 2504 createTask, | 2525 createTask, |
| 2505 buildInputs, | 2526 buildInputs, |
| 2506 <ResultDescriptor>[CREATED_RESOLVED_UNIT11, RESOLVED_UNIT11]); | 2527 <ResultDescriptor>[CREATED_RESOLVED_UNIT12, RESOLVED_UNIT12]); |
| 2507 | 2528 |
| 2508 EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target) | 2529 EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target) |
| 2509 : super(context, target); | 2530 : super(context, target); |
| 2510 | 2531 |
| 2511 @override | 2532 @override |
| 2512 TaskDescriptor get descriptor => DESCRIPTOR; | 2533 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2513 | 2534 |
| 2514 @override | 2535 @override |
| 2515 void internalPerform() { | 2536 void internalPerform() { |
| 2516 // No actual work needs to be performed; the task manager will ensure that | 2537 // No actual work needs to be performed; the task manager will ensure that |
| 2517 // all constants are evaluated before this method is called. | 2538 // all constants are evaluated before this method is called. |
| 2518 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 2539 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 2519 outputs[RESOLVED_UNIT11] = unit; | 2540 outputs[RESOLVED_UNIT12] = unit; |
| 2520 outputs[CREATED_RESOLVED_UNIT11] = true; | 2541 outputs[CREATED_RESOLVED_UNIT12] = true; |
| 2521 } | 2542 } |
| 2522 | 2543 |
| 2523 /** | 2544 /** |
| 2524 * Return a map from the names of the inputs of this kind of task to the task | 2545 * Return a map from the names of the inputs of this kind of task to the task |
| 2525 * input descriptors describing those inputs for a task with the | 2546 * input descriptors describing those inputs for a task with the |
| 2526 * given [target]. | 2547 * given [target]. |
| 2527 */ | 2548 */ |
| 2528 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 2549 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2529 LibrarySpecificUnit unit = target; | 2550 LibrarySpecificUnit unit = target; |
| 2530 return <String, TaskInput>{ | 2551 return <String, TaskInput>{ |
| 2531 'libraryElement': LIBRARY_ELEMENT8.of(unit.library), | 2552 'libraryElement': LIBRARY_ELEMENT8.of(unit.library), |
| 2532 UNIT_INPUT: RESOLVED_UNIT10.of(unit), | 2553 UNIT_INPUT: RESOLVED_UNIT11.of(unit), |
| 2533 CONSTANT_VALUES: | 2554 CONSTANT_VALUES: |
| 2534 COMPILATION_UNIT_CONSTANTS.of(unit).toListOf(CONSTANT_VALUE), | 2555 COMPILATION_UNIT_CONSTANTS.of(unit).toListOf(CONSTANT_VALUE), |
| 2535 'constantExpressionsDependencies': | 2556 'constantExpressionsDependencies': |
| 2536 CONSTANT_EXPRESSIONS_DEPENDENCIES.of(unit).toListOf(CONSTANT_VALUE) | 2557 CONSTANT_EXPRESSIONS_DEPENDENCIES.of(unit).toListOf(CONSTANT_VALUE) |
| 2537 }; | 2558 }; |
| 2538 } | 2559 } |
| 2539 | 2560 |
| 2540 /** | 2561 /** |
| 2541 * Create an [EvaluateUnitConstantsTask] based on the given [target] in | 2562 * Create an [EvaluateUnitConstantsTask] based on the given [target] in |
| 2542 * the given [context]. | 2563 * the given [context]. |
| 2543 */ | 2564 */ |
| 2544 static EvaluateUnitConstantsTask createTask( | 2565 static EvaluateUnitConstantsTask createTask( |
| 2545 AnalysisContext context, AnalysisTarget target) { | 2566 AnalysisContext context, AnalysisTarget target) { |
| 2546 return new EvaluateUnitConstantsTask(context, target); | 2567 return new EvaluateUnitConstantsTask(context, target); |
| 2547 } | 2568 } |
| 2548 } | 2569 } |
| 2549 | 2570 |
| 2550 /** | 2571 /** |
| 2551 * A task that builds [USED_IMPORTED_ELEMENTS] for a unit. | 2572 * A task that builds [USED_IMPORTED_ELEMENTS] for a unit. |
| 2552 */ | 2573 */ |
| 2553 class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { | 2574 class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { |
| 2554 /** | 2575 /** |
| 2555 * The name of the [RESOLVED_UNIT10] input. | 2576 * The name of the [RESOLVED_UNIT11] input. |
| 2556 */ | 2577 */ |
| 2557 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2578 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2558 | 2579 |
| 2559 /** | 2580 /** |
| 2560 * The task descriptor describing this kind of task. | 2581 * The task descriptor describing this kind of task. |
| 2561 */ | 2582 */ |
| 2562 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2583 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2563 'GatherUsedImportedElementsTask', | 2584 'GatherUsedImportedElementsTask', |
| 2564 createTask, | 2585 createTask, |
| 2565 buildInputs, | 2586 buildInputs, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2589 outputs[USED_IMPORTED_ELEMENTS] = visitor.usedElements; | 2610 outputs[USED_IMPORTED_ELEMENTS] = visitor.usedElements; |
| 2590 } | 2611 } |
| 2591 | 2612 |
| 2592 /** | 2613 /** |
| 2593 * Return a map from the names of the inputs of this kind of task to the task | 2614 * Return a map from the names of the inputs of this kind of task to the task |
| 2594 * input descriptors describing those inputs for a task with the | 2615 * input descriptors describing those inputs for a task with the |
| 2595 * given [target]. | 2616 * given [target]. |
| 2596 */ | 2617 */ |
| 2597 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 2618 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2598 LibrarySpecificUnit unit = target; | 2619 LibrarySpecificUnit unit = target; |
| 2599 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT10.of(unit)}; | 2620 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT11.of(unit)}; |
| 2600 } | 2621 } |
| 2601 | 2622 |
| 2602 /** | 2623 /** |
| 2603 * Create a [GatherUsedImportedElementsTask] based on the given [target] in | 2624 * Create a [GatherUsedImportedElementsTask] based on the given [target] in |
| 2604 * the given [context]. | 2625 * the given [context]. |
| 2605 */ | 2626 */ |
| 2606 static GatherUsedImportedElementsTask createTask( | 2627 static GatherUsedImportedElementsTask createTask( |
| 2607 AnalysisContext context, AnalysisTarget target) { | 2628 AnalysisContext context, AnalysisTarget target) { |
| 2608 return new GatherUsedImportedElementsTask(context, target); | 2629 return new GatherUsedImportedElementsTask(context, target); |
| 2609 } | 2630 } |
| 2610 } | 2631 } |
| 2611 | 2632 |
| 2612 /** | 2633 /** |
| 2613 * A task that builds [USED_LOCAL_ELEMENTS] for a unit. | 2634 * A task that builds [USED_LOCAL_ELEMENTS] for a unit. |
| 2614 */ | 2635 */ |
| 2615 class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { | 2636 class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { |
| 2616 /** | 2637 /** |
| 2617 * The name of the [RESOLVED_UNIT10] input. | 2638 * The name of the [RESOLVED_UNIT11] input. |
| 2618 */ | 2639 */ |
| 2619 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2640 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2620 | 2641 |
| 2621 /** | 2642 /** |
| 2622 * The task descriptor describing this kind of task. | 2643 * The task descriptor describing this kind of task. |
| 2623 */ | 2644 */ |
| 2624 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2645 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2625 'GatherUsedLocalElementsTask', | 2646 'GatherUsedLocalElementsTask', |
| 2626 createTask, | 2647 createTask, |
| 2627 buildInputs, | 2648 buildInputs, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2651 outputs[USED_LOCAL_ELEMENTS] = visitor.usedElements; | 2672 outputs[USED_LOCAL_ELEMENTS] = visitor.usedElements; |
| 2652 } | 2673 } |
| 2653 | 2674 |
| 2654 /** | 2675 /** |
| 2655 * Return a map from the names of the inputs of this kind of task to the task | 2676 * Return a map from the names of the inputs of this kind of task to the task |
| 2656 * input descriptors describing those inputs for a task with the | 2677 * input descriptors describing those inputs for a task with the |
| 2657 * given [target]. | 2678 * given [target]. |
| 2658 */ | 2679 */ |
| 2659 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 2680 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2660 LibrarySpecificUnit unit = target; | 2681 LibrarySpecificUnit unit = target; |
| 2661 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT10.of(unit)}; | 2682 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT11.of(unit)}; |
| 2662 } | 2683 } |
| 2663 | 2684 |
| 2664 /** | 2685 /** |
| 2665 * Create a [GatherUsedLocalElementsTask] based on the given [target] in | 2686 * Create a [GatherUsedLocalElementsTask] based on the given [target] in |
| 2666 * the given [context]. | 2687 * the given [context]. |
| 2667 */ | 2688 */ |
| 2668 static GatherUsedLocalElementsTask createTask( | 2689 static GatherUsedLocalElementsTask createTask( |
| 2669 AnalysisContext context, AnalysisTarget target) { | 2690 AnalysisContext context, AnalysisTarget target) { |
| 2670 return new GatherUsedLocalElementsTask(context, target); | 2691 return new GatherUsedLocalElementsTask(context, target); |
| 2671 } | 2692 } |
| 2672 } | 2693 } |
| 2673 | 2694 |
| 2674 /** | 2695 /** |
| 2675 * A task that generates [HINTS] for a unit. | 2696 * A task that generates [HINTS] for a unit. |
| 2676 */ | 2697 */ |
| 2677 class GenerateHintsTask extends SourceBasedAnalysisTask { | 2698 class GenerateHintsTask extends SourceBasedAnalysisTask { |
| 2678 /** | 2699 /** |
| 2679 * The name of the [RESOLVED_UNIT10] input. | 2700 * The name of the [RESOLVED_UNIT11] input. |
| 2680 */ | 2701 */ |
| 2681 static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT'; | 2702 static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT'; |
| 2682 | 2703 |
| 2683 /** | 2704 /** |
| 2684 * The name of a list of [USED_LOCAL_ELEMENTS] for each library unit input. | 2705 * The name of a list of [USED_LOCAL_ELEMENTS] for each library unit input. |
| 2685 */ | 2706 */ |
| 2686 static const String USED_LOCAL_ELEMENTS_INPUT = 'USED_LOCAL_ELEMENTS'; | 2707 static const String USED_LOCAL_ELEMENTS_INPUT = 'USED_LOCAL_ELEMENTS'; |
| 2687 | 2708 |
| 2688 /** | 2709 /** |
| 2689 * The name of a list of [USED_IMPORTED_ELEMENTS] for each library unit input. | 2710 * The name of a list of [USED_IMPORTED_ELEMENTS] for each library unit input. |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2888 * A task that ensures that all of the inferable instance members in a | 2909 * A task that ensures that all of the inferable instance members in a |
| 2889 * compilation unit have had their type inferred. | 2910 * compilation unit have had their type inferred. |
| 2890 */ | 2911 */ |
| 2891 class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask { | 2912 class InferInstanceMembersInUnitTask extends SourceBasedAnalysisTask { |
| 2892 /** | 2913 /** |
| 2893 * The name of the [TYPE_PROVIDER] input. | 2914 * The name of the [TYPE_PROVIDER] input. |
| 2894 */ | 2915 */ |
| 2895 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 2916 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 2896 | 2917 |
| 2897 /** | 2918 /** |
| 2898 * The name of the input whose value is the [RESOLVED_UNIT7] for the | 2919 * The name of the input whose value is the [RESOLVED_UNIT8] for the |
| 2899 * compilation unit. | 2920 * compilation unit. |
| 2900 */ | 2921 */ |
| 2901 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2922 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2902 | 2923 |
| 2903 /** | 2924 /** |
| 2904 * The task descriptor describing this kind of task. | 2925 * The task descriptor describing this kind of task. |
| 2905 */ | 2926 */ |
| 2906 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2927 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2907 'InferInstanceMembersInUnitTask', | 2928 'InferInstanceMembersInUnitTask', |
| 2908 createTask, | 2929 createTask, |
| 2909 buildInputs, | 2930 buildInputs, |
| 2910 <ResultDescriptor>[CREATED_RESOLVED_UNIT9, RESOLVED_UNIT9]); | 2931 <ResultDescriptor>[CREATED_RESOLVED_UNIT10, RESOLVED_UNIT10]); |
| 2911 | 2932 |
| 2912 /** | 2933 /** |
| 2913 * Initialize a newly created task to build a library element for the given | 2934 * Initialize a newly created task to build a library element for the given |
| 2914 * [unit] in the given [context]. | 2935 * [unit] in the given [context]. |
| 2915 */ | 2936 */ |
| 2916 InferInstanceMembersInUnitTask( | 2937 InferInstanceMembersInUnitTask( |
| 2917 InternalAnalysisContext context, LibrarySpecificUnit unit) | 2938 InternalAnalysisContext context, LibrarySpecificUnit unit) |
| 2918 : super(context, unit); | 2939 : super(context, unit); |
| 2919 | 2940 |
| 2920 @override | 2941 @override |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2932 // | 2953 // |
| 2933 if (context.analysisOptions.strongMode) { | 2954 if (context.analysisOptions.strongMode) { |
| 2934 InstanceMemberInferrer inferrer = new InstanceMemberInferrer( | 2955 InstanceMemberInferrer inferrer = new InstanceMemberInferrer( |
| 2935 typeProvider, new InheritanceManager(unit.element.library), | 2956 typeProvider, new InheritanceManager(unit.element.library), |
| 2936 typeSystem: context.typeSystem); | 2957 typeSystem: context.typeSystem); |
| 2937 inferrer.inferCompilationUnit(unit.element); | 2958 inferrer.inferCompilationUnit(unit.element); |
| 2938 } | 2959 } |
| 2939 // | 2960 // |
| 2940 // Record outputs. | 2961 // Record outputs. |
| 2941 // | 2962 // |
| 2942 outputs[RESOLVED_UNIT9] = unit; | 2963 outputs[RESOLVED_UNIT10] = unit; |
| 2943 outputs[CREATED_RESOLVED_UNIT9] = true; | 2964 outputs[CREATED_RESOLVED_UNIT10] = true; |
| 2944 } | 2965 } |
| 2945 | 2966 |
| 2946 /** | 2967 /** |
| 2947 * Return a map from the names of the inputs of this kind of task to the task | 2968 * Return a map from the names of the inputs of this kind of task to the task |
| 2948 * input descriptors describing those inputs for a task with the given | 2969 * input descriptors describing those inputs for a task with the given |
| 2949 * [libSource]. | 2970 * [libSource]. |
| 2950 */ | 2971 */ |
| 2951 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 2972 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2952 LibrarySpecificUnit unit = target; | 2973 LibrarySpecificUnit unit = target; |
| 2953 return <String, TaskInput>{ | 2974 return <String, TaskInput>{ |
| 2954 UNIT_INPUT: RESOLVED_UNIT8.of(unit), | 2975 UNIT_INPUT: RESOLVED_UNIT9.of(unit), |
| 2955 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 2976 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 2956 // In strong mode, add additional dependencies to enforce inference | 2977 // In strong mode, add additional dependencies to enforce inference |
| 2957 // ordering. | 2978 // ordering. |
| 2958 | 2979 |
| 2959 // Require that field re-resolution be complete for all units in the | 2980 // Require that field re-resolution be complete for all units in the |
| 2960 // current library cycle. | 2981 // current library cycle. |
| 2961 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( | 2982 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( |
| 2962 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT8.of( | 2983 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of( |
| 2963 new LibrarySpecificUnit( | 2984 new LibrarySpecificUnit( |
| 2964 (unit as CompilationUnitElementImpl).librarySource, | 2985 (unit as CompilationUnitElementImpl).librarySource, |
| 2965 unit.source))), | 2986 unit.source))), |
| 2966 // Require that full inference be complete for all dependencies of the | 2987 // Require that full inference be complete for all dependencies of the |
| 2967 // current library cycle. | 2988 // current library cycle. |
| 2968 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( | 2989 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( |
| 2969 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of( | 2990 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of( |
| 2970 new LibrarySpecificUnit( | 2991 new LibrarySpecificUnit( |
| 2971 (unit as CompilationUnitElementImpl).librarySource, | 2992 (unit as CompilationUnitElementImpl).librarySource, |
| 2972 unit.source))) | 2993 unit.source))) |
| 2973 }; | 2994 }; |
| 2974 } | 2995 } |
| 2975 | 2996 |
| 2976 /** | 2997 /** |
| 2977 * Create a [InferInstanceMembersInUnitTask] based on the given [target] in | 2998 * Create a [InferInstanceMembersInUnitTask] based on the given [target] in |
| 2978 * the given [context]. | 2999 * the given [context]. |
| 2979 */ | 3000 */ |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3030 return declaration; | 3051 return declaration; |
| 3031 } | 3052 } |
| 3032 } | 3053 } |
| 3033 | 3054 |
| 3034 /** | 3055 /** |
| 3035 * A task that ensures that all of the inferable static variables in a | 3056 * A task that ensures that all of the inferable static variables in a |
| 3036 * compilation unit have had their type inferred. | 3057 * compilation unit have had their type inferred. |
| 3037 */ | 3058 */ |
| 3038 class InferStaticVariableTypesInUnitTask extends SourceBasedAnalysisTask { | 3059 class InferStaticVariableTypesInUnitTask extends SourceBasedAnalysisTask { |
| 3039 /** | 3060 /** |
| 3040 * The name of the input whose value is the [RESOLVED_UNIT6] for the | 3061 * The name of the input whose value is the [RESOLVED_UNIT7] for the |
| 3041 * compilation unit. | 3062 * compilation unit. |
| 3042 */ | 3063 */ |
| 3043 static const String UNIT_INPUT = 'UNIT_INPUT'; | 3064 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 3044 | 3065 |
| 3045 /** | 3066 /** |
| 3046 * The name of the input whose value is a list of the inferable static | 3067 * The name of the input whose value is a list of the inferable static |
| 3047 * variables whose types have been computed. | 3068 * variables whose types have been computed. |
| 3048 */ | 3069 */ |
| 3049 static const String INFERRED_VARIABLES_INPUT = 'INFERRED_VARIABLES_INPUT'; | 3070 static const String INFERRED_VARIABLES_INPUT = 'INFERRED_VARIABLES_INPUT'; |
| 3050 | 3071 |
| 3051 /** | 3072 /** |
| 3052 * The task descriptor describing this kind of task. | 3073 * The task descriptor describing this kind of task. |
| 3053 */ | 3074 */ |
| 3054 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 3075 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3055 'InferStaticVariableTypesInUnitTask', | 3076 'InferStaticVariableTypesInUnitTask', |
| 3056 createTask, | 3077 createTask, |
| 3057 buildInputs, | 3078 buildInputs, |
| 3058 <ResultDescriptor>[CREATED_RESOLVED_UNIT7, RESOLVED_UNIT7]); | 3079 <ResultDescriptor>[CREATED_RESOLVED_UNIT8, RESOLVED_UNIT8]); |
| 3059 | 3080 |
| 3060 /** | 3081 /** |
| 3061 * Initialize a newly created task to build a library element for the given | 3082 * Initialize a newly created task to build a library element for the given |
| 3062 * [unit] in the given [context]. | 3083 * [unit] in the given [context]. |
| 3063 */ | 3084 */ |
| 3064 InferStaticVariableTypesInUnitTask( | 3085 InferStaticVariableTypesInUnitTask( |
| 3065 InternalAnalysisContext context, LibrarySpecificUnit unit) | 3086 InternalAnalysisContext context, LibrarySpecificUnit unit) |
| 3066 : super(context, unit); | 3087 : super(context, unit); |
| 3067 | 3088 |
| 3068 @override | 3089 @override |
| 3069 TaskDescriptor get descriptor => DESCRIPTOR; | 3090 TaskDescriptor get descriptor => DESCRIPTOR; |
| 3070 | 3091 |
| 3071 @override | 3092 @override |
| 3072 void internalPerform() { | 3093 void internalPerform() { |
| 3073 // | 3094 // |
| 3074 // Prepare inputs. | 3095 // Prepare inputs. |
| 3075 // | 3096 // |
| 3076 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 3097 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 3077 // | 3098 // |
| 3078 // Record outputs. There is no additional work to be done at this time | 3099 // Record outputs. There is no additional work to be done at this time |
| 3079 // because the work has implicitly been done by virtue of the task model | 3100 // because the work has implicitly been done by virtue of the task model |
| 3080 // preparing all of the inputs. | 3101 // preparing all of the inputs. |
| 3081 // | 3102 // |
| 3082 outputs[RESOLVED_UNIT7] = unit; | 3103 outputs[RESOLVED_UNIT8] = unit; |
| 3083 outputs[CREATED_RESOLVED_UNIT7] = true; | 3104 outputs[CREATED_RESOLVED_UNIT8] = true; |
| 3084 } | 3105 } |
| 3085 | 3106 |
| 3086 /** | 3107 /** |
| 3087 * Return a map from the names of the inputs of this kind of task to the task | 3108 * Return a map from the names of the inputs of this kind of task to the task |
| 3088 * input descriptors describing those inputs for a task with the given | 3109 * input descriptors describing those inputs for a task with the given |
| 3089 * [libSource]. | 3110 * [libSource]. |
| 3090 */ | 3111 */ |
| 3091 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 3112 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3092 LibrarySpecificUnit unit = target; | 3113 LibrarySpecificUnit unit = target; |
| 3093 return <String, TaskInput>{ | 3114 return <String, TaskInput>{ |
| 3094 INFERRED_VARIABLES_INPUT: INFERABLE_STATIC_VARIABLES_IN_UNIT | 3115 INFERRED_VARIABLES_INPUT: INFERABLE_STATIC_VARIABLES_IN_UNIT |
| 3095 .of(unit) | 3116 .of(unit) |
| 3096 .toListOf(INFERRED_STATIC_VARIABLE), | 3117 .toListOf(INFERRED_STATIC_VARIABLE), |
| 3097 UNIT_INPUT: RESOLVED_UNIT6.of(unit) | 3118 UNIT_INPUT: RESOLVED_UNIT7.of(unit) |
| 3098 }; | 3119 }; |
| 3099 } | 3120 } |
| 3100 | 3121 |
| 3101 /** | 3122 /** |
| 3102 * Create a [InferStaticVariableTypesInUnitTask] based on the given [target] | 3123 * Create a [InferStaticVariableTypesInUnitTask] based on the given [target] |
| 3103 * in the given [context]. | 3124 * in the given [context]. |
| 3104 */ | 3125 */ |
| 3105 static InferStaticVariableTypesInUnitTask createTask( | 3126 static InferStaticVariableTypesInUnitTask createTask( |
| 3106 AnalysisContext context, AnalysisTarget target) { | 3127 AnalysisContext context, AnalysisTarget target) { |
| 3107 return new InferStaticVariableTypesInUnitTask(context, target); | 3128 return new InferStaticVariableTypesInUnitTask(context, target); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3118 * inferred before the target. | 3139 * inferred before the target. |
| 3119 */ | 3140 */ |
| 3120 static const String DEPENDENCIES_INPUT = 'DEPENDENCIES_INPUT'; | 3141 static const String DEPENDENCIES_INPUT = 'DEPENDENCIES_INPUT'; |
| 3121 | 3142 |
| 3122 /** | 3143 /** |
| 3123 * The name of the [TYPE_PROVIDER] input. | 3144 * The name of the [TYPE_PROVIDER] input. |
| 3124 */ | 3145 */ |
| 3125 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 3146 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 3126 | 3147 |
| 3127 /** | 3148 /** |
| 3128 * The name of the [RESOLVED_UNIT6] input. | 3149 * The name of the [RESOLVED_UNIT7] input. |
| 3129 */ | 3150 */ |
| 3130 static const String UNIT_INPUT = 'UNIT_INPUT'; | 3151 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 3131 | 3152 |
| 3132 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 3153 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3133 'InferStaticVariableTypeTask', | 3154 'InferStaticVariableTypeTask', |
| 3134 createTask, | 3155 createTask, |
| 3135 buildInputs, | 3156 buildInputs, |
| 3136 <ResultDescriptor>[INFERRED_STATIC_VARIABLE]); | 3157 <ResultDescriptor>[INFERRED_STATIC_VARIABLE]); |
| 3137 | 3158 |
| 3138 InferStaticVariableTypeTask( | 3159 InferStaticVariableTypeTask( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3209 */ | 3230 */ |
| 3210 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 3231 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3211 VariableElement variable = target; | 3232 VariableElement variable = target; |
| 3212 LibrarySpecificUnit unit = | 3233 LibrarySpecificUnit unit = |
| 3213 new LibrarySpecificUnit(variable.library.source, variable.source); | 3234 new LibrarySpecificUnit(variable.library.source, variable.source); |
| 3214 return <String, TaskInput>{ | 3235 return <String, TaskInput>{ |
| 3215 DEPENDENCIES_INPUT: INFERABLE_STATIC_VARIABLE_DEPENDENCIES | 3236 DEPENDENCIES_INPUT: INFERABLE_STATIC_VARIABLE_DEPENDENCIES |
| 3216 .of(variable) | 3237 .of(variable) |
| 3217 .toListOf(INFERRED_STATIC_VARIABLE), | 3238 .toListOf(INFERRED_STATIC_VARIABLE), |
| 3218 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 3239 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 3219 UNIT_INPUT: RESOLVED_UNIT6.of(unit), | 3240 UNIT_INPUT: RESOLVED_UNIT7.of(unit), |
| 3220 // In strong mode, add additional dependencies to enforce inference | 3241 // In strong mode, add additional dependencies to enforce inference |
| 3221 // ordering. | 3242 // ordering. |
| 3222 | 3243 |
| 3223 // Require that full inference be complete for all dependencies of the | 3244 // Require that full inference be complete for all dependencies of the |
| 3224 // current library cycle. | 3245 // current library cycle. |
| 3225 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( | 3246 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( |
| 3226 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of( | 3247 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of( |
| 3227 new LibrarySpecificUnit( | 3248 new LibrarySpecificUnit( |
| 3228 (unit as CompilationUnitElementImpl).librarySource, | 3249 (unit as CompilationUnitElementImpl).librarySource, |
| 3229 unit.source))) | 3250 unit.source))) |
| 3230 }; | 3251 }; |
| 3231 } | 3252 } |
| 3232 | 3253 |
| 3233 /** | 3254 /** |
| 3234 * Create a [InferStaticVariableTypeTask] based on the given [target] in the | 3255 * Create a [InferStaticVariableTypeTask] based on the given [target] in the |
| 3235 * given [context]. | 3256 * given [context]. |
| 3236 */ | 3257 */ |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3616 if (code == UriValidationCode.INVALID_URI) { | 3637 if (code == UriValidationCode.INVALID_URI) { |
| 3617 errorListener.onError(new AnalysisError(librarySource, uriLiteral.offset, | 3638 errorListener.onError(new AnalysisError(librarySource, uriLiteral.offset, |
| 3618 uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent])); | 3639 uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent])); |
| 3619 return null; | 3640 return null; |
| 3620 } | 3641 } |
| 3621 throw new AnalysisException('Failed to handle validation code: $code'); | 3642 throw new AnalysisException('Failed to handle validation code: $code'); |
| 3622 } | 3643 } |
| 3623 } | 3644 } |
| 3624 | 3645 |
| 3625 /** | 3646 /** |
| 3626 * A task that builds [RESOLVED_UNIT5] for a unit. | 3647 * A task that builds [RESOLVED_UNIT6] for a unit. |
| 3627 */ | 3648 */ |
| 3628 class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask { | 3649 class PartiallyResolveUnitReferencesTask extends SourceBasedAnalysisTask { |
| 3629 /** | 3650 /** |
| 3630 * The name of the [LIBRARY_ELEMENT5] input. | 3651 * The name of the [LIBRARY_ELEMENT5] input. |
| 3631 */ | 3652 */ |
| 3632 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 3653 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 3633 | 3654 |
| 3634 /** | 3655 /** |
| 3635 * The name of the [RESOLVED_UNIT4] input. | 3656 * The name of the [RESOLVED_UNIT5] input. |
| 3636 */ | 3657 */ |
| 3637 static const String UNIT_INPUT = 'UNIT_INPUT'; | 3658 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 3638 | 3659 |
| 3639 /** | 3660 /** |
| 3640 * The name of the [TYPE_PROVIDER] input. | 3661 * The name of the [TYPE_PROVIDER] input. |
| 3641 */ | 3662 */ |
| 3642 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 3663 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 3643 | 3664 |
| 3644 /** | 3665 /** |
| 3645 * The task descriptor describing this kind of task. | 3666 * The task descriptor describing this kind of task. |
| 3646 */ | 3667 */ |
| 3647 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 3668 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3648 'PartiallyResolveUnitReferencesTask', | 3669 'PartiallyResolveUnitReferencesTask', |
| 3649 createTask, | 3670 createTask, |
| 3650 buildInputs, <ResultDescriptor>[ | 3671 buildInputs, <ResultDescriptor>[ |
| 3651 INFERABLE_STATIC_VARIABLES_IN_UNIT, | 3672 INFERABLE_STATIC_VARIABLES_IN_UNIT, |
| 3652 PROPAGABLE_VARIABLES_IN_UNIT, | 3673 PROPAGABLE_VARIABLES_IN_UNIT, |
| 3653 CREATED_RESOLVED_UNIT5, | 3674 CREATED_RESOLVED_UNIT6, |
| 3654 RESOLVED_UNIT5 | 3675 RESOLVED_UNIT6 |
| 3655 ]); | 3676 ]); |
| 3656 | 3677 |
| 3657 PartiallyResolveUnitReferencesTask( | 3678 PartiallyResolveUnitReferencesTask( |
| 3658 InternalAnalysisContext context, AnalysisTarget target) | 3679 InternalAnalysisContext context, AnalysisTarget target) |
| 3659 : super(context, target); | 3680 : super(context, target); |
| 3660 | 3681 |
| 3661 @override | 3682 @override |
| 3662 TaskDescriptor get descriptor => DESCRIPTOR; | 3683 TaskDescriptor get descriptor => DESCRIPTOR; |
| 3663 | 3684 |
| 3664 @override | 3685 @override |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3678 unit.accept(visitor); | 3699 unit.accept(visitor); |
| 3679 // | 3700 // |
| 3680 // Record outputs. | 3701 // Record outputs. |
| 3681 // | 3702 // |
| 3682 if (context.analysisOptions.strongMode) { | 3703 if (context.analysisOptions.strongMode) { |
| 3683 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = visitor.staticVariables; | 3704 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = visitor.staticVariables; |
| 3684 } else { | 3705 } else { |
| 3685 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = VariableElement.EMPTY_LIST; | 3706 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = VariableElement.EMPTY_LIST; |
| 3686 } | 3707 } |
| 3687 outputs[PROPAGABLE_VARIABLES_IN_UNIT] = visitor.propagableVariables; | 3708 outputs[PROPAGABLE_VARIABLES_IN_UNIT] = visitor.propagableVariables; |
| 3688 outputs[RESOLVED_UNIT5] = unit; | 3709 outputs[RESOLVED_UNIT6] = unit; |
| 3689 outputs[CREATED_RESOLVED_UNIT5] = true; | 3710 outputs[CREATED_RESOLVED_UNIT6] = true; |
| 3690 } | 3711 } |
| 3691 | 3712 |
| 3692 /** | 3713 /** |
| 3693 * Return a map from the names of the inputs of this kind of task to the task | 3714 * Return a map from the names of the inputs of this kind of task to the task |
| 3694 * input descriptors describing those inputs for a task with the | 3715 * input descriptors describing those inputs for a task with the |
| 3695 * given [target]. | 3716 * given [target]. |
| 3696 */ | 3717 */ |
| 3697 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 3718 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3698 LibrarySpecificUnit unit = target; | 3719 LibrarySpecificUnit unit = target; |
| 3699 return <String, TaskInput>{ | 3720 return <String, TaskInput>{ |
| 3700 'fullyBuiltLibraryElements': READY_LIBRARY_ELEMENT5.of(unit.library), | 3721 'fullyBuiltLibraryElements': READY_LIBRARY_ELEMENT5.of(unit.library), |
| 3701 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), | 3722 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), |
| 3702 UNIT_INPUT: RESOLVED_UNIT4.of(unit), | 3723 UNIT_INPUT: RESOLVED_UNIT5.of(unit), |
| 3703 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 3724 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 3704 // In strong mode, add additional dependencies to enforce inference | 3725 // In strong mode, add additional dependencies to enforce inference |
| 3705 // ordering. | 3726 // ordering. |
| 3706 | 3727 |
| 3707 // Require that full inference be complete for all dependencies of the | 3728 // Require that full inference be complete for all dependencies of the |
| 3708 // current library cycle. | 3729 // current library cycle. |
| 3709 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( | 3730 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( |
| 3710 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of( | 3731 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of( |
| 3711 new LibrarySpecificUnit( | 3732 new LibrarySpecificUnit( |
| 3712 (unit as CompilationUnitElementImpl).librarySource, | 3733 (unit as CompilationUnitElementImpl).librarySource, |
| 3713 unit.source))) | 3734 unit.source))) |
| 3714 }; | 3735 }; |
| 3715 } | 3736 } |
| 3716 | 3737 |
| 3717 /** | 3738 /** |
| 3718 * Create a [PartiallyResolveUnitReferencesTask] based on the given [target] | 3739 * Create a [PartiallyResolveUnitReferencesTask] based on the given [target] |
| 3719 * in the given [context]. | 3740 * in the given [context]. |
| 3720 */ | 3741 */ |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3814 | 3835 |
| 3815 /** | 3836 /** |
| 3816 * Return a map from the names of the inputs of this kind of task to the task | 3837 * Return a map from the names of the inputs of this kind of task to the task |
| 3817 * input descriptors describing those inputs for a task with the | 3838 * input descriptors describing those inputs for a task with the |
| 3818 * given [target]. | 3839 * given [target]. |
| 3819 */ | 3840 */ |
| 3820 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 3841 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3821 Source source = target; | 3842 Source source = target; |
| 3822 return <String, TaskInput>{ | 3843 return <String, TaskInput>{ |
| 3823 'propagatedVariableTypesInUnits': | 3844 'propagatedVariableTypesInUnits': |
| 3824 LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT6), | 3845 LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT7), |
| 3825 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(source), | 3846 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(source), |
| 3826 }; | 3847 }; |
| 3827 } | 3848 } |
| 3828 | 3849 |
| 3829 /** | 3850 /** |
| 3830 * Create a [PropagateVariableTypesInLibraryTask] based on the given [target] | 3851 * Create a [PropagateVariableTypesInLibraryTask] based on the given [target] |
| 3831 * in the given [context]. | 3852 * in the given [context]. |
| 3832 */ | 3853 */ |
| 3833 static PropagateVariableTypesInLibraryTask createTask( | 3854 static PropagateVariableTypesInLibraryTask createTask( |
| 3834 AnalysisContext context, AnalysisTarget target) { | 3855 AnalysisContext context, AnalysisTarget target) { |
| 3835 return new PropagateVariableTypesInLibraryTask(context, target); | 3856 return new PropagateVariableTypesInLibraryTask(context, target); |
| 3836 } | 3857 } |
| 3837 } | 3858 } |
| 3838 | 3859 |
| 3839 /** | 3860 /** |
| 3840 * A task that ensures that all of the propagable variables in a compilation | 3861 * A task that ensures that all of the propagable variables in a compilation |
| 3841 * unit have had their type propagated. | 3862 * unit have had their type propagated. |
| 3842 */ | 3863 */ |
| 3843 class PropagateVariableTypesInUnitTask extends SourceBasedAnalysisTask { | 3864 class PropagateVariableTypesInUnitTask extends SourceBasedAnalysisTask { |
| 3844 /** | 3865 /** |
| 3845 * The name of the input whose value is the [RESOLVED_UNIT5] for the | 3866 * The name of the input whose value is the [RESOLVED_UNIT6] for the |
| 3846 * compilation unit. | 3867 * compilation unit. |
| 3847 */ | 3868 */ |
| 3848 static const String UNIT_INPUT = 'UNIT_INPUT'; | 3869 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 3849 | 3870 |
| 3850 /** | 3871 /** |
| 3851 * The task descriptor describing this kind of task. | 3872 * The task descriptor describing this kind of task. |
| 3852 */ | 3873 */ |
| 3853 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 3874 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3854 'PropagateVariableTypesInUnitTask', | 3875 'PropagateVariableTypesInUnitTask', |
| 3855 createTask, | 3876 createTask, |
| 3856 buildInputs, | 3877 buildInputs, |
| 3857 <ResultDescriptor>[CREATED_RESOLVED_UNIT6, RESOLVED_UNIT6]); | 3878 <ResultDescriptor>[CREATED_RESOLVED_UNIT7, RESOLVED_UNIT7]); |
| 3858 | 3879 |
| 3859 PropagateVariableTypesInUnitTask( | 3880 PropagateVariableTypesInUnitTask( |
| 3860 InternalAnalysisContext context, LibrarySpecificUnit unit) | 3881 InternalAnalysisContext context, LibrarySpecificUnit unit) |
| 3861 : super(context, unit); | 3882 : super(context, unit); |
| 3862 | 3883 |
| 3863 @override | 3884 @override |
| 3864 TaskDescriptor get descriptor => DESCRIPTOR; | 3885 TaskDescriptor get descriptor => DESCRIPTOR; |
| 3865 | 3886 |
| 3866 @override | 3887 @override |
| 3867 void internalPerform() { | 3888 void internalPerform() { |
| 3868 // | 3889 // |
| 3869 // Prepare inputs. | 3890 // Prepare inputs. |
| 3870 // | 3891 // |
| 3871 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 3892 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 3872 // | 3893 // |
| 3873 // Record outputs. There is no additional work to be done at this time | 3894 // Record outputs. There is no additional work to be done at this time |
| 3874 // because the work has implicitly been done by virtue of the task model | 3895 // because the work has implicitly been done by virtue of the task model |
| 3875 // preparing all of the inputs. | 3896 // preparing all of the inputs. |
| 3876 // | 3897 // |
| 3877 outputs[RESOLVED_UNIT6] = unit; | 3898 outputs[RESOLVED_UNIT7] = unit; |
| 3878 outputs[CREATED_RESOLVED_UNIT6] = true; | 3899 outputs[CREATED_RESOLVED_UNIT7] = true; |
| 3879 } | 3900 } |
| 3880 | 3901 |
| 3881 /** | 3902 /** |
| 3882 * Return a map from the names of the inputs of this kind of task to the task | 3903 * Return a map from the names of the inputs of this kind of task to the task |
| 3883 * input descriptors describing those inputs for a task with the given | 3904 * input descriptors describing those inputs for a task with the given |
| 3884 * [target]. | 3905 * [target]. |
| 3885 */ | 3906 */ |
| 3886 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 3907 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3887 LibrarySpecificUnit unit = target; | 3908 LibrarySpecificUnit unit = target; |
| 3888 return <String, TaskInput>{ | 3909 return <String, TaskInput>{ |
| 3889 'variables': | 3910 'variables': |
| 3890 PROPAGABLE_VARIABLES_IN_UNIT.of(unit).toListOf(PROPAGATED_VARIABLE), | 3911 PROPAGABLE_VARIABLES_IN_UNIT.of(unit).toListOf(PROPAGATED_VARIABLE), |
| 3891 UNIT_INPUT: RESOLVED_UNIT5.of(unit) | 3912 UNIT_INPUT: RESOLVED_UNIT6.of(unit) |
| 3892 }; | 3913 }; |
| 3893 } | 3914 } |
| 3894 | 3915 |
| 3895 /** | 3916 /** |
| 3896 * Create a [PropagateVariableTypesInUnitTask] based on the given [target] | 3917 * Create a [PropagateVariableTypesInUnitTask] based on the given [target] |
| 3897 * in the given [context]. | 3918 * in the given [context]. |
| 3898 */ | 3919 */ |
| 3899 static PropagateVariableTypesInUnitTask createTask( | 3920 static PropagateVariableTypesInUnitTask createTask( |
| 3900 AnalysisContext context, AnalysisTarget target) { | 3921 AnalysisContext context, AnalysisTarget target) { |
| 3901 return new PropagateVariableTypesInUnitTask(context, target); | 3922 return new PropagateVariableTypesInUnitTask(context, target); |
| 3902 } | 3923 } |
| 3903 } | 3924 } |
| 3904 | 3925 |
| 3905 /** | 3926 /** |
| 3906 * A task that computes the propagated type of an propagable variable and | 3927 * A task that computes the propagated type of an propagable variable and |
| 3907 * stores it in the element model. | 3928 * stores it in the element model. |
| 3908 */ | 3929 */ |
| 3909 class PropagateVariableTypeTask extends InferStaticVariableTask { | 3930 class PropagateVariableTypeTask extends InferStaticVariableTask { |
| 3910 /** | 3931 /** |
| 3911 * The name of the [TYPE_PROVIDER] input. | 3932 * The name of the [TYPE_PROVIDER] input. |
| 3912 */ | 3933 */ |
| 3913 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 3934 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 3914 | 3935 |
| 3915 /** | 3936 /** |
| 3916 * The name of the [RESOLVED_UNIT5] input. | 3937 * The name of the [RESOLVED_UNIT6] input. |
| 3917 */ | 3938 */ |
| 3918 static const String UNIT_INPUT = 'UNIT_INPUT'; | 3939 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 3919 | 3940 |
| 3920 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 3941 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3921 'PropagateVariableTypeTask', | 3942 'PropagateVariableTypeTask', |
| 3922 createTask, | 3943 createTask, |
| 3923 buildInputs, | 3944 buildInputs, |
| 3924 <ResultDescriptor>[PROPAGATED_VARIABLE]); | 3945 <ResultDescriptor>[PROPAGATED_VARIABLE]); |
| 3925 | 3946 |
| 3926 PropagateVariableTypeTask( | 3947 PropagateVariableTypeTask( |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3992 (variable as ElementImpl).appendPathTo(buffer); | 4013 (variable as ElementImpl).appendPathTo(buffer); |
| 3993 throw new AnalysisException(buffer.toString()); | 4014 throw new AnalysisException(buffer.toString()); |
| 3994 } | 4015 } |
| 3995 LibrarySpecificUnit unit = | 4016 LibrarySpecificUnit unit = |
| 3996 new LibrarySpecificUnit(variable.library.source, variable.source); | 4017 new LibrarySpecificUnit(variable.library.source, variable.source); |
| 3997 return <String, TaskInput>{ | 4018 return <String, TaskInput>{ |
| 3998 'dependencies': PROPAGABLE_VARIABLE_DEPENDENCIES | 4019 'dependencies': PROPAGABLE_VARIABLE_DEPENDENCIES |
| 3999 .of(variable) | 4020 .of(variable) |
| 4000 .toListOf(PROPAGATED_VARIABLE), | 4021 .toListOf(PROPAGATED_VARIABLE), |
| 4001 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 4022 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 4002 UNIT_INPUT: RESOLVED_UNIT5.of(unit), | 4023 UNIT_INPUT: RESOLVED_UNIT6.of(unit), |
| 4003 }; | 4024 }; |
| 4004 } | 4025 } |
| 4005 | 4026 |
| 4006 /** | 4027 /** |
| 4007 * Create a [PropagateVariableTypeTask] based on the given [target] in the | 4028 * Create a [PropagateVariableTypeTask] based on the given [target] in the |
| 4008 * given [context]. | 4029 * given [context]. |
| 4009 */ | 4030 */ |
| 4010 static PropagateVariableTypeTask createTask( | 4031 static PropagateVariableTypeTask createTask( |
| 4011 AnalysisContext context, AnalysisTarget target) { | 4032 AnalysisContext context, AnalysisTarget target) { |
| 4012 return new PropagateVariableTypeTask(context, target); | 4033 return new PropagateVariableTypeTask(context, target); |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4316 CompilationUnitElementImpl unit = target | 4337 CompilationUnitElementImpl unit = target |
| 4317 .getAncestor((Element element) => element is CompilationUnitElement); | 4338 .getAncestor((Element element) => element is CompilationUnitElement); |
| 4318 librarySource = unit.librarySource; | 4339 librarySource = unit.librarySource; |
| 4319 } else if (target is ElementAnnotationImpl) { | 4340 } else if (target is ElementAnnotationImpl) { |
| 4320 librarySource = target.librarySource; | 4341 librarySource = target.librarySource; |
| 4321 } else { | 4342 } else { |
| 4322 throw new AnalysisException( | 4343 throw new AnalysisException( |
| 4323 'Cannot build inputs for a ${target.runtimeType}'); | 4344 'Cannot build inputs for a ${target.runtimeType}'); |
| 4324 } | 4345 } |
| 4325 return <String, TaskInput>{ | 4346 return <String, TaskInput>{ |
| 4326 'createdResolvedUnit': CREATED_RESOLVED_UNIT10 | 4347 'createdResolvedUnit': CREATED_RESOLVED_UNIT11 |
| 4327 .of(new LibrarySpecificUnit(librarySource, target.source)) | 4348 .of(new LibrarySpecificUnit(librarySource, target.source)) |
| 4328 }; | 4349 }; |
| 4329 } | 4350 } |
| 4330 | 4351 |
| 4331 /** | 4352 /** |
| 4332 * Create a [ResolveConstantExpressionTask] based on the given [target] in | 4353 * Create a [ResolveConstantExpressionTask] based on the given [target] in |
| 4333 * the given [context]. | 4354 * the given [context]. |
| 4334 */ | 4355 */ |
| 4335 static ResolveConstantExpressionTask createTask( | 4356 static ResolveConstantExpressionTask createTask( |
| 4336 AnalysisContext context, AnalysisTarget target) { | 4357 AnalysisContext context, AnalysisTarget target) { |
| 4337 return new ResolveConstantExpressionTask(context, target); | 4358 return new ResolveConstantExpressionTask(context, target); |
| 4338 } | 4359 } |
| 4339 } | 4360 } |
| 4340 | 4361 |
| 4341 /** | 4362 /** |
| 4363 * A task that resolves imports and export directives to already built elements. |
| 4364 */ |
| 4365 class ResolveDirectiveElementsTask extends SourceBasedAnalysisTask { |
| 4366 /** |
| 4367 * The name of the input whose value is the defining [LIBRARY_ELEMENT2]. |
| 4368 */ |
| 4369 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 4370 |
| 4371 /** |
| 4372 * The name of the input for [RESOLVED_UNIT1] of a unit. |
| 4373 */ |
| 4374 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 4375 |
| 4376 /** |
| 4377 * The task descriptor describing this kind of task. |
| 4378 */ |
| 4379 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 4380 'ResolveDirectiveElementsTask', |
| 4381 createTask, |
| 4382 buildInputs, |
| 4383 <ResultDescriptor>[CREATED_RESOLVED_UNIT2, RESOLVED_UNIT2]); |
| 4384 |
| 4385 ResolveDirectiveElementsTask( |
| 4386 InternalAnalysisContext context, AnalysisTarget target) |
| 4387 : super(context, target); |
| 4388 |
| 4389 @override |
| 4390 TaskDescriptor get descriptor => DESCRIPTOR; |
| 4391 |
| 4392 @override |
| 4393 void internalPerform() { |
| 4394 LibrarySpecificUnit targetUnit = target; |
| 4395 // |
| 4396 // Prepare inputs. |
| 4397 // |
| 4398 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 4399 // |
| 4400 // Resolve directive AST nodes to elements. |
| 4401 // |
| 4402 if (targetUnit.unit == targetUnit.library) { |
| 4403 DirectiveResolver resolver = new DirectiveResolver(); |
| 4404 unit.accept(resolver); |
| 4405 } |
| 4406 // |
| 4407 // Record outputs. |
| 4408 // |
| 4409 outputs[CREATED_RESOLVED_UNIT2] = true; |
| 4410 outputs[RESOLVED_UNIT2] = unit; |
| 4411 } |
| 4412 |
| 4413 /** |
| 4414 * Return a map from the names of the inputs of this kind of task to the task |
| 4415 * input descriptors describing those inputs for a task with the |
| 4416 * given [target]. |
| 4417 */ |
| 4418 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 4419 LibrarySpecificUnit unit = target; |
| 4420 return <String, TaskInput>{ |
| 4421 LIBRARY_INPUT: LIBRARY_ELEMENT2.of(unit.library), |
| 4422 UNIT_INPUT: RESOLVED_UNIT1.of(unit) |
| 4423 }; |
| 4424 } |
| 4425 |
| 4426 /** |
| 4427 * Create a [ResolveDirectiveElementsTask] based on the given [target] in |
| 4428 * the given [context]. |
| 4429 */ |
| 4430 static ResolveDirectiveElementsTask createTask( |
| 4431 AnalysisContext context, AnalysisTarget target) { |
| 4432 return new ResolveDirectiveElementsTask(context, target); |
| 4433 } |
| 4434 } |
| 4435 |
| 4436 /** |
| 4342 * A task that ensures that all of the inferable instance members in a | 4437 * A task that ensures that all of the inferable instance members in a |
| 4343 * compilation unit have had their right hand sides re-resolved | 4438 * compilation unit have had their right hand sides re-resolved |
| 4344 */ | 4439 */ |
| 4345 class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask { | 4440 class ResolveInstanceFieldsInUnitTask extends SourceBasedAnalysisTask { |
| 4346 /** | 4441 /** |
| 4347 * The name of the [LIBRARY_ELEMENT5] input. | 4442 * The name of the [LIBRARY_ELEMENT5] input. |
| 4348 */ | 4443 */ |
| 4349 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 4444 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 4350 | 4445 |
| 4351 /** | 4446 /** |
| 4352 * The name of the [TYPE_PROVIDER] input. | 4447 * The name of the [TYPE_PROVIDER] input. |
| 4353 */ | 4448 */ |
| 4354 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 4449 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 4355 | 4450 |
| 4356 /** | 4451 /** |
| 4357 * The name of the input whose value is the [RESOLVED_UNIT7] for the | 4452 * The name of the input whose value is the [RESOLVED_UNIT8] for the |
| 4358 * compilation unit. | 4453 * compilation unit. |
| 4359 */ | 4454 */ |
| 4360 static const String UNIT_INPUT = 'UNIT_INPUT'; | 4455 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 4361 | 4456 |
| 4362 /** | 4457 /** |
| 4363 * The task descriptor describing this kind of task. | 4458 * The task descriptor describing this kind of task. |
| 4364 */ | 4459 */ |
| 4365 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 4460 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 4366 'ResolveInstanceFieldsInUnitTask', | 4461 'ResolveInstanceFieldsInUnitTask', |
| 4367 createTask, | 4462 createTask, |
| 4368 buildInputs, | 4463 buildInputs, |
| 4369 <ResultDescriptor>[CREATED_RESOLVED_UNIT8, RESOLVED_UNIT8]); | 4464 <ResultDescriptor>[CREATED_RESOLVED_UNIT9, RESOLVED_UNIT9]); |
| 4370 | 4465 |
| 4371 /** | 4466 /** |
| 4372 * Initialize a newly created task to build a library element for the given | 4467 * Initialize a newly created task to build a library element for the given |
| 4373 * [unit] in the given [context]. | 4468 * [unit] in the given [context]. |
| 4374 */ | 4469 */ |
| 4375 ResolveInstanceFieldsInUnitTask( | 4470 ResolveInstanceFieldsInUnitTask( |
| 4376 InternalAnalysisContext context, LibrarySpecificUnit unit) | 4471 InternalAnalysisContext context, LibrarySpecificUnit unit) |
| 4377 : super(context, unit); | 4472 : super(context, unit); |
| 4378 | 4473 |
| 4379 @override | 4474 @override |
| (...skipping 24 matching lines...) Expand all Loading... |
| 4404 PartialResolverVisitor visitor = new PartialResolverVisitor( | 4499 PartialResolverVisitor visitor = new PartialResolverVisitor( |
| 4405 libraryElement, | 4500 libraryElement, |
| 4406 unitElement.source, | 4501 unitElement.source, |
| 4407 typeProvider, | 4502 typeProvider, |
| 4408 AnalysisErrorListener.NULL_LISTENER); | 4503 AnalysisErrorListener.NULL_LISTENER); |
| 4409 unit.accept(visitor); | 4504 unit.accept(visitor); |
| 4410 } | 4505 } |
| 4411 // | 4506 // |
| 4412 // Record outputs. | 4507 // Record outputs. |
| 4413 // | 4508 // |
| 4414 outputs[RESOLVED_UNIT8] = unit; | 4509 outputs[RESOLVED_UNIT9] = unit; |
| 4415 outputs[CREATED_RESOLVED_UNIT8] = true; | 4510 outputs[CREATED_RESOLVED_UNIT9] = true; |
| 4416 } | 4511 } |
| 4417 | 4512 |
| 4418 /** | 4513 /** |
| 4419 * Return a map from the names of the inputs of this kind of task to the task | 4514 * Return a map from the names of the inputs of this kind of task to the task |
| 4420 * input descriptors describing those inputs for a task with the given | 4515 * input descriptors describing those inputs for a task with the given |
| 4421 * [libSource]. | 4516 * [libSource]. |
| 4422 */ | 4517 */ |
| 4423 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 4518 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 4424 LibrarySpecificUnit unit = target; | 4519 LibrarySpecificUnit unit = target; |
| 4425 return <String, TaskInput>{ | 4520 return <String, TaskInput>{ |
| 4426 UNIT_INPUT: RESOLVED_UNIT7.of(unit), | 4521 UNIT_INPUT: RESOLVED_UNIT8.of(unit), |
| 4427 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), | 4522 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), |
| 4428 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 4523 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 4429 // In strong mode, add additional dependencies to enforce inference | 4524 // In strong mode, add additional dependencies to enforce inference |
| 4430 // ordering. | 4525 // ordering. |
| 4431 | 4526 |
| 4432 // Require that static variable inference be complete for all units in | 4527 // Require that static variable inference be complete for all units in |
| 4433 // the current library cycle. | 4528 // the current library cycle. |
| 4434 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( | 4529 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( |
| 4435 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT7.of( | 4530 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT8.of( |
| 4436 new LibrarySpecificUnit( | 4531 new LibrarySpecificUnit( |
| 4437 (unit as CompilationUnitElementImpl).librarySource, | 4532 (unit as CompilationUnitElementImpl).librarySource, |
| 4438 unit.source))), | 4533 unit.source))), |
| 4439 // Require that full inference be complete for all dependencies of the | 4534 // Require that full inference be complete for all dependencies of the |
| 4440 // current library cycle. | 4535 // current library cycle. |
| 4441 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( | 4536 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( |
| 4442 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of( | 4537 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of( |
| 4443 new LibrarySpecificUnit( | 4538 new LibrarySpecificUnit( |
| 4444 (unit as CompilationUnitElementImpl).librarySource, | 4539 (unit as CompilationUnitElementImpl).librarySource, |
| 4445 unit.source))) | 4540 unit.source))) |
| 4446 }; | 4541 }; |
| 4447 } | 4542 } |
| 4448 | 4543 |
| 4449 /** | 4544 /** |
| 4450 * Create a [ResolveInstanceFieldsInUnitTask] based on the given [target] in | 4545 * Create a [ResolveInstanceFieldsInUnitTask] based on the given [target] in |
| 4451 * the given [context]. | 4546 * the given [context]. |
| 4452 */ | 4547 */ |
| 4453 static ResolveInstanceFieldsInUnitTask createTask( | 4548 static ResolveInstanceFieldsInUnitTask createTask( |
| 4454 AnalysisContext context, AnalysisTarget target) { | 4549 AnalysisContext context, AnalysisTarget target) { |
| 4455 return new ResolveInstanceFieldsInUnitTask(context, target); | 4550 return new ResolveInstanceFieldsInUnitTask(context, target); |
| 4456 } | 4551 } |
| 4457 } | 4552 } |
| 4458 | 4553 |
| 4459 /** | 4554 /** |
| 4460 * A task that finishes resolution by requesting [RESOLVED_UNIT10] for every | 4555 * A task that finishes resolution by requesting [RESOLVED_UNIT11] for every |
| 4461 * unit in the libraries closure and produces [LIBRARY_ELEMENT8]. | 4556 * unit in the libraries closure and produces [LIBRARY_ELEMENT8]. |
| 4462 */ | 4557 */ |
| 4463 class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask { | 4558 class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask { |
| 4464 /** | 4559 /** |
| 4465 * The name of the [LIBRARY_ELEMENT7] input. | 4560 * The name of the [LIBRARY_ELEMENT7] input. |
| 4466 */ | 4561 */ |
| 4467 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 4562 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 4468 | 4563 |
| 4469 /** | 4564 /** |
| 4470 * The name of the list of [RESOLVED_UNIT10] input. | 4565 * The name of the list of [RESOLVED_UNIT11] input. |
| 4471 */ | 4566 */ |
| 4472 static const String UNITS_INPUT = 'UNITS_INPUT'; | 4567 static const String UNITS_INPUT = 'UNITS_INPUT'; |
| 4473 | 4568 |
| 4474 /** | 4569 /** |
| 4475 * The task descriptor describing this kind of task. | 4570 * The task descriptor describing this kind of task. |
| 4476 */ | 4571 */ |
| 4477 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 4572 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 4478 'ResolveLibraryReferencesTask', | 4573 'ResolveLibraryReferencesTask', |
| 4479 createTask, | 4574 createTask, |
| 4480 buildInputs, | 4575 buildInputs, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4508 | 4603 |
| 4509 /** | 4604 /** |
| 4510 * Return a map from the names of the inputs of this kind of task to the task | 4605 * Return a map from the names of the inputs of this kind of task to the task |
| 4511 * input descriptors describing those inputs for a task with the | 4606 * input descriptors describing those inputs for a task with the |
| 4512 * given [target]. | 4607 * given [target]. |
| 4513 */ | 4608 */ |
| 4514 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 4609 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 4515 Source source = target; | 4610 Source source = target; |
| 4516 return <String, TaskInput>{ | 4611 return <String, TaskInput>{ |
| 4517 LIBRARY_INPUT: LIBRARY_ELEMENT7.of(source), | 4612 LIBRARY_INPUT: LIBRARY_ELEMENT7.of(source), |
| 4518 UNITS_INPUT: LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT10), | 4613 UNITS_INPUT: LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT11), |
| 4519 }; | 4614 }; |
| 4520 } | 4615 } |
| 4521 | 4616 |
| 4522 /** | 4617 /** |
| 4523 * Create a [ResolveLibraryReferencesTask] based on the given [target] in | 4618 * Create a [ResolveLibraryReferencesTask] based on the given [target] in |
| 4524 * the given [context]. | 4619 * the given [context]. |
| 4525 */ | 4620 */ |
| 4526 static ResolveLibraryReferencesTask createTask( | 4621 static ResolveLibraryReferencesTask createTask( |
| 4527 AnalysisContext context, AnalysisTarget target) { | 4622 AnalysisContext context, AnalysisTarget target) { |
| 4528 return new ResolveLibraryReferencesTask(context, target); | 4623 return new ResolveLibraryReferencesTask(context, target); |
| 4529 } | 4624 } |
| 4530 } | 4625 } |
| 4531 | 4626 |
| 4532 /** | 4627 /** |
| 4533 * A task that finishes resolution by requesting [RESOLVED_UNIT11] for every | 4628 * A task that finishes resolution by requesting [RESOLVED_UNIT12] for every |
| 4534 * unit in the libraries closure and produces [LIBRARY_ELEMENT]. | 4629 * unit in the libraries closure and produces [LIBRARY_ELEMENT]. |
| 4535 */ | 4630 */ |
| 4536 class ResolveLibraryTask extends SourceBasedAnalysisTask { | 4631 class ResolveLibraryTask extends SourceBasedAnalysisTask { |
| 4537 /** | 4632 /** |
| 4538 * The name of the [LIBRARY_ELEMENT8] input. | 4633 * The name of the [LIBRARY_ELEMENT8] input. |
| 4539 */ | 4634 */ |
| 4540 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 4635 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 4541 | 4636 |
| 4542 /** | 4637 /** |
| 4543 * The name of the list of [RESOLVED_UNIT11] input. | 4638 * The name of the list of [RESOLVED_UNIT12] input. |
| 4544 */ | 4639 */ |
| 4545 static const String UNITS_INPUT = 'UNITS_INPUT'; | 4640 static const String UNITS_INPUT = 'UNITS_INPUT'; |
| 4546 | 4641 |
| 4547 /** | 4642 /** |
| 4548 * The task descriptor describing this kind of task. | 4643 * The task descriptor describing this kind of task. |
| 4549 */ | 4644 */ |
| 4550 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 4645 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 4551 'ResolveLibraryTask', | 4646 'ResolveLibraryTask', |
| 4552 createTask, | 4647 createTask, |
| 4553 buildInputs, | 4648 buildInputs, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4644 | 4739 |
| 4645 /** | 4740 /** |
| 4646 * Return a map from the names of the inputs of this kind of task to the task | 4741 * Return a map from the names of the inputs of this kind of task to the task |
| 4647 * input descriptors describing those inputs for a task with the | 4742 * input descriptors describing those inputs for a task with the |
| 4648 * given [target]. | 4743 * given [target]. |
| 4649 */ | 4744 */ |
| 4650 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 4745 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 4651 Source source = target; | 4746 Source source = target; |
| 4652 return <String, TaskInput>{ | 4747 return <String, TaskInput>{ |
| 4653 'resolvedUnit': | 4748 'resolvedUnit': |
| 4654 LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT3), | 4749 LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT4), |
| 4655 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(source), | 4750 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(source), |
| 4656 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 4751 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 4657 }; | 4752 }; |
| 4658 } | 4753 } |
| 4659 | 4754 |
| 4660 /** | 4755 /** |
| 4661 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in | 4756 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in |
| 4662 * the given [context]. | 4757 * the given [context]. |
| 4663 */ | 4758 */ |
| 4664 static ResolveLibraryTypeNamesTask createTask( | 4759 static ResolveLibraryTypeNamesTask createTask( |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4676 * The name of the input whose value is the defining [LIBRARY_ELEMENT7]. | 4771 * The name of the input whose value is the defining [LIBRARY_ELEMENT7]. |
| 4677 */ | 4772 */ |
| 4678 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 4773 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 4679 | 4774 |
| 4680 /** | 4775 /** |
| 4681 * The name of the [TYPE_PROVIDER] input. | 4776 * The name of the [TYPE_PROVIDER] input. |
| 4682 */ | 4777 */ |
| 4683 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 4778 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 4684 | 4779 |
| 4685 /** | 4780 /** |
| 4686 * The name of the [RESOLVED_UNIT9] input. | 4781 * The name of the [RESOLVED_UNIT10] input. |
| 4687 */ | 4782 */ |
| 4688 static const String UNIT_INPUT = 'UNIT_INPUT'; | 4783 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 4689 | 4784 |
| 4690 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 4785 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 4691 'ResolveUnitTask', createTask, buildInputs, <ResultDescriptor>[ | 4786 'ResolveUnitTask', createTask, buildInputs, <ResultDescriptor>[ |
| 4692 CONSTANT_EXPRESSIONS_DEPENDENCIES, | 4787 CONSTANT_EXPRESSIONS_DEPENDENCIES, |
| 4693 RESOLVE_UNIT_ERRORS, | 4788 RESOLVE_UNIT_ERRORS, |
| 4694 CREATED_RESOLVED_UNIT10, | 4789 CREATED_RESOLVED_UNIT11, |
| 4695 RESOLVED_UNIT10 | 4790 RESOLVED_UNIT11 |
| 4696 ]); | 4791 ]); |
| 4697 | 4792 |
| 4698 ResolveUnitTask( | 4793 ResolveUnitTask( |
| 4699 InternalAnalysisContext context, LibrarySpecificUnit compilationUnit) | 4794 InternalAnalysisContext context, LibrarySpecificUnit compilationUnit) |
| 4700 : super(context, compilationUnit); | 4795 : super(context, compilationUnit); |
| 4701 | 4796 |
| 4702 @override | 4797 @override |
| 4703 TaskDescriptor get descriptor => DESCRIPTOR; | 4798 TaskDescriptor get descriptor => DESCRIPTOR; |
| 4704 | 4799 |
| 4705 @override | 4800 @override |
| (...skipping 25 matching lines...) Expand all Loading... |
| 4731 } | 4826 } |
| 4732 // | 4827 // |
| 4733 // Record outputs. | 4828 // Record outputs. |
| 4734 // | 4829 // |
| 4735 // TODO(brianwilkerson) This task modifies the element model (by copying the | 4830 // TODO(brianwilkerson) This task modifies the element model (by copying the |
| 4736 // AST's for constructor initializers into it) but does not produce an | 4831 // AST's for constructor initializers into it) but does not produce an |
| 4737 // updated version of the element model. | 4832 // updated version of the element model. |
| 4738 // | 4833 // |
| 4739 outputs[CONSTANT_EXPRESSIONS_DEPENDENCIES] = constExprDependencies; | 4834 outputs[CONSTANT_EXPRESSIONS_DEPENDENCIES] = constExprDependencies; |
| 4740 outputs[RESOLVE_UNIT_ERRORS] = getTargetSourceErrors(errorListener, target); | 4835 outputs[RESOLVE_UNIT_ERRORS] = getTargetSourceErrors(errorListener, target); |
| 4741 outputs[RESOLVED_UNIT10] = unit; | 4836 outputs[RESOLVED_UNIT11] = unit; |
| 4742 outputs[CREATED_RESOLVED_UNIT10] = true; | 4837 outputs[CREATED_RESOLVED_UNIT11] = true; |
| 4743 } | 4838 } |
| 4744 | 4839 |
| 4745 /** | 4840 /** |
| 4746 * Return a map from the names of the inputs of this kind of task to the task | 4841 * Return a map from the names of the inputs of this kind of task to the task |
| 4747 * input descriptors describing those inputs for a task with the given | 4842 * input descriptors describing those inputs for a task with the given |
| 4748 * [target]. | 4843 * [target]. |
| 4749 */ | 4844 */ |
| 4750 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 4845 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 4751 LibrarySpecificUnit unit = target; | 4846 LibrarySpecificUnit unit = target; |
| 4752 return <String, TaskInput>{ | 4847 return <String, TaskInput>{ |
| 4753 LIBRARY_INPUT: LIBRARY_ELEMENT7.of(unit.library), | 4848 LIBRARY_INPUT: LIBRARY_ELEMENT7.of(unit.library), |
| 4754 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 4849 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 4755 UNIT_INPUT: RESOLVED_UNIT9.of(unit), | 4850 UNIT_INPUT: RESOLVED_UNIT10.of(unit), |
| 4756 // In strong mode, add additional dependencies to enforce inference | 4851 // In strong mode, add additional dependencies to enforce inference |
| 4757 // ordering. | 4852 // ordering. |
| 4758 | 4853 |
| 4759 // Require that inference be complete for all units in the | 4854 // Require that inference be complete for all units in the |
| 4760 // current library cycle. | 4855 // current library cycle. |
| 4761 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( | 4856 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( |
| 4762 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT9.of( | 4857 (CompilationUnitElement unit) => CREATED_RESOLVED_UNIT10.of( |
| 4763 new LibrarySpecificUnit( | 4858 new LibrarySpecificUnit( |
| 4764 (unit as CompilationUnitElementImpl).librarySource, | 4859 (unit as CompilationUnitElementImpl).librarySource, |
| 4765 unit.source))) | 4860 unit.source))) |
| 4766 }; | 4861 }; |
| 4767 } | 4862 } |
| 4768 | 4863 |
| 4769 /** | 4864 /** |
| 4770 * Create a [ResolveUnitTask] based on the given [target] in | 4865 * Create a [ResolveUnitTask] based on the given [target] in |
| 4771 * the given [context]. | 4866 * the given [context]. |
| 4772 */ | 4867 */ |
| 4773 static ResolveUnitTask createTask( | 4868 static ResolveUnitTask createTask( |
| 4774 AnalysisContext context, AnalysisTarget target) { | 4869 AnalysisContext context, AnalysisTarget target) { |
| 4775 return new ResolveUnitTask(context, target); | 4870 return new ResolveUnitTask(context, target); |
| 4776 } | 4871 } |
| 4777 } | 4872 } |
| 4778 | 4873 |
| 4779 /** | 4874 /** |
| 4780 * A task that builds [RESOLVED_UNIT3] for a unit. | 4875 * A task that builds [RESOLVED_UNIT4] for a unit. |
| 4781 */ | 4876 */ |
| 4782 class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask { | 4877 class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask { |
| 4783 /** | 4878 /** |
| 4784 * The name of the input whose value is the defining [LIBRARY_ELEMENT4]. | 4879 * The name of the input whose value is the defining [LIBRARY_ELEMENT4]. |
| 4785 */ | 4880 */ |
| 4786 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 4881 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 4787 | 4882 |
| 4788 /** | 4883 /** |
| 4789 * The name of the [RESOLVED_UNIT2] input. | 4884 * The name of the [RESOLVED_UNIT3] input. |
| 4790 */ | 4885 */ |
| 4791 static const String UNIT_INPUT = 'UNIT_INPUT'; | 4886 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 4792 | 4887 |
| 4793 /** | 4888 /** |
| 4794 * The name of the [TYPE_PROVIDER] input. | 4889 * The name of the [TYPE_PROVIDER] input. |
| 4795 */ | 4890 */ |
| 4796 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 4891 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 4797 | 4892 |
| 4798 /** | 4893 /** |
| 4799 * The task descriptor describing this kind of task. | 4894 * The task descriptor describing this kind of task. |
| 4800 */ | 4895 */ |
| 4801 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 4896 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 4802 'ResolveUnitTypeNamesTask', createTask, buildInputs, <ResultDescriptor>[ | 4897 'ResolveUnitTypeNamesTask', createTask, buildInputs, <ResultDescriptor>[ |
| 4803 RESOLVE_TYPE_NAMES_ERRORS, | 4898 RESOLVE_TYPE_NAMES_ERRORS, |
| 4804 CREATED_RESOLVED_UNIT3, | 4899 CREATED_RESOLVED_UNIT4, |
| 4805 RESOLVED_UNIT3 | 4900 RESOLVED_UNIT4 |
| 4806 ]); | 4901 ]); |
| 4807 | 4902 |
| 4808 ResolveUnitTypeNamesTask( | 4903 ResolveUnitTypeNamesTask( |
| 4809 InternalAnalysisContext context, AnalysisTarget target) | 4904 InternalAnalysisContext context, AnalysisTarget target) |
| 4810 : super(context, target); | 4905 : super(context, target); |
| 4811 | 4906 |
| 4812 @override | 4907 @override |
| 4813 TaskDescriptor get descriptor => DESCRIPTOR; | 4908 TaskDescriptor get descriptor => DESCRIPTOR; |
| 4814 | 4909 |
| 4815 @override | 4910 @override |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4826 // | 4921 // |
| 4827 RecordingErrorListener errorListener = new RecordingErrorListener(); | 4922 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 4828 TypeResolverVisitor visitor = new TypeResolverVisitor( | 4923 TypeResolverVisitor visitor = new TypeResolverVisitor( |
| 4829 library, unitElement.source, typeProvider, errorListener); | 4924 library, unitElement.source, typeProvider, errorListener); |
| 4830 unit.accept(visitor); | 4925 unit.accept(visitor); |
| 4831 // | 4926 // |
| 4832 // Record outputs. | 4927 // Record outputs. |
| 4833 // | 4928 // |
| 4834 outputs[RESOLVE_TYPE_NAMES_ERRORS] = | 4929 outputs[RESOLVE_TYPE_NAMES_ERRORS] = |
| 4835 getTargetSourceErrors(errorListener, target); | 4930 getTargetSourceErrors(errorListener, target); |
| 4836 outputs[RESOLVED_UNIT3] = unit; | 4931 outputs[RESOLVED_UNIT4] = unit; |
| 4837 outputs[CREATED_RESOLVED_UNIT3] = true; | 4932 outputs[CREATED_RESOLVED_UNIT4] = true; |
| 4838 } | 4933 } |
| 4839 | 4934 |
| 4840 /** | 4935 /** |
| 4841 * Return a map from the names of the inputs of this kind of task to the task | 4936 * Return a map from the names of the inputs of this kind of task to the task |
| 4842 * input descriptors describing those inputs for a task with the | 4937 * input descriptors describing those inputs for a task with the |
| 4843 * given [target]. | 4938 * given [target]. |
| 4844 */ | 4939 */ |
| 4845 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 4940 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 4846 // TODO(brianwilkerson) This task updates the element model to have type | 4941 // TODO(brianwilkerson) This task updates the element model to have type |
| 4847 // information and updates the class hierarchy. It should produce a new | 4942 // information and updates the class hierarchy. It should produce a new |
| 4848 // version of the element model in order to record those changes. | 4943 // version of the element model in order to record those changes. |
| 4849 LibrarySpecificUnit unit = target; | 4944 LibrarySpecificUnit unit = target; |
| 4850 return <String, TaskInput>{ | 4945 return <String, TaskInput>{ |
| 4851 'importsExportNamespace': | 4946 'importsExportNamespace': |
| 4852 IMPORTED_LIBRARIES.of(unit.library).toMapOf(LIBRARY_ELEMENT4), | 4947 IMPORTED_LIBRARIES.of(unit.library).toMapOf(LIBRARY_ELEMENT4), |
| 4853 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(unit.library), | 4948 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(unit.library), |
| 4854 UNIT_INPUT: RESOLVED_UNIT2.of(unit), | 4949 UNIT_INPUT: RESOLVED_UNIT3.of(unit), |
| 4855 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 4950 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 4856 }; | 4951 }; |
| 4857 } | 4952 } |
| 4858 | 4953 |
| 4859 /** | 4954 /** |
| 4860 * Create a [ResolveUnitTypeNamesTask] based on the given [target] in | 4955 * Create a [ResolveUnitTypeNamesTask] based on the given [target] in |
| 4861 * the given [context]. | 4956 * the given [context]. |
| 4862 */ | 4957 */ |
| 4863 static ResolveUnitTypeNamesTask createTask( | 4958 static ResolveUnitTypeNamesTask createTask( |
| 4864 AnalysisContext context, AnalysisTarget target) { | 4959 AnalysisContext context, AnalysisTarget target) { |
| 4865 return new ResolveUnitTypeNamesTask(context, target); | 4960 return new ResolveUnitTypeNamesTask(context, target); |
| 4866 } | 4961 } |
| 4867 } | 4962 } |
| 4868 | 4963 |
| 4869 /** | 4964 /** |
| 4870 * A task that builds [RESOLVED_UNIT4] for a unit. | 4965 * A task that builds [RESOLVED_UNIT5] for a unit. |
| 4871 */ | 4966 */ |
| 4872 class ResolveVariableReferencesTask extends SourceBasedAnalysisTask { | 4967 class ResolveVariableReferencesTask extends SourceBasedAnalysisTask { |
| 4873 /** | 4968 /** |
| 4874 * The name of the [LIBRARY_ELEMENT1] input. | 4969 * The name of the [LIBRARY_ELEMENT1] input. |
| 4875 */ | 4970 */ |
| 4876 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 4971 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 4877 | 4972 |
| 4878 /** | 4973 /** |
| 4879 * The name of the [RESOLVED_UNIT3] input. | 4974 * The name of the [RESOLVED_UNIT4] input. |
| 4880 */ | 4975 */ |
| 4881 static const String UNIT_INPUT = 'UNIT_INPUT'; | 4976 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 4882 | 4977 |
| 4883 /** | 4978 /** |
| 4884 * The name of the [TYPE_PROVIDER] input. | 4979 * The name of the [TYPE_PROVIDER] input. |
| 4885 */ | 4980 */ |
| 4886 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 4981 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 4887 | 4982 |
| 4888 /** | 4983 /** |
| 4889 * The task descriptor describing this kind of task. | 4984 * The task descriptor describing this kind of task. |
| 4890 */ | 4985 */ |
| 4891 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 4986 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 4892 'ResolveVariableReferencesTask', | 4987 'ResolveVariableReferencesTask', |
| 4893 createTask, | 4988 createTask, |
| 4894 buildInputs, <ResultDescriptor>[ | 4989 buildInputs, <ResultDescriptor>[ |
| 4895 CREATED_RESOLVED_UNIT4, | 4990 CREATED_RESOLVED_UNIT5, |
| 4896 RESOLVED_UNIT4, | 4991 RESOLVED_UNIT5, |
| 4897 VARIABLE_REFERENCE_ERRORS | 4992 VARIABLE_REFERENCE_ERRORS |
| 4898 ]); | 4993 ]); |
| 4899 | 4994 |
| 4900 ResolveVariableReferencesTask( | 4995 ResolveVariableReferencesTask( |
| 4901 InternalAnalysisContext context, AnalysisTarget target) | 4996 InternalAnalysisContext context, AnalysisTarget target) |
| 4902 : super(context, target); | 4997 : super(context, target); |
| 4903 | 4998 |
| 4904 @override | 4999 @override |
| 4905 TaskDescriptor get descriptor => DESCRIPTOR; | 5000 TaskDescriptor get descriptor => DESCRIPTOR; |
| 4906 | 5001 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 4918 // | 5013 // |
| 4919 RecordingErrorListener errorListener = new RecordingErrorListener(); | 5014 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 4920 Scope nameScope = new LibraryScope(libraryElement, errorListener); | 5015 Scope nameScope = new LibraryScope(libraryElement, errorListener); |
| 4921 VariableResolverVisitor visitor = new VariableResolverVisitor( | 5016 VariableResolverVisitor visitor = new VariableResolverVisitor( |
| 4922 libraryElement, unitElement.source, typeProvider, errorListener, | 5017 libraryElement, unitElement.source, typeProvider, errorListener, |
| 4923 nameScope: nameScope); | 5018 nameScope: nameScope); |
| 4924 unit.accept(visitor); | 5019 unit.accept(visitor); |
| 4925 // | 5020 // |
| 4926 // Record outputs. | 5021 // Record outputs. |
| 4927 // | 5022 // |
| 4928 outputs[RESOLVED_UNIT4] = unit; | 5023 outputs[RESOLVED_UNIT5] = unit; |
| 4929 outputs[CREATED_RESOLVED_UNIT4] = true; | 5024 outputs[CREATED_RESOLVED_UNIT5] = true; |
| 4930 outputs[VARIABLE_REFERENCE_ERRORS] = | 5025 outputs[VARIABLE_REFERENCE_ERRORS] = |
| 4931 getTargetSourceErrors(errorListener, target); | 5026 getTargetSourceErrors(errorListener, target); |
| 4932 } | 5027 } |
| 4933 | 5028 |
| 4934 /** | 5029 /** |
| 4935 * Return a map from the names of the inputs of this kind of task to the task | 5030 * Return a map from the names of the inputs of this kind of task to the task |
| 4936 * input descriptors describing those inputs for a task with the | 5031 * input descriptors describing those inputs for a task with the |
| 4937 * given [target]. | 5032 * given [target]. |
| 4938 */ | 5033 */ |
| 4939 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 5034 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 4940 LibrarySpecificUnit unit = target; | 5035 LibrarySpecificUnit unit = target; |
| 4941 return <String, TaskInput>{ | 5036 return <String, TaskInput>{ |
| 4942 LIBRARY_INPUT: LIBRARY_ELEMENT1.of(unit.library), | 5037 LIBRARY_INPUT: LIBRARY_ELEMENT1.of(unit.library), |
| 4943 UNIT_INPUT: RESOLVED_UNIT3.of(unit), | 5038 UNIT_INPUT: RESOLVED_UNIT4.of(unit), |
| 4944 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 5039 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 4945 }; | 5040 }; |
| 4946 } | 5041 } |
| 4947 | 5042 |
| 4948 /** | 5043 /** |
| 4949 * Create a [ResolveVariableReferencesTask] based on the given [target] in | 5044 * Create a [ResolveVariableReferencesTask] based on the given [target] in |
| 4950 * the given [context]. | 5045 * the given [context]. |
| 4951 */ | 5046 */ |
| 4952 static ResolveVariableReferencesTask createTask( | 5047 static ResolveVariableReferencesTask createTask( |
| 4953 AnalysisContext context, AnalysisTarget target) { | 5048 AnalysisContext context, AnalysisTarget target) { |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5085 return TaskSuitability.NONE; | 5180 return TaskSuitability.NONE; |
| 5086 } | 5181 } |
| 5087 } | 5182 } |
| 5088 | 5183 |
| 5089 /** | 5184 /** |
| 5090 * A task that builds [STRONG_MODE_ERRORS] for a unit. Also builds | 5185 * A task that builds [STRONG_MODE_ERRORS] for a unit. Also builds |
| 5091 * [RESOLVED_UNIT] for a unit. | 5186 * [RESOLVED_UNIT] for a unit. |
| 5092 */ | 5187 */ |
| 5093 class StrongModeVerifyUnitTask extends SourceBasedAnalysisTask { | 5188 class StrongModeVerifyUnitTask extends SourceBasedAnalysisTask { |
| 5094 /** | 5189 /** |
| 5095 * The name of the [RESOLVED_UNIT11] input. | 5190 * The name of the [RESOLVED_UNIT12] input. |
| 5096 */ | 5191 */ |
| 5097 static const String UNIT_INPUT = 'UNIT_INPUT'; | 5192 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 5098 | 5193 |
| 5099 /** | 5194 /** |
| 5100 * The name of the [TYPE_PROVIDER] input. | 5195 * The name of the [TYPE_PROVIDER] input. |
| 5101 */ | 5196 */ |
| 5102 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 5197 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 5103 | 5198 |
| 5104 /** | 5199 /** |
| 5105 * The task descriptor describing this kind of task. | 5200 * The task descriptor describing this kind of task. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5141 } | 5236 } |
| 5142 | 5237 |
| 5143 /** | 5238 /** |
| 5144 * Return a map from the names of the inputs of this kind of task to the task | 5239 * Return a map from the names of the inputs of this kind of task to the task |
| 5145 * input descriptors describing those inputs for a task with the | 5240 * input descriptors describing those inputs for a task with the |
| 5146 * given [target]. | 5241 * given [target]. |
| 5147 */ | 5242 */ |
| 5148 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 5243 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 5149 LibrarySpecificUnit unit = target; | 5244 LibrarySpecificUnit unit = target; |
| 5150 return <String, TaskInput>{ | 5245 return <String, TaskInput>{ |
| 5151 UNIT_INPUT: RESOLVED_UNIT11.of(unit), | 5246 UNIT_INPUT: RESOLVED_UNIT12.of(unit), |
| 5152 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), | 5247 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), |
| 5153 }; | 5248 }; |
| 5154 } | 5249 } |
| 5155 | 5250 |
| 5156 /** | 5251 /** |
| 5157 * Create a [StrongModeVerifyUnitTask] based on the given [target] in | 5252 * Create a [StrongModeVerifyUnitTask] based on the given [target] in |
| 5158 * the given [context]. | 5253 * the given [context]. |
| 5159 */ | 5254 */ |
| 5160 static StrongModeVerifyUnitTask createTask( | 5255 static StrongModeVerifyUnitTask createTask( |
| 5161 AnalysisContext context, AnalysisTarget target) { | 5256 AnalysisContext context, AnalysisTarget target) { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5394 | 5489 |
| 5395 @override | 5490 @override |
| 5396 bool moveNext() { | 5491 bool moveNext() { |
| 5397 if (_newSources.isEmpty) { | 5492 if (_newSources.isEmpty) { |
| 5398 return false; | 5493 return false; |
| 5399 } | 5494 } |
| 5400 currentTarget = _newSources.removeLast(); | 5495 currentTarget = _newSources.removeLast(); |
| 5401 return true; | 5496 return true; |
| 5402 } | 5497 } |
| 5403 } | 5498 } |
| OLD | NEW |