Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(291)

Side by Side Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 1206183002: Clean up and rename RESOLVED_UNIT* vars. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 * 321 *
322 * The result is only available for [LibrarySpecificUnit]s. 322 * The result is only available for [LibrarySpecificUnit]s.
323 */ 323 */
324 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT2 = 324 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT2 =
325 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT2', null, 325 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT2', null,
326 cachingPolicy: AST_CACHING_POLICY); 326 cachingPolicy: AST_CACHING_POLICY);
327 327
328 /** 328 /**
329 * The partially resolved [CompilationUnit] associated with a unit. 329 * The partially resolved [CompilationUnit] associated with a unit.
330 * 330 *
331 * All the function type aliases are resolved. 331 * [RESOLVED_UNIT2] with resolved type names.
332 * 332 *
333 * The result is only available for [LibrarySpecificUnit]s. 333 * The result is only available for [LibrarySpecificUnit]s.
334 *
335 * TODO(paulberry): this is no longer used and should be deleted. However, it
336 * can't be safely deleted yet because the analysis server is referring to it.
337 */ 334 */
338 @deprecated
339 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT3 = 335 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT3 =
340 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT3', null, 336 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT3', null,
341 cachingPolicy: AST_CACHING_POLICY); 337 cachingPolicy: AST_CACHING_POLICY);
342 338
343 /** 339 /**
344 * The partially resolved [CompilationUnit] associated with a unit. 340 * The partially resolved [CompilationUnit] associated with a unit.
345 * 341 *
346 * [RESOLVED_UNIT2] with resolved type names. 342 * [RESOLVED_UNIT3] plus resolved local variables and formal parameters.
347 * 343 *
348 * The result is only available for [LibrarySpecificUnit]s. 344 * The result is only available for [LibrarySpecificUnit]s.
349 */ 345 */
350 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT4 = 346 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT4 =
351 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT4', null, 347 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT4', null,
352 cachingPolicy: AST_CACHING_POLICY); 348 cachingPolicy: AST_CACHING_POLICY);
353 349
354 /** 350 /**
355 * The partially resolved [CompilationUnit] associated with a unit. 351 * The resolved [CompilationUnit] associated with a compilation unit, with
356 * 352 * constants not yet resolved.
357 * [RESOLVED_UNIT4] plus resolved local variables and formal parameters.
358 * 353 *
359 * The result is only available for [LibrarySpecificUnit]s. 354 * The result is only available for [LibrarySpecificUnit]s.
360 */ 355 */
361 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 = 356 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 =
362 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, 357 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null,
363 cachingPolicy: AST_CACHING_POLICY); 358 cachingPolicy: AST_CACHING_POLICY);
364 359
365 /** 360 /**
366 * The resolved [CompilationUnit] associated with a compilation unit, with
367 * constants not yet resolved.
368 *
369 * The result is only available for [LibrarySpecificUnit]s.
370 */
371 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT6 =
372 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT6', null,
373 cachingPolicy: AST_CACHING_POLICY);
374
375 /**
376 * The errors produced while scanning a compilation unit. 361 * The errors produced while scanning a compilation unit.
377 * 362 *
378 * The list will be empty if there were no errors, but will not be `null`. 363 * The list will be empty if there were no errors, but will not be `null`.
379 * 364 *
380 * The result is only available for [Source]s representing a compilation unit. 365 * The result is only available for [Source]s representing a compilation unit.
381 */ 366 */
382 final ListResultDescriptor<AnalysisError> SCAN_ERRORS = 367 final ListResultDescriptor<AnalysisError> SCAN_ERRORS =
383 new ListResultDescriptor<AnalysisError>( 368 new ListResultDescriptor<AnalysisError>(
384 'SCAN_ERRORS', AnalysisError.NO_ERRORS); 369 'SCAN_ERRORS', AnalysisError.NO_ERRORS);
385 370
(...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1659 AnalysisContext context, AnalysisTarget target) { 1644 AnalysisContext context, AnalysisTarget target) {
1660 return new BuildTypeProviderTask(context, target); 1645 return new BuildTypeProviderTask(context, target);
1661 } 1646 }
1662 } 1647 }
1663 1648
1664 /** 1649 /**
1665 * A task that computes [CONSTANT_DEPENDENCIES] for a constant. 1650 * A task that computes [CONSTANT_DEPENDENCIES] for a constant.
1666 */ 1651 */
1667 class ComputeConstantDependenciesTask extends ConstantEvaluationAnalysisTask { 1652 class ComputeConstantDependenciesTask extends ConstantEvaluationAnalysisTask {
1668 /** 1653 /**
1669 * The name of the [RESOLVED_UNIT6] input. 1654 * The name of the [RESOLVED_UNIT5] input.
1670 */ 1655 */
1671 static const String UNIT_INPUT = 'UNIT_INPUT'; 1656 static const String UNIT_INPUT = 'UNIT_INPUT';
1672 1657
1673 /** 1658 /**
1674 * The name of the [TYPE_PROVIDER] input. 1659 * The name of the [TYPE_PROVIDER] input.
1675 */ 1660 */
1676 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; 1661 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
1677 1662
1678 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 1663 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
1679 'ComputeConstantDependenciesTask', createTask, buildInputs, 1664 'ComputeConstantDependenciesTask', createTask, buildInputs,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 /** 1698 /**
1714 * Return a map from the names of the inputs of this kind of task to the task 1699 * Return a map from the names of the inputs of this kind of task to the task
1715 * input descriptors describing those inputs for a task with the 1700 * input descriptors describing those inputs for a task with the
1716 * given [target]. 1701 * given [target].
1717 */ 1702 */
1718 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 1703 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
1719 if (target is Element) { 1704 if (target is Element) {
1720 CompilationUnitElementImpl unit = target 1705 CompilationUnitElementImpl unit = target
1721 .getAncestor((Element element) => element is CompilationUnitElement); 1706 .getAncestor((Element element) => element is CompilationUnitElement);
1722 return <String, TaskInput>{ 1707 return <String, TaskInput>{
1723 UNIT_INPUT: RESOLVED_UNIT6 1708 UNIT_INPUT: RESOLVED_UNIT5
1724 .of(new LibrarySpecificUnit(unit.librarySource, target.source)), 1709 .of(new LibrarySpecificUnit(unit.librarySource, target.source)),
1725 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) 1710 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
1726 }; 1711 };
1727 } else if (target is ConstantEvaluationTarget_Annotation) { 1712 } else if (target is ConstantEvaluationTarget_Annotation) {
1728 return <String, TaskInput>{ 1713 return <String, TaskInput>{
1729 UNIT_INPUT: RESOLVED_UNIT6 1714 UNIT_INPUT: RESOLVED_UNIT5
1730 .of(new LibrarySpecificUnit(target.librarySource, target.source)), 1715 .of(new LibrarySpecificUnit(target.librarySource, target.source)),
1731 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) 1716 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
1732 }; 1717 };
1733 } 1718 }
1734 throw new AnalysisException( 1719 throw new AnalysisException(
1735 'Cannot build inputs for a ${target.runtimeType}'); 1720 'Cannot build inputs for a ${target.runtimeType}');
1736 } 1721 }
1737 1722
1738 /** 1723 /**
1739 * Create a [ResolveUnitReferencesTask] based on the given [target] in 1724 * Create a [ResolveUnitReferencesTask] based on the given [target] in
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 AnalysisContext context, AnalysisTarget target) { 1991 AnalysisContext context, AnalysisTarget target) {
2007 return new DartErrorsTask(context, target); 1992 return new DartErrorsTask(context, target);
2008 } 1993 }
2009 } 1994 }
2010 1995
2011 /** 1996 /**
2012 * A task that builds [RESOLVED_UNIT] for a unit. 1997 * A task that builds [RESOLVED_UNIT] for a unit.
2013 */ 1998 */
2014 class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { 1999 class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask {
2015 /** 2000 /**
2016 * The name of the [RESOLVED_UNIT6] input. 2001 * The name of the [RESOLVED_UNIT5] input.
2017 */ 2002 */
2018 static const String UNIT_INPUT = 'UNIT_INPUT'; 2003 static const String UNIT_INPUT = 'UNIT_INPUT';
2019 2004
2020 /** 2005 /**
2021 * The name of the [CONSTANT_VALUE] input. 2006 * The name of the [CONSTANT_VALUE] input.
2022 */ 2007 */
2023 static const String CONSTANT_VALUES = 'CONSTANT_VALUES'; 2008 static const String CONSTANT_VALUES = 'CONSTANT_VALUES';
2024 2009
2025 /** 2010 /**
2026 * The task descriptor describing this kind of task. 2011 * The task descriptor describing this kind of task.
(...skipping 18 matching lines...) Expand all
2045 2030
2046 /** 2031 /**
2047 * Return a map from the names of the inputs of this kind of task to the task 2032 * Return a map from the names of the inputs of this kind of task to the task
2048 * input descriptors describing those inputs for a task with the 2033 * input descriptors describing those inputs for a task with the
2049 * given [target]. 2034 * given [target].
2050 */ 2035 */
2051 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 2036 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
2052 LibrarySpecificUnit unit = target; 2037 LibrarySpecificUnit unit = target;
2053 return <String, TaskInput>{ 2038 return <String, TaskInput>{
2054 'libraryElement': LIBRARY_ELEMENT.of(unit.library), 2039 'libraryElement': LIBRARY_ELEMENT.of(unit.library),
2055 UNIT_INPUT: RESOLVED_UNIT6.of(unit), 2040 UNIT_INPUT: RESOLVED_UNIT5.of(unit),
2056 CONSTANT_VALUES: 2041 CONSTANT_VALUES:
2057 COMPILATION_UNIT_CONSTANTS.of(unit).toListOf(CONSTANT_VALUE) 2042 COMPILATION_UNIT_CONSTANTS.of(unit).toListOf(CONSTANT_VALUE)
2058 }; 2043 };
2059 } 2044 }
2060 2045
2061 /** 2046 /**
2062 * Create an [EvaluateUnitConstantsTask] based on the given [target] in 2047 * Create an [EvaluateUnitConstantsTask] based on the given [target] in
2063 * the given [context]. 2048 * the given [context].
2064 */ 2049 */
2065 static EvaluateUnitConstantsTask createTask( 2050 static EvaluateUnitConstantsTask createTask(
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
2169 } 2154 }
2170 return newNames; 2155 return newNames;
2171 } 2156 }
2172 } 2157 }
2173 2158
2174 /** 2159 /**
2175 * A task that builds [USED_IMPORTED_ELEMENTS] for a unit. 2160 * A task that builds [USED_IMPORTED_ELEMENTS] for a unit.
2176 */ 2161 */
2177 class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { 2162 class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask {
2178 /** 2163 /**
2179 * The name of the [RESOLVED_UNIT6] input. 2164 * The name of the [RESOLVED_UNIT5] input.
2180 */ 2165 */
2181 static const String UNIT_INPUT = 'UNIT_INPUT'; 2166 static const String UNIT_INPUT = 'UNIT_INPUT';
2182 2167
2183 /** 2168 /**
2184 * The task descriptor describing this kind of task. 2169 * The task descriptor describing this kind of task.
2185 */ 2170 */
2186 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 2171 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
2187 'GatherUsedImportedElementsTask', createTask, buildInputs, 2172 'GatherUsedImportedElementsTask', createTask, buildInputs,
2188 <ResultDescriptor>[USED_IMPORTED_ELEMENTS]); 2173 <ResultDescriptor>[USED_IMPORTED_ELEMENTS]);
2189 2174
(...skipping 21 matching lines...) Expand all
2211 outputs[USED_IMPORTED_ELEMENTS] = visitor.usedElements; 2196 outputs[USED_IMPORTED_ELEMENTS] = visitor.usedElements;
2212 } 2197 }
2213 2198
2214 /** 2199 /**
2215 * Return a map from the names of the inputs of this kind of task to the task 2200 * Return a map from the names of the inputs of this kind of task to the task
2216 * input descriptors describing those inputs for a task with the 2201 * input descriptors describing those inputs for a task with the
2217 * given [target]. 2202 * given [target].
2218 */ 2203 */
2219 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 2204 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
2220 LibrarySpecificUnit unit = target; 2205 LibrarySpecificUnit unit = target;
2221 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT6.of(unit)}; 2206 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT5.of(unit)};
2222 } 2207 }
2223 2208
2224 /** 2209 /**
2225 * Create a [GatherUsedImportedElementsTask] based on the given [target] in 2210 * Create a [GatherUsedImportedElementsTask] based on the given [target] in
2226 * the given [context]. 2211 * the given [context].
2227 */ 2212 */
2228 static GatherUsedImportedElementsTask createTask( 2213 static GatherUsedImportedElementsTask createTask(
2229 AnalysisContext context, AnalysisTarget target) { 2214 AnalysisContext context, AnalysisTarget target) {
2230 return new GatherUsedImportedElementsTask(context, target); 2215 return new GatherUsedImportedElementsTask(context, target);
2231 } 2216 }
2232 } 2217 }
2233 2218
2234 /** 2219 /**
2235 * A task that builds [USED_LOCAL_ELEMENTS] for a unit. 2220 * A task that builds [USED_LOCAL_ELEMENTS] for a unit.
2236 */ 2221 */
2237 class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { 2222 class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask {
2238 /** 2223 /**
2239 * The name of the [RESOLVED_UNIT6] input. 2224 * The name of the [RESOLVED_UNIT5] input.
2240 */ 2225 */
2241 static const String UNIT_INPUT = 'UNIT_INPUT'; 2226 static const String UNIT_INPUT = 'UNIT_INPUT';
2242 2227
2243 /** 2228 /**
2244 * The task descriptor describing this kind of task. 2229 * The task descriptor describing this kind of task.
2245 */ 2230 */
2246 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 2231 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
2247 'GatherUsedLocalElementsTask', createTask, buildInputs, 2232 'GatherUsedLocalElementsTask', createTask, buildInputs,
2248 <ResultDescriptor>[USED_LOCAL_ELEMENTS]); 2233 <ResultDescriptor>[USED_LOCAL_ELEMENTS]);
2249 2234
(...skipping 21 matching lines...) Expand all
2271 outputs[USED_LOCAL_ELEMENTS] = visitor.usedElements; 2256 outputs[USED_LOCAL_ELEMENTS] = visitor.usedElements;
2272 } 2257 }
2273 2258
2274 /** 2259 /**
2275 * Return a map from the names of the inputs of this kind of task to the task 2260 * Return a map from the names of the inputs of this kind of task to the task
2276 * input descriptors describing those inputs for a task with the 2261 * input descriptors describing those inputs for a task with the
2277 * given [target]. 2262 * given [target].
2278 */ 2263 */
2279 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 2264 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
2280 LibrarySpecificUnit unit = target; 2265 LibrarySpecificUnit unit = target;
2281 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT6.of(unit)}; 2266 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT5.of(unit)};
2282 } 2267 }
2283 2268
2284 /** 2269 /**
2285 * Create a [GatherUsedLocalElementsTask] based on the given [target] in 2270 * Create a [GatherUsedLocalElementsTask] based on the given [target] in
2286 * the given [context]. 2271 * the given [context].
2287 */ 2272 */
2288 static GatherUsedLocalElementsTask createTask( 2273 static GatherUsedLocalElementsTask createTask(
2289 AnalysisContext context, AnalysisTarget target) { 2274 AnalysisContext context, AnalysisTarget target) {
2290 return new GatherUsedLocalElementsTask(context, target); 2275 return new GatherUsedLocalElementsTask(context, target);
2291 } 2276 }
2292 } 2277 }
2293 2278
2294 /** 2279 /**
2295 * A task that generates [HINTS] for a unit. 2280 * A task that generates [HINTS] for a unit.
2296 */ 2281 */
2297 class GenerateHintsTask extends SourceBasedAnalysisTask { 2282 class GenerateHintsTask extends SourceBasedAnalysisTask {
2298 /** 2283 /**
2299 * The name of the [RESOLVED_UNIT6] input. 2284 * The name of the [RESOLVED_UNIT5] input.
2300 */ 2285 */
2301 static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT'; 2286 static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT';
2302 2287
2303 /** 2288 /**
2304 * The name of a list of [USED_LOCAL_ELEMENTS] for each library unit input. 2289 * The name of a list of [USED_LOCAL_ELEMENTS] for each library unit input.
2305 */ 2290 */
2306 static const String USED_LOCAL_ELEMENTS_INPUT = 'USED_LOCAL_ELEMENTS'; 2291 static const String USED_LOCAL_ELEMENTS_INPUT = 'USED_LOCAL_ELEMENTS';
2307 2292
2308 /** 2293 /**
2309 * The name of a list of [USED_IMPORTED_ELEMENTS] for each library unit input. 2294 * The name of a list of [USED_IMPORTED_ELEMENTS] for each library unit input.
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
2826 * given [target]. 2811 * given [target].
2827 */ 2812 */
2828 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 2813 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
2829 Source source = target; 2814 Source source = target;
2830 return <String, TaskInput>{ 2815 return <String, TaskInput>{
2831 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(source), 2816 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(source),
2832 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE 2817 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE
2833 .of(source) 2818 .of(source)
2834 .toMapOf(UNITS) 2819 .toMapOf(UNITS)
2835 .toFlattenList((Source library, Source unit) => 2820 .toFlattenList((Source library, Source unit) =>
2836 RESOLVED_UNIT6.of(new LibrarySpecificUnit(library, unit))), 2821 RESOLVED_UNIT5.of(new LibrarySpecificUnit(library, unit))),
2837 }; 2822 };
2838 } 2823 }
2839 2824
2840 /** 2825 /**
2841 * Create a [ResolveLibraryReferencesTask] based on the given [target] in 2826 * Create a [ResolveLibraryReferencesTask] based on the given [target] in
2842 * the given [context]. 2827 * the given [context].
2843 */ 2828 */
2844 static ResolveLibraryReferencesTask createTask( 2829 static ResolveLibraryReferencesTask createTask(
2845 AnalysisContext context, AnalysisTarget target) { 2830 AnalysisContext context, AnalysisTarget target) {
2846 return new ResolveLibraryReferencesTask(context, target); 2831 return new ResolveLibraryReferencesTask(context, target);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2883 * given [target]. 2868 * given [target].
2884 */ 2869 */
2885 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 2870 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
2886 Source source = target; 2871 Source source = target;
2887 return <String, TaskInput>{ 2872 return <String, TaskInput>{
2888 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(source), 2873 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(source),
2889 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE 2874 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE
2890 .of(source) 2875 .of(source)
2891 .toMapOf(UNITS) 2876 .toMapOf(UNITS)
2892 .toFlattenList((Source library, Source unit) => 2877 .toFlattenList((Source library, Source unit) =>
2893 RESOLVED_UNIT4.of(new LibrarySpecificUnit(library, unit))), 2878 RESOLVED_UNIT3.of(new LibrarySpecificUnit(library, unit))),
2894 }; 2879 };
2895 } 2880 }
2896 2881
2897 /** 2882 /**
2898 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in 2883 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in
2899 * the given [context]. 2884 * the given [context].
2900 */ 2885 */
2901 static ResolveLibraryTypeNamesTask createTask( 2886 static ResolveLibraryTypeNamesTask createTask(
2902 AnalysisContext context, AnalysisTarget target) { 2887 AnalysisContext context, AnalysisTarget target) {
2903 return new ResolveLibraryTypeNamesTask(context, target); 2888 return new ResolveLibraryTypeNamesTask(context, target);
2904 } 2889 }
2905 } 2890 }
2906 2891
2907 /** 2892 /**
2908 * A task that builds [RESOLVED_UNIT6] for a unit. 2893 * A task that builds [RESOLVED_UNIT5] for a unit.
2909 */ 2894 */
2910 class ResolveUnitReferencesTask extends SourceBasedAnalysisTask { 2895 class ResolveUnitReferencesTask extends SourceBasedAnalysisTask {
2911 /** 2896 /**
2912 * The name of the [LIBRARY_ELEMENT6] input. 2897 * The name of the [LIBRARY_ELEMENT6] input.
2913 */ 2898 */
2914 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; 2899 static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
2915 2900
2916 /** 2901 /**
2917 * The name of the [RESOLVED_UNIT5] input. 2902 * The name of the [RESOLVED_UNIT4] input.
2918 */ 2903 */
2919 static const String UNIT_INPUT = 'UNIT_INPUT'; 2904 static const String UNIT_INPUT = 'UNIT_INPUT';
2920 2905
2921 /** 2906 /**
2922 * The name of the [TYPE_PROVIDER] input. 2907 * The name of the [TYPE_PROVIDER] input.
2923 */ 2908 */
2924 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; 2909 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
2925 2910
2926 /** 2911 /**
2927 * The task descriptor describing this kind of task. 2912 * The task descriptor describing this kind of task.
2928 */ 2913 */
2929 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 2914 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
2930 'ResolveUnitReferencesTask', createTask, buildInputs, <ResultDescriptor>[ 2915 'ResolveUnitReferencesTask', createTask, buildInputs, <ResultDescriptor>[
2931 RESOLVE_REFERENCES_ERRORS, 2916 RESOLVE_REFERENCES_ERRORS,
2932 RESOLVED_UNIT6 2917 RESOLVED_UNIT5
2933 ]); 2918 ]);
2934 2919
2935 ResolveUnitReferencesTask( 2920 ResolveUnitReferencesTask(
2936 InternalAnalysisContext context, AnalysisTarget target) 2921 InternalAnalysisContext context, AnalysisTarget target)
2937 : super(context, target); 2922 : super(context, target);
2938 2923
2939 @override 2924 @override
2940 TaskDescriptor get descriptor => DESCRIPTOR; 2925 TaskDescriptor get descriptor => DESCRIPTOR;
2941 2926
2942 @override 2927 @override
(...skipping 12 matching lines...) Expand all
2955 InheritanceManager inheritanceManager = 2940 InheritanceManager inheritanceManager =
2956 new InheritanceManager(libraryElement); 2941 new InheritanceManager(libraryElement);
2957 AstVisitor visitor = new ResolverVisitor.con2(libraryElement, 2942 AstVisitor visitor = new ResolverVisitor.con2(libraryElement,
2958 unitElement.source, typeProvider, inheritanceManager, errorListener); 2943 unitElement.source, typeProvider, inheritanceManager, errorListener);
2959 unit.accept(visitor); 2944 unit.accept(visitor);
2960 // 2945 //
2961 // Record outputs. 2946 // Record outputs.
2962 // 2947 //
2963 outputs[RESOLVE_REFERENCES_ERRORS] = 2948 outputs[RESOLVE_REFERENCES_ERRORS] =
2964 removeDuplicateErrors(errorListener.errors); 2949 removeDuplicateErrors(errorListener.errors);
2965 outputs[RESOLVED_UNIT6] = unit; 2950 outputs[RESOLVED_UNIT5] = unit;
2966 } 2951 }
2967 2952
2968 /** 2953 /**
2969 * Return a map from the names of the inputs of this kind of task to the task 2954 * Return a map from the names of the inputs of this kind of task to the task
2970 * input descriptors describing those inputs for a task with the 2955 * input descriptors describing those inputs for a task with the
2971 * given [target]. 2956 * given [target].
2972 */ 2957 */
2973 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 2958 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
2974 LibrarySpecificUnit unit = target; 2959 LibrarySpecificUnit unit = target;
2975 return <String, TaskInput>{ 2960 return <String, TaskInput>{
2976 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(unit.library), 2961 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(unit.library),
2977 UNIT_INPUT: RESOLVED_UNIT5.of(unit), 2962 UNIT_INPUT: RESOLVED_UNIT4.of(unit),
2978 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) 2963 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
2979 }; 2964 };
2980 } 2965 }
2981 2966
2982 /** 2967 /**
2983 * Create a [ResolveUnitReferencesTask] based on the given [target] in 2968 * Create a [ResolveUnitReferencesTask] based on the given [target] in
2984 * the given [context]. 2969 * the given [context].
2985 */ 2970 */
2986 static ResolveUnitReferencesTask createTask( 2971 static ResolveUnitReferencesTask createTask(
2987 AnalysisContext context, AnalysisTarget target) { 2972 AnalysisContext context, AnalysisTarget target) {
2988 return new ResolveUnitReferencesTask(context, target); 2973 return new ResolveUnitReferencesTask(context, target);
2989 } 2974 }
2990 } 2975 }
2991 2976
2992 /** 2977 /**
2993 * A task that builds [RESOLVED_UNIT4] for a unit. 2978 * A task that builds [RESOLVED_UNIT3] for a unit.
2994 */ 2979 */
2995 class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask { 2980 class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask {
2996 /** 2981 /**
2997 * The name of the input whose value is the defining [LIBRARY_ELEMENT4]. 2982 * The name of the input whose value is the defining [LIBRARY_ELEMENT4].
2998 */ 2983 */
2999 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; 2984 static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
3000 2985
3001 /** 2986 /**
3002 * The name of the [RESOLVED_UNIT3] input. 2987 * The name of the [RESOLVED_UNIT2] input.
3003 */ 2988 */
3004 static const String UNIT_INPUT = 'UNIT_INPUT'; 2989 static const String UNIT_INPUT = 'UNIT_INPUT';
3005 2990
3006 /** 2991 /**
3007 * The name of the [TYPE_PROVIDER] input. 2992 * The name of the [TYPE_PROVIDER] input.
3008 */ 2993 */
3009 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; 2994 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
3010 2995
3011 /** 2996 /**
3012 * The task descriptor describing this kind of task. 2997 * The task descriptor describing this kind of task.
3013 */ 2998 */
3014 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 2999 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
3015 'ResolveUnitTypeNamesTask', createTask, buildInputs, <ResultDescriptor>[ 3000 'ResolveUnitTypeNamesTask', createTask, buildInputs, <ResultDescriptor>[
3016 RESOLVE_TYPE_NAMES_ERRORS, 3001 RESOLVE_TYPE_NAMES_ERRORS,
3017 RESOLVED_UNIT4 3002 RESOLVED_UNIT3
3018 ]); 3003 ]);
3019 3004
3020 ResolveUnitTypeNamesTask( 3005 ResolveUnitTypeNamesTask(
3021 InternalAnalysisContext context, AnalysisTarget target) 3006 InternalAnalysisContext context, AnalysisTarget target)
3022 : super(context, target); 3007 : super(context, target);
3023 3008
3024 @override 3009 @override
3025 TaskDescriptor get descriptor => DESCRIPTOR; 3010 TaskDescriptor get descriptor => DESCRIPTOR;
3026 3011
3027 @override 3012 @override
(...skipping 10 matching lines...) Expand all
3038 // Resolve TypeName nodes. 3023 // Resolve TypeName nodes.
3039 // 3024 //
3040 TypeResolverVisitor visitor = new TypeResolverVisitor.con2( 3025 TypeResolverVisitor visitor = new TypeResolverVisitor.con2(
3041 library, unitElement.source, typeProvider, errorListener); 3026 library, unitElement.source, typeProvider, errorListener);
3042 unit.accept(visitor); 3027 unit.accept(visitor);
3043 // 3028 //
3044 // Record outputs. 3029 // Record outputs.
3045 // 3030 //
3046 outputs[RESOLVE_TYPE_NAMES_ERRORS] = 3031 outputs[RESOLVE_TYPE_NAMES_ERRORS] =
3047 removeDuplicateErrors(errorListener.errors); 3032 removeDuplicateErrors(errorListener.errors);
3048 outputs[RESOLVED_UNIT4] = unit; 3033 outputs[RESOLVED_UNIT3] = unit;
3049 } 3034 }
3050 3035
3051 /** 3036 /**
3052 * Return a map from the names of the inputs of this kind of task to the task 3037 * Return a map from the names of the inputs of this kind of task to the task
3053 * input descriptors describing those inputs for a task with the 3038 * input descriptors describing those inputs for a task with the
3054 * given [target]. 3039 * given [target].
3055 */ 3040 */
3056 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 3041 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
3057 LibrarySpecificUnit unit = target; 3042 LibrarySpecificUnit unit = target;
3058 return <String, TaskInput>{ 3043 return <String, TaskInput>{
3059 'importsExportNamespace': 3044 'importsExportNamespace':
3060 IMPORTED_LIBRARIES.of(unit.library).toMapOf(LIBRARY_ELEMENT4), 3045 IMPORTED_LIBRARIES.of(unit.library).toMapOf(LIBRARY_ELEMENT4),
3061 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(unit.library), 3046 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(unit.library),
3062 UNIT_INPUT: RESOLVED_UNIT2.of(unit), 3047 UNIT_INPUT: RESOLVED_UNIT2.of(unit),
3063 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) 3048 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
3064 }; 3049 };
3065 } 3050 }
3066 3051
3067 /** 3052 /**
3068 * Create a [ResolveUnitTypeNamesTask] based on the given [target] in 3053 * Create a [ResolveUnitTypeNamesTask] based on the given [target] in
3069 * the given [context]. 3054 * the given [context].
3070 */ 3055 */
3071 static ResolveUnitTypeNamesTask createTask( 3056 static ResolveUnitTypeNamesTask createTask(
3072 AnalysisContext context, AnalysisTarget target) { 3057 AnalysisContext context, AnalysisTarget target) {
3073 return new ResolveUnitTypeNamesTask(context, target); 3058 return new ResolveUnitTypeNamesTask(context, target);
3074 } 3059 }
3075 } 3060 }
3076 3061
3077 /** 3062 /**
3078 * A task that builds [RESOLVED_UNIT5] for a unit. 3063 * A task that builds [RESOLVED_UNIT4] for a unit.
3079 */ 3064 */
3080 class ResolveVariableReferencesTask extends SourceBasedAnalysisTask { 3065 class ResolveVariableReferencesTask extends SourceBasedAnalysisTask {
3081 /** 3066 /**
3082 * The name of the [LIBRARY_ELEMENT6] input. 3067 * The name of the [LIBRARY_ELEMENT6] input.
3083 */ 3068 */
3084 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; 3069 static const String LIBRARY_INPUT = 'LIBRARY_INPUT';
3085 3070
3086 /** 3071 /**
3087 * The name of the [RESOLVED_UNIT4] input. 3072 * The name of the [RESOLVED_UNIT3] input.
3088 */ 3073 */
3089 static const String UNIT_INPUT = 'UNIT_INPUT'; 3074 static const String UNIT_INPUT = 'UNIT_INPUT';
3090 3075
3091 /** 3076 /**
3092 * The name of the [TYPE_PROVIDER] input. 3077 * The name of the [TYPE_PROVIDER] input.
3093 */ 3078 */
3094 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; 3079 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
3095 3080
3096 /** 3081 /**
3097 * The task descriptor describing this kind of task. 3082 * The task descriptor describing this kind of task.
3098 */ 3083 */
3099 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 3084 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
3100 'ResolveVariableReferencesTask', createTask, buildInputs, 3085 'ResolveVariableReferencesTask', createTask, buildInputs,
3101 <ResultDescriptor>[RESOLVED_UNIT5, VARIABLE_REFERENCE_ERRORS]); 3086 <ResultDescriptor>[RESOLVED_UNIT4, VARIABLE_REFERENCE_ERRORS]);
3102 3087
3103 ResolveVariableReferencesTask( 3088 ResolveVariableReferencesTask(
3104 InternalAnalysisContext context, AnalysisTarget target) 3089 InternalAnalysisContext context, AnalysisTarget target)
3105 : super(context, target); 3090 : super(context, target);
3106 3091
3107 @override 3092 @override
3108 TaskDescriptor get descriptor => DESCRIPTOR; 3093 TaskDescriptor get descriptor => DESCRIPTOR;
3109 3094
3110 @override 3095 @override
3111 void internalPerform() { 3096 void internalPerform() {
3112 RecordingErrorListener errorListener = new RecordingErrorListener(); 3097 RecordingErrorListener errorListener = new RecordingErrorListener();
3113 // 3098 //
3114 // Prepare inputs. 3099 // Prepare inputs.
3115 // 3100 //
3116 LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT); 3101 LibraryElement libraryElement = getRequiredInput(LIBRARY_INPUT);
3117 CompilationUnit unit = getRequiredInput(UNIT_INPUT); 3102 CompilationUnit unit = getRequiredInput(UNIT_INPUT);
3118 CompilationUnitElement unitElement = unit.element; 3103 CompilationUnitElement unitElement = unit.element;
3119 // 3104 //
3120 // Resolve local variables. 3105 // Resolve local variables.
3121 // 3106 //
3122 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); 3107 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
3123 Scope nameScope = new LibraryScope(libraryElement, errorListener); 3108 Scope nameScope = new LibraryScope(libraryElement, errorListener);
3124 AstVisitor visitor = new VariableResolverVisitor.con2(libraryElement, 3109 AstVisitor visitor = new VariableResolverVisitor.con2(libraryElement,
3125 unitElement.source, typeProvider, nameScope, errorListener); 3110 unitElement.source, typeProvider, nameScope, errorListener);
3126 unit.accept(visitor); 3111 unit.accept(visitor);
3127 // 3112 //
3128 // Record outputs. 3113 // Record outputs.
3129 // 3114 //
3130 outputs[RESOLVED_UNIT5] = unit; 3115 outputs[RESOLVED_UNIT4] = unit;
3131 outputs[VARIABLE_REFERENCE_ERRORS] = 3116 outputs[VARIABLE_REFERENCE_ERRORS] =
3132 removeDuplicateErrors(errorListener.errors); 3117 removeDuplicateErrors(errorListener.errors);
3133 } 3118 }
3134 3119
3135 /** 3120 /**
3136 * Return a map from the names of the inputs of this kind of task to the task 3121 * Return a map from the names of the inputs of this kind of task to the task
3137 * input descriptors describing those inputs for a task with the 3122 * input descriptors describing those inputs for a task with the
3138 * given [target]. 3123 * given [target].
3139 */ 3124 */
3140 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 3125 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
3141 LibrarySpecificUnit unit = target; 3126 LibrarySpecificUnit unit = target;
3142 return <String, TaskInput>{ 3127 return <String, TaskInput>{
3143 'fullyBuiltLibraryElements': IMPORT_EXPORT_SOURCE_CLOSURE 3128 'fullyBuiltLibraryElements': IMPORT_EXPORT_SOURCE_CLOSURE
3144 .of(unit.library) 3129 .of(unit.library)
3145 .toListOf(LIBRARY_ELEMENT6), 3130 .toListOf(LIBRARY_ELEMENT6),
3146 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(unit.library), 3131 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(unit.library),
3147 UNIT_INPUT: RESOLVED_UNIT4.of(unit), 3132 UNIT_INPUT: RESOLVED_UNIT3.of(unit),
3148 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) 3133 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request)
3149 }; 3134 };
3150 } 3135 }
3151 3136
3152 /** 3137 /**
3153 * Create a [ResolveVariableReferencesTask] based on the given [target] in 3138 * Create a [ResolveVariableReferencesTask] based on the given [target] in
3154 * the given [context]. 3139 * the given [context].
3155 */ 3140 */
3156 static ResolveVariableReferencesTask createTask( 3141 static ResolveVariableReferencesTask createTask(
3157 AnalysisContext context, AnalysisTarget target) { 3142 AnalysisContext context, AnalysisTarget target) {
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
3485 3470
3486 @override 3471 @override
3487 bool moveNext() { 3472 bool moveNext() {
3488 if (_newSources.isEmpty) { 3473 if (_newSources.isEmpty) {
3489 return false; 3474 return false;
3490 } 3475 }
3491 currentTarget = _newSources.removeLast(); 3476 currentTarget = _newSources.removeLast();
3492 return true; 3477 return true;
3493 } 3478 }
3494 } 3479 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698