Chromium Code Reviews| 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/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 * | 338 * |
| 339 * [RESOLVED_UNIT4] plus resolved local variables and formal parameters. | 339 * [RESOLVED_UNIT4] plus resolved local variables and formal parameters. |
| 340 * | 340 * |
| 341 * The result is only available for [LibrarySpecificUnit]s. | 341 * The result is only available for [LibrarySpecificUnit]s. |
| 342 */ | 342 */ |
| 343 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 = | 343 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 = |
| 344 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, | 344 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, |
| 345 cachingPolicy: AST_CACHING_POLICY); | 345 cachingPolicy: AST_CACHING_POLICY); |
| 346 | 346 |
| 347 /** | 347 /** |
| 348 * The resolved [CompilationUnit] associated with a compilation unit, with | |
| 349 * constants not yet resolved. | |
| 350 * | |
| 351 * The result is only available for [LibrarySpecificUnit]s. | |
| 352 */ | |
| 353 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT6 = | |
| 354 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT6', null, | |
| 355 cachingPolicy: AST_CACHING_POLICY); | |
| 356 | |
| 357 /** | |
| 348 * The errors produced while scanning a compilation unit. | 358 * The errors produced while scanning a compilation unit. |
| 349 * | 359 * |
| 350 * The list will be empty if there were no errors, but will not be `null`. | 360 * The list will be empty if there were no errors, but will not be `null`. |
| 351 * | 361 * |
| 352 * The result is only available for [Source]s representing a compilation unit. | 362 * The result is only available for [Source]s representing a compilation unit. |
| 353 */ | 363 */ |
| 354 final ListResultDescriptor<AnalysisError> SCAN_ERRORS = | 364 final ListResultDescriptor<AnalysisError> SCAN_ERRORS = |
| 355 new ListResultDescriptor<AnalysisError>( | 365 new ListResultDescriptor<AnalysisError>( |
| 356 'SCAN_ERRORS', AnalysisError.NO_ERRORS); | 366 'SCAN_ERRORS', AnalysisError.NO_ERRORS); |
| 357 | 367 |
| (...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1659 AnalysisContext context, AnalysisContextTarget target) { | 1669 AnalysisContext context, AnalysisContextTarget target) { |
| 1660 return new BuildTypeProviderTask(context, target); | 1670 return new BuildTypeProviderTask(context, target); |
| 1661 } | 1671 } |
| 1662 } | 1672 } |
| 1663 | 1673 |
| 1664 /** | 1674 /** |
| 1665 * A task that computes [CONSTANT_DEPENDENCIES] for a constant. | 1675 * A task that computes [CONSTANT_DEPENDENCIES] for a constant. |
| 1666 */ | 1676 */ |
| 1667 class ComputeConstantDependenciesTask extends ConstantEvaluationAnalysisTask { | 1677 class ComputeConstantDependenciesTask extends ConstantEvaluationAnalysisTask { |
| 1668 /** | 1678 /** |
| 1669 * The name of the [RESOLVED_UNIT] input. | 1679 * The name of the [RESOLVED_UNIT6] input. |
| 1670 */ | 1680 */ |
| 1671 static const String UNIT_INPUT = 'UNIT_INPUT'; | 1681 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 1672 | 1682 |
| 1673 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1683 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1674 'ComputeConstantDependenciesTask', createTask, buildInputs, | 1684 'ComputeConstantDependenciesTask', createTask, buildInputs, |
| 1675 <ResultDescriptor>[CONSTANT_DEPENDENCIES]); | 1685 <ResultDescriptor>[CONSTANT_DEPENDENCIES]); |
| 1676 | 1686 |
| 1677 ComputeConstantDependenciesTask( | 1687 ComputeConstantDependenciesTask( |
| 1678 InternalAnalysisContext context, ConstantEvaluationTarget constant) | 1688 InternalAnalysisContext context, ConstantEvaluationTarget constant) |
| 1679 : super(context, constant); | 1689 : super(context, constant); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 1708 /** | 1718 /** |
| 1709 * Return a map from the names of the inputs of this kind of task to the task | 1719 * Return a map from the names of the inputs of this kind of task to the task |
| 1710 * input descriptors describing those inputs for a task with the | 1720 * input descriptors describing those inputs for a task with the |
| 1711 * given [target]. | 1721 * given [target]. |
| 1712 */ | 1722 */ |
| 1713 static Map<String, TaskInput> buildInputs(ConstantEvaluationTarget target) { | 1723 static Map<String, TaskInput> buildInputs(ConstantEvaluationTarget target) { |
| 1714 if (target is Element) { | 1724 if (target is Element) { |
| 1715 CompilationUnitElementImpl unit = (target as Element) | 1725 CompilationUnitElementImpl unit = (target as Element) |
| 1716 .getAncestor((Element element) => element is CompilationUnitElement); | 1726 .getAncestor((Element element) => element is CompilationUnitElement); |
| 1717 return <String, TaskInput>{ | 1727 return <String, TaskInput>{ |
| 1718 UNIT_INPUT: RESOLVED_UNIT | 1728 UNIT_INPUT: RESOLVED_UNIT6 |
| 1719 .of(new LibrarySpecificUnit(unit.librarySource, target.source)) | 1729 .of(new LibrarySpecificUnit(unit.librarySource, target.source)) |
| 1720 }; | 1730 }; |
| 1721 } else if (target is ConstantEvaluationTarget_Annotation) { | 1731 } else if (target is ConstantEvaluationTarget_Annotation) { |
| 1722 return <String, TaskInput>{ | 1732 return <String, TaskInput>{ |
| 1723 UNIT_INPUT: RESOLVED_UNIT | 1733 UNIT_INPUT: RESOLVED_UNIT6 |
| 1724 .of(new LibrarySpecificUnit(target.librarySource, target.source)) | 1734 .of(new LibrarySpecificUnit(target.librarySource, target.source)) |
| 1725 }; | 1735 }; |
| 1726 } else { | 1736 } else { |
| 1727 // Should never happen. | 1737 // Should never happen. |
| 1728 assert(false); | 1738 assert(false); |
| 1729 return <String, TaskInput>{}; | 1739 return <String, TaskInput>{}; |
| 1730 } | 1740 } |
| 1731 } | 1741 } |
| 1732 | 1742 |
| 1733 /** | 1743 /** |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1972 * Create a [DartErrorsTask] based on the given [target] in the given | 1982 * Create a [DartErrorsTask] based on the given [target] in the given |
| 1973 * [context]. | 1983 * [context]. |
| 1974 */ | 1984 */ |
| 1975 static DartErrorsTask createTask( | 1985 static DartErrorsTask createTask( |
| 1976 AnalysisContext context, AnalysisTarget target) { | 1986 AnalysisContext context, AnalysisTarget target) { |
| 1977 return new DartErrorsTask(context, target); | 1987 return new DartErrorsTask(context, target); |
| 1978 } | 1988 } |
| 1979 } | 1989 } |
| 1980 | 1990 |
| 1981 /** | 1991 /** |
| 1982 * A task that builds [CONSTANT_RESOLVED_UNIT] for a unit. | 1992 * A task that builds [RESOLVED_UNIT] for a unit. |
| 1983 */ | 1993 */ |
| 1984 class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { | 1994 class EvaluateUnitConstantsTask extends SourceBasedAnalysisTask { |
| 1985 /** | 1995 /** |
| 1986 * The name of the [RESOLVED_UNIT] input. | 1996 * The name of the [RESOLVED_UNIT6] input. |
| 1987 */ | 1997 */ |
| 1988 static const String UNIT_INPUT = 'UNIT_INPUT'; | 1998 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 1989 | 1999 |
| 1990 /** | 2000 /** |
| 1991 * The name of the [CONSTANT_VALUE] input. | 2001 * The name of the [CONSTANT_VALUE] input. |
| 1992 */ | 2002 */ |
| 1993 static const String CONSTANT_VALUES = 'CONSTANT_VALUES'; | 2003 static const String CONSTANT_VALUES = 'CONSTANT_VALUES'; |
| 1994 | 2004 |
| 1995 /** | 2005 /** |
| 1996 * The task descriptor describing this kind of task. | 2006 * The task descriptor describing this kind of task. |
| 1997 */ | 2007 */ |
| 1998 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2008 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1999 'EvaluateUnitConstantsTask', createTask, buildInputs, | 2009 'EvaluateUnitConstantsTask', createTask, buildInputs, |
| 2000 <ResultDescriptor>[CONSTANT_RESOLVED_UNIT]); | 2010 <ResultDescriptor>[RESOLVED_UNIT]); |
| 2001 | 2011 |
| 2002 EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target) | 2012 EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target) |
| 2003 : super(context, target); | 2013 : super(context, target); |
| 2004 | 2014 |
| 2005 @override | 2015 @override |
| 2006 TaskDescriptor get descriptor => DESCRIPTOR; | 2016 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2007 | 2017 |
| 2008 @override | 2018 @override |
| 2009 void internalPerform() { | 2019 void internalPerform() { |
| 2010 // No actual work needs to be performed; the task manager will ensure that | 2020 // No actual work needs to be performed; the task manager will ensure that |
| 2011 // all constants are evaluated before this method is called. | 2021 // all constants are evaluated before this method is called. |
| 2012 CompilationUnit unit = getRequiredInput(UNIT_INPUT); | 2022 CompilationUnit unit = getRequiredInput(UNIT_INPUT); |
| 2013 outputs[CONSTANT_RESOLVED_UNIT] = unit; | 2023 outputs[RESOLVED_UNIT] = unit; |
| 2014 } | 2024 } |
| 2015 | 2025 |
| 2016 /** | 2026 /** |
| 2017 * Return a map from the names of the inputs of this kind of task to the task | 2027 * Return a map from the names of the inputs of this kind of task to the task |
| 2018 * input descriptors describing those inputs for a task with the | 2028 * input descriptors describing those inputs for a task with the |
| 2019 * given [target]. | 2029 * given [target]. |
| 2020 */ | 2030 */ |
| 2021 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 2031 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 2022 return <String, TaskInput>{ | 2032 return <String, TaskInput>{ |
| 2023 UNIT_INPUT: RESOLVED_UNIT.of(target), | 2033 UNIT_INPUT: RESOLVED_UNIT6.of(target), |
| 2024 CONSTANT_VALUES: | 2034 CONSTANT_VALUES: |
| 2025 COMPILATION_UNIT_CONSTANTS.of(target).toListOf(CONSTANT_VALUE) | 2035 COMPILATION_UNIT_CONSTANTS.of(target).toListOf(CONSTANT_VALUE) |
| 2026 }; | 2036 }; |
| 2027 } | 2037 } |
| 2028 | 2038 |
| 2029 /** | 2039 /** |
| 2030 * Create an [EvaluateUnitConstantsTask] based on the given [target] in | 2040 * Create an [EvaluateUnitConstantsTask] based on the given [target] in |
| 2031 * the given [context]. | 2041 * the given [context]. |
| 2032 */ | 2042 */ |
| 2033 static EvaluateUnitConstantsTask createTask( | 2043 static EvaluateUnitConstantsTask createTask( |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2137 } | 2147 } |
| 2138 return newNames; | 2148 return newNames; |
| 2139 } | 2149 } |
| 2140 } | 2150 } |
| 2141 | 2151 |
| 2142 /** | 2152 /** |
| 2143 * A task that builds [USED_IMPORTED_ELEMENTS] for a unit. | 2153 * A task that builds [USED_IMPORTED_ELEMENTS] for a unit. |
| 2144 */ | 2154 */ |
| 2145 class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { | 2155 class GatherUsedImportedElementsTask extends SourceBasedAnalysisTask { |
| 2146 /** | 2156 /** |
| 2147 * The name of the [RESOLVED_UNIT] input. | 2157 * The name of the [RESOLVED_UNIT6] input. |
| 2148 */ | 2158 */ |
| 2149 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2159 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2150 | 2160 |
| 2151 /** | 2161 /** |
| 2152 * The task descriptor describing this kind of task. | 2162 * The task descriptor describing this kind of task. |
| 2153 */ | 2163 */ |
| 2154 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2164 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2155 'GatherUsedImportedElementsTask', createTask, buildInputs, | 2165 'GatherUsedImportedElementsTask', createTask, buildInputs, |
| 2156 <ResultDescriptor>[USED_IMPORTED_ELEMENTS]); | 2166 <ResultDescriptor>[USED_IMPORTED_ELEMENTS]); |
| 2157 | 2167 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 2178 // | 2188 // |
| 2179 outputs[USED_IMPORTED_ELEMENTS] = visitor.usedElements; | 2189 outputs[USED_IMPORTED_ELEMENTS] = visitor.usedElements; |
| 2180 } | 2190 } |
| 2181 | 2191 |
| 2182 /** | 2192 /** |
| 2183 * Return a map from the names of the inputs of this kind of task to the task | 2193 * Return a map from the names of the inputs of this kind of task to the task |
| 2184 * input descriptors describing those inputs for a task with the | 2194 * input descriptors describing those inputs for a task with the |
| 2185 * given [target]. | 2195 * given [target]. |
| 2186 */ | 2196 */ |
| 2187 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 2197 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 2188 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT.of(target)}; | 2198 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT6.of(target)}; |
| 2189 } | 2199 } |
| 2190 | 2200 |
| 2191 /** | 2201 /** |
| 2192 * Create a [GatherUsedImportedElementsTask] based on the given [target] in | 2202 * Create a [GatherUsedImportedElementsTask] based on the given [target] in |
| 2193 * the given [context]. | 2203 * the given [context]. |
| 2194 */ | 2204 */ |
| 2195 static GatherUsedImportedElementsTask createTask( | 2205 static GatherUsedImportedElementsTask createTask( |
| 2196 AnalysisContext context, LibrarySpecificUnit target) { | 2206 AnalysisContext context, LibrarySpecificUnit target) { |
| 2197 return new GatherUsedImportedElementsTask(context, target); | 2207 return new GatherUsedImportedElementsTask(context, target); |
| 2198 } | 2208 } |
| 2199 } | 2209 } |
| 2200 | 2210 |
| 2201 /** | 2211 /** |
| 2202 * A task that builds [USED_LOCAL_ELEMENTS] for a unit. | 2212 * A task that builds [USED_LOCAL_ELEMENTS] for a unit. |
| 2203 */ | 2213 */ |
| 2204 class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { | 2214 class GatherUsedLocalElementsTask extends SourceBasedAnalysisTask { |
| 2205 /** | 2215 /** |
| 2206 * The name of the [RESOLVED_UNIT] input. | 2216 * The name of the [RESOLVED_UNIT6] input. |
| 2207 */ | 2217 */ |
| 2208 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2218 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2209 | 2219 |
| 2210 /** | 2220 /** |
| 2211 * The task descriptor describing this kind of task. | 2221 * The task descriptor describing this kind of task. |
| 2212 */ | 2222 */ |
| 2213 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2223 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2214 'GatherUsedLocalElementsTask', createTask, buildInputs, | 2224 'GatherUsedLocalElementsTask', createTask, buildInputs, |
| 2215 <ResultDescriptor>[USED_LOCAL_ELEMENTS]); | 2225 <ResultDescriptor>[USED_LOCAL_ELEMENTS]); |
| 2216 | 2226 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 2237 // | 2247 // |
| 2238 outputs[USED_LOCAL_ELEMENTS] = visitor.usedElements; | 2248 outputs[USED_LOCAL_ELEMENTS] = visitor.usedElements; |
| 2239 } | 2249 } |
| 2240 | 2250 |
| 2241 /** | 2251 /** |
| 2242 * Return a map from the names of the inputs of this kind of task to the task | 2252 * Return a map from the names of the inputs of this kind of task to the task |
| 2243 * input descriptors describing those inputs for a task with the | 2253 * input descriptors describing those inputs for a task with the |
| 2244 * given [target]. | 2254 * given [target]. |
| 2245 */ | 2255 */ |
| 2246 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 2256 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 2247 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT.of(target)}; | 2257 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT6.of(target)}; |
| 2248 } | 2258 } |
| 2249 | 2259 |
| 2250 /** | 2260 /** |
| 2251 * Create a [GatherUsedLocalElementsTask] based on the given [target] in | 2261 * Create a [GatherUsedLocalElementsTask] based on the given [target] in |
| 2252 * the given [context]. | 2262 * the given [context]. |
| 2253 */ | 2263 */ |
| 2254 static GatherUsedLocalElementsTask createTask( | 2264 static GatherUsedLocalElementsTask createTask( |
| 2255 AnalysisContext context, LibrarySpecificUnit target) { | 2265 AnalysisContext context, LibrarySpecificUnit target) { |
| 2256 return new GatherUsedLocalElementsTask(context, target); | 2266 return new GatherUsedLocalElementsTask(context, target); |
| 2257 } | 2267 } |
| 2258 } | 2268 } |
| 2259 | 2269 |
| 2260 /** | 2270 /** |
| 2261 * A task that generates [HINTS] for a unit. | 2271 * A task that generates [HINTS] for a unit. |
| 2262 */ | 2272 */ |
| 2263 class GenerateHintsTask extends SourceBasedAnalysisTask { | 2273 class GenerateHintsTask extends SourceBasedAnalysisTask { |
| 2264 /** | 2274 /** |
| 2265 * The name of the [RESOLVED_UNIT] input. | 2275 * The name of the [RESOLVED_UNIT6] input. |
| 2266 */ | 2276 */ |
| 2267 static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT'; | 2277 static const String RESOLVED_UNIT_INPUT = 'RESOLVED_UNIT'; |
| 2268 | 2278 |
| 2269 /** | 2279 /** |
| 2270 * The name of a list of [USED_LOCAL_ELEMENTS] for each library unit input. | 2280 * The name of a list of [USED_LOCAL_ELEMENTS] for each library unit input. |
| 2271 */ | 2281 */ |
| 2272 static const String USED_LOCAL_ELEMENTS_INPUT = 'USED_LOCAL_ELEMENTS'; | 2282 static const String USED_LOCAL_ELEMENTS_INPUT = 'USED_LOCAL_ELEMENTS'; |
| 2273 | 2283 |
| 2274 /** | 2284 /** |
| 2275 * The name of a list of [USED_IMPORTED_ELEMENTS] for each library unit input. | 2285 * The name of a list of [USED_IMPORTED_ELEMENTS] for each library unit input. |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2342 } | 2352 } |
| 2343 | 2353 |
| 2344 /** | 2354 /** |
| 2345 * Return a map from the names of the inputs of this kind of task to the task | 2355 * Return a map from the names of the inputs of this kind of task to the task |
| 2346 * input descriptors describing those inputs for a task with the | 2356 * input descriptors describing those inputs for a task with the |
| 2347 * given [target]. | 2357 * given [target]. |
| 2348 */ | 2358 */ |
| 2349 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 2359 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 2350 Source libSource = target.library; | 2360 Source libSource = target.library; |
| 2351 return <String, TaskInput>{ | 2361 return <String, TaskInput>{ |
| 2352 RESOLVED_UNIT_INPUT: RESOLVED_UNIT.of(target), | 2362 RESOLVED_UNIT_INPUT: RESOLVED_UNIT6.of(target), |
|
Brian Wilkerson
2015/05/12 00:43:23
I'm fairly sure that this needs to remain RESOLVED
| |
| 2353 USED_LOCAL_ELEMENTS_INPUT: UNITS.of(libSource).toList((unit) { | 2363 USED_LOCAL_ELEMENTS_INPUT: UNITS.of(libSource).toList((unit) { |
| 2354 LibrarySpecificUnit target = new LibrarySpecificUnit(libSource, unit); | 2364 LibrarySpecificUnit target = new LibrarySpecificUnit(libSource, unit); |
| 2355 return USED_LOCAL_ELEMENTS.of(target); | 2365 return USED_LOCAL_ELEMENTS.of(target); |
| 2356 }), | 2366 }), |
| 2357 USED_IMPORTED_ELEMENTS_INPUT: UNITS.of(libSource).toList((unit) { | 2367 USED_IMPORTED_ELEMENTS_INPUT: UNITS.of(libSource).toList((unit) { |
| 2358 LibrarySpecificUnit target = new LibrarySpecificUnit(libSource, unit); | 2368 LibrarySpecificUnit target = new LibrarySpecificUnit(libSource, unit); |
| 2359 return USED_IMPORTED_ELEMENTS.of(target); | 2369 return USED_IMPORTED_ELEMENTS.of(target); |
| 2360 }) | 2370 }) |
| 2361 }; | 2371 }; |
| 2362 } | 2372 } |
| (...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2771 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in | 2781 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in |
| 2772 * the given [context]. | 2782 * the given [context]. |
| 2773 */ | 2783 */ |
| 2774 static ResolveLibraryTypeNamesTask createTask( | 2784 static ResolveLibraryTypeNamesTask createTask( |
| 2775 AnalysisContext context, AnalysisTarget target) { | 2785 AnalysisContext context, AnalysisTarget target) { |
| 2776 return new ResolveLibraryTypeNamesTask(context, target); | 2786 return new ResolveLibraryTypeNamesTask(context, target); |
| 2777 } | 2787 } |
| 2778 } | 2788 } |
| 2779 | 2789 |
| 2780 /** | 2790 /** |
| 2781 * A task that builds [RESOLVED_UNIT] for a unit. | 2791 * A task that builds [RESOLVED_UNIT6] for a unit. |
| 2782 */ | 2792 */ |
| 2783 class ResolveReferencesTask extends SourceBasedAnalysisTask { | 2793 class ResolveReferencesTask extends SourceBasedAnalysisTask { |
| 2784 /** | 2794 /** |
| 2785 * The name of the [LIBRARY_ELEMENT] input. | 2795 * The name of the [LIBRARY_ELEMENT] input. |
| 2786 */ | 2796 */ |
| 2787 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 2797 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 2788 | 2798 |
| 2789 /** | 2799 /** |
| 2790 * The name of the [RESOLVED_UNIT5] input. | 2800 * The name of the [RESOLVED_UNIT5] input. |
| 2791 */ | 2801 */ |
| 2792 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2802 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2793 | 2803 |
| 2794 /** | 2804 /** |
| 2795 * The task descriptor describing this kind of task. | 2805 * The task descriptor describing this kind of task. |
| 2796 */ | 2806 */ |
| 2797 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 2807 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2798 'ResolveReferencesTask', createTask, buildInputs, <ResultDescriptor>[ | 2808 'ResolveReferencesTask', createTask, buildInputs, <ResultDescriptor>[ |
| 2799 RESOLVE_REFERENCES_ERRORS, | 2809 RESOLVE_REFERENCES_ERRORS, |
| 2800 RESOLVED_UNIT | 2810 RESOLVED_UNIT6 |
| 2801 ]); | 2811 ]); |
| 2802 | 2812 |
| 2803 ResolveReferencesTask(InternalAnalysisContext context, AnalysisTarget target) | 2813 ResolveReferencesTask(InternalAnalysisContext context, AnalysisTarget target) |
| 2804 : super(context, target); | 2814 : super(context, target); |
| 2805 | 2815 |
| 2806 @override | 2816 @override |
| 2807 TaskDescriptor get descriptor => DESCRIPTOR; | 2817 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2808 | 2818 |
| 2809 @override | 2819 @override |
| 2810 void internalPerform() { | 2820 void internalPerform() { |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 2821 // | 2831 // |
| 2822 InheritanceManager inheritanceManager = | 2832 InheritanceManager inheritanceManager = |
| 2823 new InheritanceManager(libraryElement); | 2833 new InheritanceManager(libraryElement); |
| 2824 AstVisitor visitor = new ResolverVisitor.con2(libraryElement, | 2834 AstVisitor visitor = new ResolverVisitor.con2(libraryElement, |
| 2825 unitElement.source, typeProvider, inheritanceManager, errorListener); | 2835 unitElement.source, typeProvider, inheritanceManager, errorListener); |
| 2826 unit.accept(visitor); | 2836 unit.accept(visitor); |
| 2827 // | 2837 // |
| 2828 // Record outputs. | 2838 // Record outputs. |
| 2829 // | 2839 // |
| 2830 outputs[RESOLVE_REFERENCES_ERRORS] = errorListener.errors; | 2840 outputs[RESOLVE_REFERENCES_ERRORS] = errorListener.errors; |
| 2831 outputs[RESOLVED_UNIT] = unit; | 2841 outputs[RESOLVED_UNIT6] = unit; |
| 2832 } | 2842 } |
| 2833 | 2843 |
| 2834 /** | 2844 /** |
| 2835 * Return a map from the names of the inputs of this kind of task to the task | 2845 * Return a map from the names of the inputs of this kind of task to the task |
| 2836 * input descriptors describing those inputs for a task with the | 2846 * input descriptors describing those inputs for a task with the |
| 2837 * given [target]. | 2847 * given [target]. |
| 2838 */ | 2848 */ |
| 2839 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 2849 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 2840 return <String, TaskInput>{ | 2850 return <String, TaskInput>{ |
| 2841 LIBRARY_INPUT: LIBRARY_ELEMENT.of(target.library), | 2851 LIBRARY_INPUT: LIBRARY_ELEMENT.of(target.library), |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3057 AnalysisContext context, AnalysisTarget target) { | 3067 AnalysisContext context, AnalysisTarget target) { |
| 3058 return new ScanDartTask(context, target); | 3068 return new ScanDartTask(context, target); |
| 3059 } | 3069 } |
| 3060 } | 3070 } |
| 3061 | 3071 |
| 3062 /** | 3072 /** |
| 3063 * A task that builds [VERIFY_ERRORS] for a unit. | 3073 * A task that builds [VERIFY_ERRORS] for a unit. |
| 3064 */ | 3074 */ |
| 3065 class VerifyUnitTask extends SourceBasedAnalysisTask { | 3075 class VerifyUnitTask extends SourceBasedAnalysisTask { |
| 3066 /** | 3076 /** |
| 3067 * The name of the [RESOLVED_UNIT] input. | 3077 * The name of the [RESOLVED_UNIT6] input. |
| 3068 */ | 3078 */ |
| 3069 static const String UNIT_INPUT = 'UNIT_INPUT'; | 3079 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 3070 | 3080 |
| 3071 /** | 3081 /** |
| 3072 * The task descriptor describing this kind of task. | 3082 * The task descriptor describing this kind of task. |
| 3073 */ | 3083 */ |
| 3074 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor('VerifyUnitTask', | 3084 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor('VerifyUnitTask', |
| 3075 createTask, buildInputs, <ResultDescriptor>[VERIFY_ERRORS]); | 3085 createTask, buildInputs, <ResultDescriptor>[VERIFY_ERRORS]); |
| 3076 | 3086 |
| 3077 /** | 3087 /** |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 3108 // | 3118 // |
| 3109 outputs[VERIFY_ERRORS] = errorListener.errors; | 3119 outputs[VERIFY_ERRORS] = errorListener.errors; |
| 3110 } | 3120 } |
| 3111 | 3121 |
| 3112 /** | 3122 /** |
| 3113 * Return a map from the names of the inputs of this kind of task to the task | 3123 * Return a map from the names of the inputs of this kind of task to the task |
| 3114 * input descriptors describing those inputs for a task with the | 3124 * input descriptors describing those inputs for a task with the |
| 3115 * given [target]. | 3125 * given [target]. |
| 3116 */ | 3126 */ |
| 3117 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 3127 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 3118 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT.of(target)}; | 3128 return <String, TaskInput>{UNIT_INPUT: RESOLVED_UNIT6.of(target)}; |
|
Brian Wilkerson
2015/05/12 00:43:23
I'm fairly sure that this needs to remain RESOLVED
| |
| 3119 } | 3129 } |
| 3120 | 3130 |
| 3121 /** | 3131 /** |
| 3122 * Create a [VerifyUnitTask] based on the given [target] in | 3132 * Create a [VerifyUnitTask] based on the given [target] in |
| 3123 * the given [context]. | 3133 * the given [context]. |
| 3124 */ | 3134 */ |
| 3125 static VerifyUnitTask createTask( | 3135 static VerifyUnitTask createTask( |
| 3126 AnalysisContext context, AnalysisTarget target) { | 3136 AnalysisContext context, AnalysisTarget target) { |
| 3127 return new VerifyUnitTask(context, target); | 3137 return new VerifyUnitTask(context, target); |
| 3128 } | 3138 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3221 @override | 3231 @override |
| 3222 bool moveNext() { | 3232 bool moveNext() { |
| 3223 if (_newSources.isEmpty) { | 3233 if (_newSources.isEmpty) { |
| 3224 return false; | 3234 return false; |
| 3225 } | 3235 } |
| 3226 currentTarget = _newSources.first; | 3236 currentTarget = _newSources.first; |
| 3227 _newSources.remove(currentTarget); | 3237 _newSources.remove(currentTarget); |
| 3228 return true; | 3238 return true; |
| 3229 } | 3239 } |
| 3230 } | 3240 } |
| OLD | NEW |