Index: sdk/lib/_internal/pub/lib/src/solver/version_queue.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/solver/version_queue.dart b/sdk/lib/_internal/pub/lib/src/solver/version_queue.dart |
index 021b60e246bfaf2f94363d64b46352df01aa89c4..8af2a305b88e0dbeffacecc7e2bbb8b6157b7b72 100644 |
--- a/sdk/lib/_internal/pub/lib/src/solver/version_queue.dart |
+++ b/sdk/lib/_internal/pub/lib/src/solver/version_queue.dart |
@@ -40,6 +40,15 @@ class VersionQueue { |
return _allowed.first; |
} |
+ /// Whether the currently selected version has been responsible for a solve |
+ /// failure, or depends on a package that has. |
+ /// |
+ /// The solver uses this to determine which packages to backtrack to after a |
+ /// failure occurs. Any selected package that did *not* cause the failure can |
+ /// by skipped by the backtracker. |
nweiz
2014/05/12 20:18:55
"by skipped" -> "be skipped"
Bob Nystrom
2014/05/12 22:07:55
Done.
|
+ bool get hasFailed => _hasFailed; |
+ bool _hasFailed = false; |
+ |
/// Creates a new [VersionQueue] queue for starting with the optional |
/// [locked] package followed by the results of calling [allowedGenerator]. |
/// |
@@ -66,6 +75,10 @@ class VersionQueue { |
/// Returns `true` if it moved to a new version (which can be accessed from |
/// [current]. Returns `false` if there are no more versions. |
Future<bool> advance() { |
+ // Any failure was the fault of the previous version, not necessarily the |
+ // new one. |
+ _hasFailed = false; |
+ |
// If we have a locked version, consume it first. |
if (_locked != null) { |
// Advancing past the locked version, so need to load the others now |
@@ -81,6 +94,12 @@ class VersionQueue { |
return new Future.value(_allowed.isNotEmpty); |
} |
+ /// Marks the selected version as being directly or indirectly responsible |
+ /// for a solve failure. |
+ void fail() { |
+ _hasFailed = true; |
+ } |
+ |
/// Determines the list of allowed versions matching its constraint and places |
/// them in [_allowed]. |
Future _calculateAllowed() { |