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

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

Issue 1216523003: Make BuildSourceClosuresTask explicitly dependent on LIBRARY_ELEMENT2. (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 | « no previous file | no next file » | 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 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1568 } 1568 }
1569 1569
1570 /** 1570 /**
1571 * Return a map from the names of the inputs of this kind of task to the task 1571 * Return a map from the names of the inputs of this kind of task to the task
1572 * input descriptors describing those inputs for a task with the 1572 * input descriptors describing those inputs for a task with the
1573 * given library [libSource]. 1573 * given library [libSource].
1574 */ 1574 */
1575 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 1575 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
1576 Source source = target; 1576 Source source = target;
1577 return <String, TaskInput>{ 1577 return <String, TaskInput>{
1578 IMPORT_INPUT: new _ImportSourceClosureTaskInput(source), 1578 IMPORT_INPUT: new _ImportSourceClosureTaskInput(source, LIBRARY_ELEMENT2),
1579 EXPORT_INPUT: new _ExportSourceClosureTaskInput(source), 1579 EXPORT_INPUT: new _ExportSourceClosureTaskInput(source, LIBRARY_ELEMENT2),
1580 IMPORT_EXPORT_INPUT: new _ImportExportSourceClosureTaskInput(source) 1580 IMPORT_EXPORT_INPUT:
1581 new _ImportExportSourceClosureTaskInput(source, LIBRARY_ELEMENT2)
1581 }; 1582 };
1582 } 1583 }
1583 1584
1584 /** 1585 /**
1585 * Create a [BuildSourceClosuresTask] based on the given [target] in 1586 * Create a [BuildSourceClosuresTask] based on the given [target] in
1586 * the given [context]. 1587 * the given [context].
1587 */ 1588 */
1588 static BuildSourceClosuresTask createTask( 1589 static BuildSourceClosuresTask createTask(
1589 AnalysisContext context, AnalysisTarget target) { 1590 AnalysisContext context, AnalysisTarget target) {
1590 return new BuildSourceClosuresTask(context, target); 1591 return new BuildSourceClosuresTask(context, target);
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
3600 */ 3601 */
3601 static VerifyUnitTask createTask( 3602 static VerifyUnitTask createTask(
3602 AnalysisContext context, AnalysisTarget target) { 3603 AnalysisContext context, AnalysisTarget target) {
3603 return new VerifyUnitTask(context, target); 3604 return new VerifyUnitTask(context, target);
3604 } 3605 }
3605 } 3606 }
3606 3607
3607 /** 3608 /**
3608 * A [TaskInput] whose value is a list of library sources exported directly 3609 * A [TaskInput] whose value is a list of library sources exported directly
3609 * or indirectly by the target [Source]. 3610 * or indirectly by the target [Source].
3611 *
3612 * [resultDescriptor] is the type of result which should be produced for each
3613 * target [Source].
3610 */ 3614 */
3611 class _ExportSourceClosureTaskInput extends TaskInputImpl<List<Source>> { 3615 class _ExportSourceClosureTaskInput extends TaskInputImpl<List<Source>> {
3612 final Source target; 3616 final Source target;
3617 final ResultDescriptor resultDescriptor;
3613 3618
3614 _ExportSourceClosureTaskInput(this.target); 3619 _ExportSourceClosureTaskInput(this.target, this.resultDescriptor);
3615 3620
3616 @override 3621 @override
3617 TaskInputBuilder<List<Source>> createBuilder() => 3622 TaskInputBuilder<List<Source>> createBuilder() =>
3618 new _SourceClosureTaskInputBuilder(target, _SourceClosureKind.EXPORT); 3623 new _SourceClosureTaskInputBuilder(
3624 target, _SourceClosureKind.EXPORT, resultDescriptor);
3619 } 3625 }
3620 3626
3621 /** 3627 /**
3622 * A [TaskInput] whose value is a list of library sources imported or exported, 3628 * A [TaskInput] whose value is a list of library sources imported or exported,
3623 * directly or indirectly by the target [Source]. 3629 * directly or indirectly by the target [Source].
3630 *
3631 * [resultDescriptor] is the type of result which should be produced for each
3632 * target [Source].
3624 */ 3633 */
3625 class _ImportExportSourceClosureTaskInput extends TaskInputImpl<List<Source>> { 3634 class _ImportExportSourceClosureTaskInput extends TaskInputImpl<List<Source>> {
3626 final Source target; 3635 final Source target;
3636 final ResultDescriptor resultDescriptor;
3627 3637
3628 _ImportExportSourceClosureTaskInput(this.target); 3638 _ImportExportSourceClosureTaskInput(this.target, this.resultDescriptor);
3629 3639
3630 @override 3640 @override
3631 TaskInputBuilder<List<Source>> createBuilder() => 3641 TaskInputBuilder<List<Source>> createBuilder() =>
3632 new _SourceClosureTaskInputBuilder( 3642 new _SourceClosureTaskInputBuilder(
3633 target, _SourceClosureKind.IMPORT_EXPORT); 3643 target, _SourceClosureKind.IMPORT_EXPORT, resultDescriptor);
3634 } 3644 }
3635 3645
3636 /** 3646 /**
3637 * A [TaskInput] whose value is a list of library sources imported directly 3647 * A [TaskInput] whose value is a list of library sources imported directly
3638 * or indirectly by the target [Source]. 3648 * or indirectly by the target [Source].
3649 *
3650 * [resultDescriptor] is the type of result which should be produced for each
3651 * target [Source].
3639 */ 3652 */
3640 class _ImportSourceClosureTaskInput extends TaskInputImpl<List<Source>> { 3653 class _ImportSourceClosureTaskInput extends TaskInputImpl<List<Source>> {
3641 final Source target; 3654 final Source target;
3655 final ResultDescriptor resultDescriptor;
3642 3656
3643 _ImportSourceClosureTaskInput(this.target); 3657 _ImportSourceClosureTaskInput(this.target, this.resultDescriptor);
3644 3658
3645 @override 3659 @override
3646 TaskInputBuilder<List<Source>> createBuilder() => 3660 TaskInputBuilder<List<Source>> createBuilder() =>
3647 new _SourceClosureTaskInputBuilder(target, _SourceClosureKind.IMPORT); 3661 new _SourceClosureTaskInputBuilder(
3662 target, _SourceClosureKind.IMPORT, resultDescriptor);
3648 } 3663 }
3649 3664
3650 /** 3665 /**
3651 * The kind of the source closure to build. 3666 * The kind of the source closure to build.
3652 */ 3667 */
3653 enum _SourceClosureKind { IMPORT, EXPORT, IMPORT_EXPORT } 3668 enum _SourceClosureKind { IMPORT, EXPORT, IMPORT_EXPORT }
3654 3669
3655 /** 3670 /**
3656 * A [TaskInputBuilder] to build values for [_ImportSourceClosureTaskInput]. 3671 * A [TaskInputBuilder] to build values for [_ImportSourceClosureTaskInput].
3657 */ 3672 */
3658 class _SourceClosureTaskInputBuilder implements TaskInputBuilder<List<Source>> { 3673 class _SourceClosureTaskInputBuilder implements TaskInputBuilder<List<Source>> {
3659 final _SourceClosureKind kind; 3674 final _SourceClosureKind kind;
3660 final Set<LibraryElement> _libraries = new HashSet<LibraryElement>(); 3675 final Set<LibraryElement> _libraries = new HashSet<LibraryElement>();
3661 final List<Source> _newSources = <Source>[]; 3676 final List<Source> _newSources = <Source>[];
3662 3677
3678 @override
3679 final ResultDescriptor currentResult;
3680
3663 Source currentTarget; 3681 Source currentTarget;
3664 3682
3665 _SourceClosureTaskInputBuilder(Source librarySource, this.kind) { 3683 _SourceClosureTaskInputBuilder(
3684 Source librarySource, this.kind, this.currentResult) {
3666 _newSources.add(librarySource); 3685 _newSources.add(librarySource);
3667 } 3686 }
3668 3687
3669 @override 3688 @override
3670 ResultDescriptor get currentResult => LIBRARY_ELEMENT2;
3671
3672 @override
3673 void set currentValue(Object value) { 3689 void set currentValue(Object value) {
3674 LibraryElement library = value; 3690 LibraryElement library = value;
3675 if (_libraries.add(library)) { 3691 if (_libraries.add(library)) {
3676 if (kind == _SourceClosureKind.IMPORT || 3692 if (kind == _SourceClosureKind.IMPORT ||
3677 kind == _SourceClosureKind.IMPORT_EXPORT) { 3693 kind == _SourceClosureKind.IMPORT_EXPORT) {
3678 for (ImportElement importElement in library.imports) { 3694 for (ImportElement importElement in library.imports) {
3679 Source importedSource = importElement.importedLibrary.source; 3695 Source importedSource = importElement.importedLibrary.source;
3680 _newSources.add(importedSource); 3696 _newSources.add(importedSource);
3681 } 3697 }
3682 } 3698 }
(...skipping 20 matching lines...) Expand all
3703 3719
3704 @override 3720 @override
3705 bool moveNext() { 3721 bool moveNext() {
3706 if (_newSources.isEmpty) { 3722 if (_newSources.isEmpty) {
3707 return false; 3723 return false;
3708 } 3724 }
3709 currentTarget = _newSources.removeLast(); 3725 currentTarget = _newSources.removeLast();
3710 return true; 3726 return true;
3711 } 3727 }
3712 } 3728 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698