OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 pub.solver.version_queue; | 5 library pub.solver.version_queue; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection' show Queue; | 8 import 'dart:collection' show Queue; |
9 | 9 |
10 import '../package.dart'; | 10 import '../package.dart'; |
11 import 'backtracking_solver.dart'; | |
12 | 11 |
13 /// A function that asynchronously returns a sequence of package IDs. | 12 /// A function that asynchronously returns a sequence of package IDs. |
14 typedef Future<Iterable<PackageId>> PackageIdGenerator(); | 13 typedef Future<Iterable<PackageId>> PackageIdGenerator(); |
15 | 14 |
16 /// A prioritized, asynchronous queue of the possible versions that can be | 15 /// A prioritized, asynchronous queue of the possible versions that can be |
17 /// selected for one package. | 16 /// selected for one package. |
18 /// | 17 /// |
19 /// If there is a locked version, that comes first, followed by other versions | 18 /// If there is a locked version, that comes first, followed by other versions |
20 /// in descending order. This avoids requesting the list of versions until | 19 /// in descending order. This avoids requesting the list of versions until |
21 /// needed (i.e. after any locked version has been consumed) to avoid unneeded | 20 /// needed (i.e. after any locked version has been consumed) to avoid unneeded |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 82 } |
84 | 83 |
85 /// Determines the list of allowed versions matching its constraint and places | 84 /// Determines the list of allowed versions matching its constraint and places |
86 /// them in [_allowed]. | 85 /// them in [_allowed]. |
87 Future _calculateAllowed() { | 86 Future _calculateAllowed() { |
88 return _allowedGenerator().then((allowed) { | 87 return _allowedGenerator().then((allowed) { |
89 _allowed = new Queue<PackageId>.from(allowed); | 88 _allowed = new Queue<PackageId>.from(allowed); |
90 }); | 89 }); |
91 } | 90 } |
92 } | 91 } |
OLD | NEW |