| 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 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 import 'package:analyzer/src/context/cache.dart'; | 10 import 'package:analyzer/src/context/cache.dart'; |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 * | 362 * |
| 363 * [RESOLVED_UNIT4] plus resolved local variables and formal parameters. | 363 * [RESOLVED_UNIT4] plus resolved local variables and formal parameters. |
| 364 * | 364 * |
| 365 * The result is only available for [LibrarySpecificUnit]s. | 365 * The result is only available for [LibrarySpecificUnit]s. |
| 366 */ | 366 */ |
| 367 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 = | 367 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 = |
| 368 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, | 368 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, |
| 369 cachingPolicy: AST_CACHING_POLICY); | 369 cachingPolicy: AST_CACHING_POLICY); |
| 370 | 370 |
| 371 /** | 371 /** |
| 372 * The resolved [CompilationUnit] associated with a compilation unit, with | |
| 373 * constants not yet resolved. | |
| 374 * | |
| 375 * The result is only available for [LibrarySpecificUnit]s. | |
| 376 */ | |
| 377 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT6 = | |
| 378 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT6', null, | |
| 379 cachingPolicy: AST_CACHING_POLICY); | |
| 380 | |
| 381 /** | |
| 382 * The errors produced while scanning a compilation unit. | 372 * The errors produced while scanning a compilation unit. |
| 383 * | 373 * |
| 384 * The list will be empty if there were no errors, but will not be `null`. | 374 * The list will be empty if there were no errors, but will not be `null`. |
| 385 * | 375 * |
| 386 * The result is only available for [Source]s representing a compilation unit. | 376 * The result is only available for [Source]s representing a compilation unit. |
| 387 */ | 377 */ |
| 388 final ListResultDescriptor<AnalysisError> SCAN_ERRORS = | 378 final ListResultDescriptor<AnalysisError> SCAN_ERRORS = |
| 389 new ListResultDescriptor<AnalysisError>( | 379 new ListResultDescriptor<AnalysisError>( |
| 390 'SCAN_ERRORS', AnalysisError.NO_ERRORS); | 380 'SCAN_ERRORS', AnalysisError.NO_ERRORS); |
| 391 | 381 |
| (...skipping 1342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1734 AnalysisContext context, AnalysisContextTarget target) { | 1724 AnalysisContext context, AnalysisContextTarget target) { |
| 1735 return new BuildTypeProviderTask(context, target); | 1725 return new BuildTypeProviderTask(context, target); |
| 1736 } | 1726 } |
| 1737 } | 1727 } |
| 1738 | 1728 |
| 1739 /** | 1729 /** |
| 1740 * A task that computes [CONSTANT_DEPENDENCIES] for a constant. | 1730 * A task that computes [CONSTANT_DEPENDENCIES] for a constant. |
| 1741 */ | 1731 */ |
| 1742 class ComputeConstantDependenciesTask extends ConstantEvaluationAnalysisTask { | 1732 class ComputeConstantDependenciesTask extends ConstantEvaluationAnalysisTask { |
| 1743 /** | 1733 /** |
| 1744 * The name of the [RESOLVED_UNIT6] input. | 1734 * The name of the [RESOLVED_UNIT_NO_CONSTANTS] input. |
| 1745 */ | 1735 */ |
| 1746 static const String UNIT_INPUT = 'UNIT_INPUT'; | 1736 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 1747 | 1737 |
| 1748 /** | 1738 /** |
| 1749 * The name of the [TYPE_PROVIDER] input. | 1739 * The name of the [TYPE_PROVIDER] input. |
| 1750 */ | 1740 */ |
| 1751 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 1741 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 1752 | 1742 |
| 1753 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1743 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1754 'ComputeConstantDependenciesTask', createTask, buildInputs, | 1744 'ComputeConstantDependenciesTask', createTask, buildInputs, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1788 /** | 1778 /** |
| 1789 * Return a map from the names of the inputs of this kind of task to the task | 1779 * Return a map from the names of the inputs of this kind of task to the task |
| 1790 * input descriptors describing those inputs for a task with the | 1780 * input descriptors describing those inputs for a task with the |
| 1791 * given [target]. | 1781 * given [target]. |
| 1792 */ | 1782 */ |
| 1793 static Map<String, TaskInput> buildInputs(ConstantEvaluationTarget target) { | 1783 static Map<String, TaskInput> buildInputs(ConstantEvaluationTarget target) { |
| 1794 if (target is Element) { | 1784 if (target is Element) { |
| 1795 CompilationUnitElementImpl unit = (target as Element) | 1785 CompilationUnitElementImpl unit = (target as Element) |
| 1796 .getAncestor((Element element) => element is CompilationUnitElement); | 1786 .getAncestor((Element element) => element is CompilationUnitElement); |
| 1797 return <String, TaskInput>{ | 1787 return <String, TaskInput>{ |
| 1798 UNIT_INPUT: RESOLVED_UNIT6 | 1788 UNIT_INPUT: RESOLVED_UNIT_NO_CONSTANTS |
| 1799 .of(new LibrarySpecificUnit(unit.librarySource, target.source)), | 1789 .of(new LibrarySpecificUnit(unit.librarySource, target.source)), |
| 1800 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 1790 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 1801 }; | 1791 }; |
| 1802 } else if (target is ConstantEvaluationTarget_Annotation) { | 1792 } else if (target is ConstantEvaluationTarget_Annotation) { |
| 1803 return <String, TaskInput>{ | 1793 return <String, TaskInput>{ |
| 1804 UNIT_INPUT: RESOLVED_UNIT6 | 1794 UNIT_INPUT: RESOLVED_UNIT_NO_CONSTANTS |
| 1805 .of(new LibrarySpecificUnit(target.librarySource, target.source)), | 1795 .of(new LibrarySpecificUnit(target.librarySource, target.source)), |
| 1806 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 1796 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 1807 }; | 1797 }; |
| 1808 } else { | 1798 } else { |
| 1809 // Should never happen. | 1799 // Should never happen. |
| 1810 assert(false); | 1800 assert(false); |
| 1811 return <String, TaskInput>{}; | 1801 return <String, TaskInput>{}; |
| 1812 } | 1802 } |
| 1813 } | 1803 } |
| 1814 | 1804 |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2081 AnalysisContext context, AnalysisTarget target) { | 2071 AnalysisContext context, AnalysisTarget target) { |
| 2082 return new DartErrorsTask(context, target); | 2072 return new DartErrorsTask(context, target); |
| 2083 } | 2073 } |
| 2084 } | 2074 } |
| 2085 | 2075 |
| 2086 /** | 2076 /** |
| 2087 * A task that builds [RESOLVED_UNIT] for a unit. | 2077 * A task that builds [RESOLVED_UNIT] for a unit. |
| 2088 */ | 2078 */ |
| 2089 class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { | 2079 class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { |
| 2090 /** | 2080 /** |
| 2091 * The name of the [RESOLVED_UNIT6] input. | 2081 * The name of the [RESOLVED_UNIT_NO_CONSTANTS] input. |
| 2092 */ | 2082 */ |
| 2093 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2083 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2094 | 2084 |
| 2095 /** | 2085 /** |
| 2096 * The name of the [CONSTANT_VALUE] input. | 2086 * The name of the [CONSTANT_VALUE] input. |
| 2097 */ | 2087 */ |
| 2098 static const String CONSTANT_VALUES = 'CONSTANT_VALUES'; | 2088 static const String CONSTANT_VALUES = 'CONSTANT_VALUES'; |
| 2099 | 2089 |
| 2100 /** | 2090 /** |
| 2101 * The task descriptor describing this kind of task. | 2091 * The task descriptor describing this kind of task. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2119 } | 2109 } |
| 2120 | 2110 |
| 2121 /** | 2111 /** |
| 2122 * Return a map from the names of the inputs of this kind of task to the task | 2112 * Return a map from the names of the inputs of this kind of task to the task |
| 2123 * input descriptors describing those inputs for a task with the | 2113 * input descriptors describing those inputs for a task with the |
| 2124 * given [target]. | 2114 * given [target]. |
| 2125 */ | 2115 */ |
| 2126 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 2116 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 2127 return <String, TaskInput>{ | 2117 return <String, TaskInput>{ |
| 2128 'libraryElement': LIBRARY_ELEMENT.of(target.library), | 2118 'libraryElement': LIBRARY_ELEMENT.of(target.library), |
| 2129 UNIT_INPUT: RESOLVED_UNIT6.of(target), | 2119 UNIT_INPUT: RESOLVED_UNIT_NO_CONSTANTS.of(target), |
| 2130 CONSTANT_VALUES: | 2120 CONSTANT_VALUES: |
| 2131 COMPILATION_UNIT_CONSTANTS.of(target).toListOf(CONSTANT_VALUE) | 2121 COMPILATION_UNIT_CONSTANTS.of(target).toListOf(CONSTANT_VALUE) |
| 2132 }; | 2122 }; |
| 2133 } | 2123 } |
| 2134 | 2124 |
| 2135 /** | 2125 /** |
| 2136 * Create an [EvaluateUnitConstantsTask] based on the given [target] in | 2126 * Create an [EvaluateUnitConstantsTask] based on the given [target] in |
| 2137 * the given [context]. | 2127 * the given [context]. |
| 2138 */ | 2128 */ |
| 2139 static EvaluateUnitConstantsTask createTask( | 2129 static EvaluateUnitConstantsTask createTask( |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2243 } | 2233 } |
| 2244 return newNames; | 2234 return newNames; |
| 2245 } | 2235 } |
| 2246 } | 2236 } |
| 2247 | 2237 |
| 2248 /** | 2238 /** |
| 2249 * A task that builds [USED_IMPORTED_ELEMENTS] for a unit. | 2239 * A task that builds [USED_IMPORTED_ELEMENTS] for a unit. |
| 2250 */ | 2240 */ |
| 2251 class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { | 2241 class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { |
| 2252 /** | 2242 /** |
| 2253 * The name of the [RESOLVED_UNIT6] input. | 2243 * The name of the [RESOLVED_UNIT_NO_CONSTANTS] input. |
| 2254 */ | 2244 */ |
| 2255 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2245 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2256 | 2246 |
| 2257 /** | 2247 /** |
| 2258 * The task descriptor describing this kind of task. | 2248 * The task descriptor describing this kind of task. |
| 2259 */ | 2249 */ |
| 2260 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2250 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2261 'GatherUsedImportedElementsTask', createTask, buildInputs, | 2251 'GatherUsedImportedElementsTask', createTask, buildInputs, |
| 2262 <ResultDescriptor>[USED_IMPORTED_ELEMENTS]); | 2252 <ResultDescriptor>[USED_IMPORTED_ELEMENTS]); |
| 2263 | 2253 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2284 // | 2274 // |
| 2285 outputs[USED_IMPORTED_ELEMENTS] = visitor.usedElements; | 2275 outputs[USED_IMPORTED_ELEMENTS] = visitor.usedElements; |
| 2286 } | 2276 } |
| 2287 | 2277 |
| 2288 /** | 2278 /** |
| 2289 * Return a map from the names of the inputs of this kind of task to the task | 2279 * Return a map from the names of the inputs of this kind of task to the task |
| 2290 * input descriptors describing those inputs for a task with the | 2280 * input descriptors describing those inputs for a task with the |
| 2291 * given [target]. | 2281 * given [target]. |
| 2292 */ | 2282 */ |
| 2293 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 2283 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 2294 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT6.of(target)}; | 2284 return <String, TaskInput>{ |
| 2285 UNIT_INPUT: RESOLVED_UNIT_NO_CONSTANTS.of(target) |
| 2286 }; |
| 2295 } | 2287 } |
| 2296 | 2288 |
| 2297 /** | 2289 /** |
| 2298 * Create a [GatherUsedImportedElementsTask] based on the given [target] in | 2290 * Create a [GatherUsedImportedElementsTask] based on the given [target] in |
| 2299 * the given [context]. | 2291 * the given [context]. |
| 2300 */ | 2292 */ |
| 2301 static GatherUsedImportedElementsTask createTask( | 2293 static GatherUsedImportedElementsTask createTask( |
| 2302 AnalysisContext context, LibrarySpecificUnit target) { | 2294 AnalysisContext context, LibrarySpecificUnit target) { |
| 2303 return new GatherUsedImportedElementsTask(context, target); | 2295 return new GatherUsedImportedElementsTask(context, target); |
| 2304 } | 2296 } |
| 2305 } | 2297 } |
| 2306 | 2298 |
| 2307 /** | 2299 /** |
| 2308 * A task that builds [USED_LOCAL_ELEMENTS] for a unit. | 2300 * A task that builds [USED_LOCAL_ELEMENTS] for a unit. |
| 2309 */ | 2301 */ |
| 2310 class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { | 2302 class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { |
| 2311 /** | 2303 /** |
| 2312 * The name of the [RESOLVED_UNIT6] input. | 2304 * The name of the [RESOLVED_UNIT_NO_CONSTANTS] input. |
| 2313 */ | 2305 */ |
| 2314 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2306 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2315 | 2307 |
| 2316 /** | 2308 /** |
| 2317 * The task descriptor describing this kind of task. | 2309 * The task descriptor describing this kind of task. |
| 2318 */ | 2310 */ |
| 2319 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2311 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2320 'GatherUsedLocalElementsTask', createTask, buildInputs, | 2312 'GatherUsedLocalElementsTask', createTask, buildInputs, |
| 2321 <ResultDescriptor>[USED_LOCAL_ELEMENTS]); | 2313 <ResultDescriptor>[USED_LOCAL_ELEMENTS]); |
| 2322 | 2314 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2343 // | 2335 // |
| 2344 outputs[USED_LOCAL_ELEMENTS] = visitor.usedElements; | 2336 outputs[USED_LOCAL_ELEMENTS] = visitor.usedElements; |
| 2345 } | 2337 } |
| 2346 | 2338 |
| 2347 /** | 2339 /** |
| 2348 * Return a map from the names of the inputs of this kind of task to the task | 2340 * Return a map from the names of the inputs of this kind of task to the task |
| 2349 * input descriptors describing those inputs for a task with the | 2341 * input descriptors describing those inputs for a task with the |
| 2350 * given [target]. | 2342 * given [target]. |
| 2351 */ | 2343 */ |
| 2352 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 2344 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 2353 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT6.of(target)}; | 2345 return <String, TaskInput>{ |
| 2346 UNIT_INPUT: RESOLVED_UNIT_NO_CONSTANTS.of(target) |
| 2347 }; |
| 2354 } | 2348 } |
| 2355 | 2349 |
| 2356 /** | 2350 /** |
| 2357 * Create a [GatherUsedLocalElementsTask] based on the given [target] in | 2351 * Create a [GatherUsedLocalElementsTask] based on the given [target] in |
| 2358 * the given [context]. | 2352 * the given [context]. |
| 2359 */ | 2353 */ |
| 2360 static GatherUsedLocalElementsTask createTask( | 2354 static GatherUsedLocalElementsTask createTask( |
| 2361 AnalysisContext context, LibrarySpecificUnit target) { | 2355 AnalysisContext context, LibrarySpecificUnit target) { |
| 2362 return new GatherUsedLocalElementsTask(context, target); | 2356 return new GatherUsedLocalElementsTask(context, target); |
| 2363 } | 2357 } |
| 2364 } | 2358 } |
| 2365 | 2359 |
| 2366 /** | 2360 /** |
| 2367 * A task that generates [HINTS] for a unit. | 2361 * A task that generates [HINTS] for a unit. |
| 2368 */ | 2362 */ |
| 2369 class GenerateHintsTask extends SourceBasedAnalysisTask { | 2363 class GenerateHintsTask extends SourceBasedAnalysisTask { |
| 2370 /** | 2364 /** |
| 2371 * The name of the [RESOLVED_UNIT6] input. | 2365 * The name of the [RESOLVED_UNIT_NO_CONSTANTS] input. |
| 2372 */ | 2366 */ |
| 2373 static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT'; | 2367 static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT'; |
| 2374 | 2368 |
| 2375 /** | 2369 /** |
| 2376 * The name of a list of [USED_LOCAL_ELEMENTS] for each library unit input. | 2370 * The name of a list of [USED_LOCAL_ELEMENTS] for each library unit input. |
| 2377 */ | 2371 */ |
| 2378 static const String USED_LOCAL_ELEMENTS_INPUT = 'USED_LOCAL_ELEMENTS'; | 2372 static const String USED_LOCAL_ELEMENTS_INPUT = 'USED_LOCAL_ELEMENTS'; |
| 2379 | 2373 |
| 2380 /** | 2374 /** |
| 2381 * The name of a list of [USED_IMPORTED_ELEMENTS] for each library unit input. | 2375 * The name of a list of [USED_IMPORTED_ELEMENTS] for each library unit input. |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2866 void _addPublicNames(CompilationUnitElement compilationUnit) { | 2860 void _addPublicNames(CompilationUnitElement compilationUnit) { |
| 2867 compilationUnit.accessors.forEach(_addIfPublic); | 2861 compilationUnit.accessors.forEach(_addIfPublic); |
| 2868 compilationUnit.enums.forEach(_addIfPublic); | 2862 compilationUnit.enums.forEach(_addIfPublic); |
| 2869 compilationUnit.functions.forEach(_addIfPublic); | 2863 compilationUnit.functions.forEach(_addIfPublic); |
| 2870 compilationUnit.functionTypeAliases.forEach(_addIfPublic); | 2864 compilationUnit.functionTypeAliases.forEach(_addIfPublic); |
| 2871 compilationUnit.types.forEach(_addIfPublic); | 2865 compilationUnit.types.forEach(_addIfPublic); |
| 2872 } | 2866 } |
| 2873 } | 2867 } |
| 2874 | 2868 |
| 2875 /** | 2869 /** |
| 2876 * A task that finishes resolution by requesting [RESOLVED_UNIT6] for every | 2870 * A task that finishes resolution by requesting [RESOLVED_UNIT_NO_CONSTANTS] fo
r every |
| 2877 * unit in the libraries closure and produces [LIBRARY_ELEMENT]. | 2871 * unit in the libraries closure and produces [LIBRARY_ELEMENT]. |
| 2878 */ | 2872 */ |
| 2879 class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask { | 2873 class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask { |
| 2880 /** | 2874 /** |
| 2881 * The name of the [LIBRARY_ELEMENT6] input. | 2875 * The name of the [LIBRARY_ELEMENT6] input. |
| 2882 */ | 2876 */ |
| 2883 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 2877 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 2884 | 2878 |
| 2885 /** | 2879 /** |
| 2886 * The task descriptor describing this kind of task. | 2880 * The task descriptor describing this kind of task. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2906 * Return a map from the names of the inputs of this kind of task to the task | 2900 * Return a map from the names of the inputs of this kind of task to the task |
| 2907 * input descriptors describing those inputs for a task with the | 2901 * input descriptors describing those inputs for a task with the |
| 2908 * given [target]. | 2902 * given [target]. |
| 2909 */ | 2903 */ |
| 2910 static Map<String, TaskInput> buildInputs(Source libSource) { | 2904 static Map<String, TaskInput> buildInputs(Source libSource) { |
| 2911 return <String, TaskInput>{ | 2905 return <String, TaskInput>{ |
| 2912 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(libSource), | 2906 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(libSource), |
| 2913 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE | 2907 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE |
| 2914 .of(libSource) | 2908 .of(libSource) |
| 2915 .toMapOf(UNITS) | 2909 .toMapOf(UNITS) |
| 2916 .toFlattenList((Source library, Source unit) => | 2910 .toFlattenList( |
| 2917 RESOLVED_UNIT6.of(new LibrarySpecificUnit(library, unit))), | 2911 (Source library, Source unit) => RESOLVED_UNIT_NO_CONSTANTS |
| 2912 .of(new LibrarySpecificUnit(library, unit))), |
| 2918 }; | 2913 }; |
| 2919 } | 2914 } |
| 2920 | 2915 |
| 2921 /** | 2916 /** |
| 2922 * Create a [ResolveLibraryReferencesTask] based on the given [target] in | 2917 * Create a [ResolveLibraryReferencesTask] based on the given [target] in |
| 2923 * the given [context]. | 2918 * the given [context]. |
| 2924 */ | 2919 */ |
| 2925 static ResolveLibraryReferencesTask createTask( | 2920 static ResolveLibraryReferencesTask createTask( |
| 2926 AnalysisContext context, AnalysisTarget target) { | 2921 AnalysisContext context, AnalysisTarget target) { |
| 2927 return new ResolveLibraryReferencesTask(context, target); | 2922 return new ResolveLibraryReferencesTask(context, target); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2978 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in | 2973 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in |
| 2979 * the given [context]. | 2974 * the given [context]. |
| 2980 */ | 2975 */ |
| 2981 static ResolveLibraryTypeNamesTask createTask( | 2976 static ResolveLibraryTypeNamesTask createTask( |
| 2982 AnalysisContext context, AnalysisTarget target) { | 2977 AnalysisContext context, AnalysisTarget target) { |
| 2983 return new ResolveLibraryTypeNamesTask(context, target); | 2978 return new ResolveLibraryTypeNamesTask(context, target); |
| 2984 } | 2979 } |
| 2985 } | 2980 } |
| 2986 | 2981 |
| 2987 /** | 2982 /** |
| 2988 * A task that builds [RESOLVED_UNIT6] for a unit. | 2983 * A task that builds [RESOLVED_UNIT_NO_CONSTANTS] for a unit. |
| 2989 */ | 2984 */ |
| 2990 class ResolveUnitReferencesTask extends SourceBasedAnalysisTask { | 2985 class ResolveUnitReferencesTask extends SourceBasedAnalysisTask { |
| 2991 /** | 2986 /** |
| 2992 * The name of the [LIBRARY_ELEMENT6] input. | 2987 * The name of the [LIBRARY_ELEMENT6] input. |
| 2993 */ | 2988 */ |
| 2994 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 2989 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 2995 | 2990 |
| 2996 /** | 2991 /** |
| 2997 * The name of the [RESOLVED_UNIT5] input. | 2992 * The name of the [RESOLVED_UNIT5] input. |
| 2998 */ | 2993 */ |
| 2999 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2994 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 3000 | 2995 |
| 3001 /** | 2996 /** |
| 3002 * The name of the [TYPE_PROVIDER] input. | 2997 * The name of the [TYPE_PROVIDER] input. |
| 3003 */ | 2998 */ |
| 3004 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 2999 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 3005 | 3000 |
| 3006 /** | 3001 /** |
| 3007 * The task descriptor describing this kind of task. | 3002 * The task descriptor describing this kind of task. |
| 3008 */ | 3003 */ |
| 3009 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 3004 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3010 'ResolveUnitReferencesTask', createTask, buildInputs, <ResultDescriptor>[ | 3005 'ResolveUnitReferencesTask', createTask, buildInputs, <ResultDescriptor>[ |
| 3011 RESOLVE_REFERENCES_ERRORS, | 3006 RESOLVE_REFERENCES_ERRORS, |
| 3012 RESOLVED_UNIT6 | 3007 RESOLVED_UNIT_NO_CONSTANTS |
| 3013 ]); | 3008 ]); |
| 3014 | 3009 |
| 3015 ResolveUnitReferencesTask( | 3010 ResolveUnitReferencesTask( |
| 3016 InternalAnalysisContext context, AnalysisTarget target) | 3011 InternalAnalysisContext context, AnalysisTarget target) |
| 3017 : super(context, target); | 3012 : super(context, target); |
| 3018 | 3013 |
| 3019 @override | 3014 @override |
| 3020 TaskDescriptor get descriptor => DESCRIPTOR; | 3015 TaskDescriptor get descriptor => DESCRIPTOR; |
| 3021 | 3016 |
| 3022 @override | 3017 @override |
| (...skipping 12 matching lines...) Expand all Loading... |
| 3035 InheritanceManager inheritanceManager = | 3030 InheritanceManager inheritanceManager = |
| 3036 new InheritanceManager(libraryElement); | 3031 new InheritanceManager(libraryElement); |
| 3037 AstVisitor visitor = new ResolverVisitor.con2(libraryElement, | 3032 AstVisitor visitor = new ResolverVisitor.con2(libraryElement, |
| 3038 unitElement.source, typeProvider, inheritanceManager, errorListener); | 3033 unitElement.source, typeProvider, inheritanceManager, errorListener); |
| 3039 unit.accept(visitor); | 3034 unit.accept(visitor); |
| 3040 // | 3035 // |
| 3041 // Record outputs. | 3036 // Record outputs. |
| 3042 // | 3037 // |
| 3043 outputs[RESOLVE_REFERENCES_ERRORS] = | 3038 outputs[RESOLVE_REFERENCES_ERRORS] = |
| 3044 removeDuplicateErrors(errorListener.errors); | 3039 removeDuplicateErrors(errorListener.errors); |
| 3045 outputs[RESOLVED_UNIT6] = unit; | 3040 outputs[RESOLVED_UNIT_NO_CONSTANTS] = unit; |
| 3046 } | 3041 } |
| 3047 | 3042 |
| 3048 /** | 3043 /** |
| 3049 * Return a map from the names of the inputs of this kind of task to the task | 3044 * Return a map from the names of the inputs of this kind of task to the task |
| 3050 * input descriptors describing those inputs for a task with the | 3045 * input descriptors describing those inputs for a task with the |
| 3051 * given [target]. | 3046 * given [target]. |
| 3052 */ | 3047 */ |
| 3053 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 3048 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 3054 return <String, TaskInput>{ | 3049 return <String, TaskInput>{ |
| 3055 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(target.library), | 3050 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(target.library), |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3519 @override | 3514 @override |
| 3520 bool moveNext() { | 3515 bool moveNext() { |
| 3521 if (_newSources.isEmpty) { | 3516 if (_newSources.isEmpty) { |
| 3522 return false; | 3517 return false; |
| 3523 } | 3518 } |
| 3524 currentTarget = _newSources.first; | 3519 currentTarget = _newSources.first; |
| 3525 _newSources.remove(currentTarget); | 3520 _newSources.remove(currentTarget); |
| 3526 return true; | 3521 return true; |
| 3527 } | 3522 } |
| 3528 } | 3523 } |
| OLD | NEW |