| 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 | 8 |
| 9 import 'package:analyzer/src/context/cache.dart'; | 9 import 'package:analyzer/src/context/cache.dart'; |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 1594 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1605 outputs[CONSTANT_DEPENDENCIES] = dependencies; | 1605 outputs[CONSTANT_DEPENDENCIES] = dependencies; |
| 1606 } | 1606 } |
| 1607 | 1607 |
| 1608 /** | 1608 /** |
| 1609 * Return a map from the names of the inputs of this kind of task to the task | 1609 * Return a map from the names of the inputs of this kind of task to the task |
| 1610 * input descriptors describing those inputs for a task with the | 1610 * input descriptors describing those inputs for a task with the |
| 1611 * given [target]. | 1611 * given [target]. |
| 1612 */ | 1612 */ |
| 1613 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 1613 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 1614 // | 1614 // |
| 1615 // We need to force the computation of the RESOLVED_UNIT9 for each unit | 1615 // TODO(brianwilkerson) I believe that this does not properly guarantee that |
| 1616 // reachable from the target's library so that all of the AST's for the | 1616 // all of the constructor initializers that we might encounter have been |
| 1617 // constructor initializers that we might encounter have been copied into | 1617 // copied into the element model. We tried forcing the computation of the |
| 1618 // the element model. | 1618 // RESOLVED_UNIT9 for each unit reachable from the target's library, but |
| 1619 // | 1619 // that had too big a performance impact. We could potentially mitigate the |
| 1620 // TODO(brianwilkerson) This could be improved by computing a more accurate | 1620 // impact by computing a more accurate list of the sources containing |
| 1621 // list of the sources containing constructors that are actually referenced. | 1621 // constructors that are actually referenced, but other approaches should |
| 1622 // be considered. |
| 1622 // | 1623 // |
| 1623 Source librarySource; | 1624 Source librarySource; |
| 1624 if (target is Element) { | 1625 if (target is Element) { |
| 1625 CompilationUnitElementImpl unit = target | 1626 CompilationUnitElementImpl unit = target |
| 1626 .getAncestor((Element element) => element is CompilationUnitElement); | 1627 .getAncestor((Element element) => element is CompilationUnitElement); |
| 1627 librarySource = unit.librarySource; | 1628 librarySource = unit.librarySource; |
| 1628 } else if (target is ConstantEvaluationTarget_Annotation) { | 1629 } else if (target is ConstantEvaluationTarget_Annotation) { |
| 1629 librarySource = target.librarySource; | 1630 librarySource = target.librarySource; |
| 1630 } else { | 1631 } else { |
| 1631 throw new AnalysisException( | 1632 throw new AnalysisException( |
| 1632 'Cannot build inputs for a ${target.runtimeType}'); | 1633 'Cannot build inputs for a ${target.runtimeType}'); |
| 1633 } | 1634 } |
| 1634 return <String, TaskInput>{ | 1635 return <String, TaskInput>{ |
| 1635 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE | 1636 'resolvedUnit': RESOLVED_UNIT9 |
| 1636 .of(librarySource) | 1637 .of(new LibrarySpecificUnit(librarySource, target.source)), |
| 1637 .toFlattenListOf(LIBRARY_SPECIFIC_UNITS) | |
| 1638 .toListOf(RESOLVED_UNIT9), | |
| 1639 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 1638 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 1640 }; | 1639 }; |
| 1641 } | 1640 } |
| 1642 | 1641 |
| 1643 /** | 1642 /** |
| 1644 * Create a [ComputeConstantDependenciesTask] based on the given [target] in | 1643 * Create a [ComputeConstantDependenciesTask] based on the given [target] in |
| 1645 * the given [context]. | 1644 * the given [context]. |
| 1646 */ | 1645 */ |
| 1647 static ComputeConstantDependenciesTask createTask( | 1646 static ComputeConstantDependenciesTask createTask( |
| 1648 AnalysisContext context, AnalysisTarget target) { | 1647 AnalysisContext context, AnalysisTarget target) { |
| (...skipping 2944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4593 | 4592 |
| 4594 @override | 4593 @override |
| 4595 bool moveNext() { | 4594 bool moveNext() { |
| 4596 if (_newSources.isEmpty) { | 4595 if (_newSources.isEmpty) { |
| 4597 return false; | 4596 return false; |
| 4598 } | 4597 } |
| 4599 currentTarget = _newSources.removeLast(); | 4598 currentTarget = _newSources.removeLast(); |
| 4600 return true; | 4599 return true; |
| 4601 } | 4600 } |
| 4602 } | 4601 } |
| OLD | NEW |