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 3519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3530 * The kind of the source closure to build. | 3530 * The kind of the source closure to build. |
3531 */ | 3531 */ |
3532 enum _SourceClosureKind { IMPORT, EXPORT, IMPORT_EXPORT } | 3532 enum _SourceClosureKind { IMPORT, EXPORT, IMPORT_EXPORT } |
3533 | 3533 |
3534 /** | 3534 /** |
3535 * A [TaskInputBuilder] to build values for [_ImportSourceClosureTaskInput]. | 3535 * A [TaskInputBuilder] to build values for [_ImportSourceClosureTaskInput]. |
3536 */ | 3536 */ |
3537 class _SourceClosureTaskInputBuilder implements TaskInputBuilder<List<Source>> { | 3537 class _SourceClosureTaskInputBuilder implements TaskInputBuilder<List<Source>> { |
3538 final _SourceClosureKind kind; | 3538 final _SourceClosureKind kind; |
3539 final Set<LibraryElement> _libraries = new HashSet<LibraryElement>(); | 3539 final Set<LibraryElement> _libraries = new HashSet<LibraryElement>(); |
3540 final Set<Source> _newSources = new HashSet<Source>(); | 3540 final List<Source> _newSources = <Source>[]; |
3541 | 3541 |
3542 Source currentTarget; | 3542 Source currentTarget; |
3543 | 3543 |
3544 _SourceClosureTaskInputBuilder(Source librarySource, this.kind) { | 3544 _SourceClosureTaskInputBuilder(Source librarySource, this.kind) { |
3545 _newSources.add(librarySource); | 3545 _newSources.add(librarySource); |
3546 } | 3546 } |
3547 | 3547 |
3548 @override | 3548 @override |
3549 ResultDescriptor get currentResult => LIBRARY_ELEMENT2; | 3549 ResultDescriptor get currentResult => LIBRARY_ELEMENT2; |
3550 | 3550 |
(...skipping 27 matching lines...) Expand all Loading... |
3578 void currentValueNotAvailable() { | 3578 void currentValueNotAvailable() { |
3579 // Nothing needs to be done. moveNext() will simply go on to the next new | 3579 // Nothing needs to be done. moveNext() will simply go on to the next new |
3580 // source. | 3580 // source. |
3581 } | 3581 } |
3582 | 3582 |
3583 @override | 3583 @override |
3584 bool moveNext() { | 3584 bool moveNext() { |
3585 if (_newSources.isEmpty) { | 3585 if (_newSources.isEmpty) { |
3586 return false; | 3586 return false; |
3587 } | 3587 } |
3588 currentTarget = _newSources.first; | 3588 currentTarget = _newSources.removeLast(); |
3589 _newSources.remove(currentTarget); | |
3590 return true; | 3589 return true; |
3591 } | 3590 } |
3592 } | 3591 } |
OLD | NEW |