| 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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 : super(context, target); | 621 : super(context, target); |
| 622 | 622 |
| 623 @override | 623 @override |
| 624 TaskDescriptor get descriptor => DESCRIPTOR; | 624 TaskDescriptor get descriptor => DESCRIPTOR; |
| 625 | 625 |
| 626 @override | 626 @override |
| 627 void internalPerform() { | 627 void internalPerform() { |
| 628 // | 628 // |
| 629 // Prepare inputs. | 629 // Prepare inputs. |
| 630 // | 630 // |
| 631 LibrarySpecificUnit librarySpecificUnit = target; |
| 631 Source source = getRequiredSource(); | 632 Source source = getRequiredSource(); |
| 632 CompilationUnit unit = getRequiredInput(PARSED_UNIT_INPUT_NAME); | 633 CompilationUnit unit = getRequiredInput(PARSED_UNIT_INPUT_NAME); |
| 633 // | 634 // |
| 634 // Process inputs. | 635 // Process inputs. |
| 635 // | 636 // |
| 636 unit = AstCloner.clone(unit); | 637 unit = AstCloner.clone(unit); |
| 637 CompilationUnitBuilder builder = new CompilationUnitBuilder(); | 638 CompilationUnitBuilder builder = new CompilationUnitBuilder(); |
| 638 CompilationUnitElement element = builder.buildCompilationUnit(source, unit); | 639 CompilationUnitElement element = |
| 640 builder.buildCompilationUnit(source, unit, librarySpecificUnit.library); |
| 639 // | 641 // |
| 640 // Record outputs. | 642 // Record outputs. |
| 641 // | 643 // |
| 642 outputs[CLASS_ELEMENTS] = element.types; | 644 outputs[CLASS_ELEMENTS] = element.types; |
| 643 outputs[COMPILATION_UNIT_ELEMENT] = element; | 645 outputs[COMPILATION_UNIT_ELEMENT] = element; |
| 644 outputs[RESOLVED_UNIT1] = unit; | 646 outputs[RESOLVED_UNIT1] = unit; |
| 645 } | 647 } |
| 646 | 648 |
| 647 /** | 649 /** |
| 648 * Return a map from the names of the inputs of this kind of task to the task | 650 * Return a map from the names of the inputs of this kind of task to the task |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 // | 1675 // |
| 1674 outputs[CONSTANT_DEPENDENCIES] = dependencies; | 1676 outputs[CONSTANT_DEPENDENCIES] = dependencies; |
| 1675 } | 1677 } |
| 1676 | 1678 |
| 1677 /** | 1679 /** |
| 1678 * Return a map from the names of the inputs of this kind of task to the task | 1680 * Return a map from the names of the inputs of this kind of task to the task |
| 1679 * input descriptors describing those inputs for a task with the | 1681 * input descriptors describing those inputs for a task with the |
| 1680 * given [target]. | 1682 * given [target]. |
| 1681 */ | 1683 */ |
| 1682 static Map<String, TaskInput> buildInputs(Element target) { | 1684 static Map<String, TaskInput> buildInputs(Element target) { |
| 1685 CompilationUnitElementImpl unit = target |
| 1686 .getAncestor((Element element) => element is CompilationUnitElement); |
| 1683 return <String, TaskInput>{ | 1687 return <String, TaskInput>{ |
| 1684 UNIT_INPUT: RESOLVED_UNIT | 1688 UNIT_INPUT: RESOLVED_UNIT |
| 1685 .of(new LibrarySpecificUnit(target.library.source, target.source)) | 1689 .of(new LibrarySpecificUnit(unit.librarySource, target.source)) |
| 1686 }; | 1690 }; |
| 1687 } | 1691 } |
| 1688 | 1692 |
| 1689 /** | 1693 /** |
| 1690 * Create a [ResolveReferencesTask] based on the given [target] in | 1694 * Create a [ResolveReferencesTask] based on the given [target] in |
| 1691 * the given [context]. | 1695 * the given [context]. |
| 1692 */ | 1696 */ |
| 1693 static ComputeConstantDependenciesTask createTask( | 1697 static ComputeConstantDependenciesTask createTask( |
| 1694 AnalysisContext context, AnalysisTarget target) { | 1698 AnalysisContext context, AnalysisTarget target) { |
| 1695 return new ComputeConstantDependenciesTask(context, target); | 1699 return new ComputeConstantDependenciesTask(context, target); |
| (...skipping 1366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3062 @override | 3066 @override |
| 3063 bool moveNext() { | 3067 bool moveNext() { |
| 3064 if (_newSources.isEmpty) { | 3068 if (_newSources.isEmpty) { |
| 3065 return false; | 3069 return false; |
| 3066 } | 3070 } |
| 3067 currentTarget = _newSources.first; | 3071 currentTarget = _newSources.first; |
| 3068 _newSources.remove(currentTarget); | 3072 _newSources.remove(currentTarget); |
| 3069 return true; | 3073 return true; |
| 3070 } | 3074 } |
| 3071 } | 3075 } |
| OLD | NEW |