| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 * | 165 * |
| 166 * The list will be empty if there were no errors, but will not be `null`. | 166 * The list will be empty if there were no errors, but will not be `null`. |
| 167 * | 167 * |
| 168 * The result is only available for [LibrarySpecificUnit]s. | 168 * The result is only available for [LibrarySpecificUnit]s. |
| 169 */ | 169 */ |
| 170 final ListResultDescriptor<AnalysisError> HINTS = | 170 final ListResultDescriptor<AnalysisError> HINTS = |
| 171 new ListResultDescriptor<AnalysisError>( | 171 new ListResultDescriptor<AnalysisError>( |
| 172 'HINT_ERRORS', AnalysisError.NO_ERRORS); | 172 'HINT_ERRORS', AnalysisError.NO_ERRORS); |
| 173 | 173 |
| 174 /** | 174 /** |
| 175 * The sources representing the combined import/export closure of a library. |
| 176 * The [Source]s include only library sources, not their units. |
| 177 * |
| 178 * The result is only available for [Source]s representing a library. |
| 179 */ |
| 180 final ListResultDescriptor<Source> IMPORT_EXPORT_SOURCE_CLOSURE = |
| 181 new ListResultDescriptor<Source>('IMPORT_EXPORT_SOURCE_CLOSURE', null); |
| 182 |
| 183 /** |
| 175 * The sources representing the import closure of a library. | 184 * The sources representing the import closure of a library. |
| 176 * The [Source]s include only library sources, not their units. | 185 * The [Source]s include only library sources, not their units. |
| 177 * | 186 * |
| 178 * The result is only available for [Source]s representing a library. | 187 * The result is only available for [Source]s representing a library. |
| 179 */ | 188 */ |
| 180 final ListResultDescriptor<Source> IMPORT_SOURCE_CLOSURE = | 189 final ListResultDescriptor<Source> IMPORT_SOURCE_CLOSURE = |
| 181 new ListResultDescriptor<Source>('IMPORT_SOURCE_CLOSURE', null); | 190 new ListResultDescriptor<Source>('IMPORT_SOURCE_CLOSURE', null); |
| 182 | 191 |
| 183 /** | 192 /** |
| 184 * The partial [LibraryElement] associated with a library. | 193 * The partial [LibraryElement] associated with a library. |
| (...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1569 | 1578 |
| 1570 /** | 1579 /** |
| 1571 * The name of the import/export closure. | 1580 * The name of the import/export closure. |
| 1572 */ | 1581 */ |
| 1573 static const String IMPORT_EXPORT_INPUT = 'IMPORT_EXPORT_INPUT'; | 1582 static const String IMPORT_EXPORT_INPUT = 'IMPORT_EXPORT_INPUT'; |
| 1574 | 1583 |
| 1575 /** | 1584 /** |
| 1576 * The task descriptor describing this kind of task. | 1585 * The task descriptor describing this kind of task. |
| 1577 */ | 1586 */ |
| 1578 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1587 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1579 'BuildExportSourceClosureTask', createTask, buildInputs, | 1588 'BuildSourceClosuresTask', createTask, buildInputs, <ResultDescriptor>[ |
| 1580 <ResultDescriptor>[ | |
| 1581 IMPORT_SOURCE_CLOSURE, | 1589 IMPORT_SOURCE_CLOSURE, |
| 1582 EXPORT_SOURCE_CLOSURE, | 1590 EXPORT_SOURCE_CLOSURE, |
| 1591 IMPORT_EXPORT_SOURCE_CLOSURE, |
| 1583 IS_CLIENT | 1592 IS_CLIENT |
| 1584 ]); | 1593 ]); |
| 1585 | 1594 |
| 1586 BuildSourceClosuresTask( | 1595 BuildSourceClosuresTask( |
| 1587 InternalAnalysisContext context, AnalysisTarget target) | 1596 InternalAnalysisContext context, AnalysisTarget target) |
| 1588 : super(context, target); | 1597 : super(context, target); |
| 1589 | 1598 |
| 1590 @override | 1599 @override |
| 1591 TaskDescriptor get descriptor => DESCRIPTOR; | 1600 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1592 | 1601 |
| 1593 @override | 1602 @override |
| 1594 void internalPerform() { | 1603 void internalPerform() { |
| 1595 List<Source> importClosure = getRequiredInput(IMPORT_INPUT); | 1604 List<Source> importClosure = getRequiredInput(IMPORT_INPUT); |
| 1596 List<Source> exportClosure = getRequiredInput(EXPORT_INPUT); | 1605 List<Source> exportClosure = getRequiredInput(EXPORT_INPUT); |
| 1597 List<Source> importExportClosure = getRequiredInput(IMPORT_EXPORT_INPUT); | 1606 List<Source> importExportClosure = getRequiredInput(IMPORT_EXPORT_INPUT); |
| 1598 Source htmlSource = context.sourceFactory.forUri(DartSdk.DART_HTML); | 1607 Source htmlSource = context.sourceFactory.forUri(DartSdk.DART_HTML); |
| 1599 // | 1608 // |
| 1600 // Record outputs. | 1609 // Record outputs. |
| 1601 // | 1610 // |
| 1602 outputs[IMPORT_SOURCE_CLOSURE] = importClosure; | 1611 outputs[IMPORT_SOURCE_CLOSURE] = importClosure; |
| 1603 outputs[EXPORT_SOURCE_CLOSURE] = exportClosure; | 1612 outputs[EXPORT_SOURCE_CLOSURE] = exportClosure; |
| 1613 outputs[IMPORT_EXPORT_SOURCE_CLOSURE] = importExportClosure; |
| 1604 outputs[IS_CLIENT] = importExportClosure.contains(htmlSource); | 1614 outputs[IS_CLIENT] = importExportClosure.contains(htmlSource); |
| 1605 } | 1615 } |
| 1606 | 1616 |
| 1607 /** | 1617 /** |
| 1608 * Return a map from the names of the inputs of this kind of task to the task | 1618 * Return a map from the names of the inputs of this kind of task to the task |
| 1609 * input descriptors describing those inputs for a task with the | 1619 * input descriptors describing those inputs for a task with the |
| 1610 * given library [libSource]. | 1620 * given library [libSource]. |
| 1611 */ | 1621 */ |
| 1612 static Map<String, TaskInput> buildInputs(Source libSource) { | 1622 static Map<String, TaskInput> buildInputs(Source libSource) { |
| 1613 return <String, TaskInput>{ | 1623 return <String, TaskInput>{ |
| (...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2834 } | 2844 } |
| 2835 | 2845 |
| 2836 /** | 2846 /** |
| 2837 * Return a map from the names of the inputs of this kind of task to the task | 2847 * Return a map from the names of the inputs of this kind of task to the task |
| 2838 * input descriptors describing those inputs for a task with the | 2848 * input descriptors describing those inputs for a task with the |
| 2839 * given [target]. | 2849 * given [target]. |
| 2840 */ | 2850 */ |
| 2841 static Map<String, TaskInput> buildInputs(Source libSource) { | 2851 static Map<String, TaskInput> buildInputs(Source libSource) { |
| 2842 return <String, TaskInput>{ | 2852 return <String, TaskInput>{ |
| 2843 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(libSource), | 2853 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(libSource), |
| 2844 'resolvedUnits': IMPORT_SOURCE_CLOSURE | 2854 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE |
| 2845 .of(libSource) | 2855 .of(libSource) |
| 2846 .toMapOf(UNITS) | 2856 .toMapOf(UNITS) |
| 2847 .toFlattenList((Source library, Source unit) => | 2857 .toFlattenList((Source library, Source unit) => |
| 2848 RESOLVED_UNIT4.of(new LibrarySpecificUnit(library, unit))) | 2858 RESOLVED_UNIT4.of(new LibrarySpecificUnit(library, unit))), |
| 2849 }; | 2859 }; |
| 2850 } | 2860 } |
| 2851 | 2861 |
| 2852 /** | 2862 /** |
| 2853 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in | 2863 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in |
| 2854 * the given [context]. | 2864 * the given [context]. |
| 2855 */ | 2865 */ |
| 2856 static ResolveLibraryTypeNamesTask createTask( | 2866 static ResolveLibraryTypeNamesTask createTask( |
| 2857 AnalysisContext context, AnalysisTarget target) { | 2867 AnalysisContext context, AnalysisTarget target) { |
| 2858 return new ResolveLibraryTypeNamesTask(context, target); | 2868 return new ResolveLibraryTypeNamesTask(context, target); |
| (...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3382 @override | 3392 @override |
| 3383 bool moveNext() { | 3393 bool moveNext() { |
| 3384 if (_newSources.isEmpty) { | 3394 if (_newSources.isEmpty) { |
| 3385 return false; | 3395 return false; |
| 3386 } | 3396 } |
| 3387 currentTarget = _newSources.first; | 3397 currentTarget = _newSources.first; |
| 3388 _newSources.remove(currentTarget); | 3398 _newSources.remove(currentTarget); |
| 3389 return true; | 3399 return true; |
| 3390 } | 3400 } |
| 3391 } | 3401 } |
| OLD | NEW |