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

Unified Diff: sdk/lib/_internal/pub/lib/src/solver/version_solver.dart

Issue 1123323003: Fix or work around failing pub tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/pub/lib/src/solver/version_solver.dart
diff --git a/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart b/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart
index 7dbcc9b9cc349fd0b4e4775c1762280ff9a76396..1c46c14896067e0d0fb04c448391af637d8526c1 100644
--- a/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart
+++ b/sdk/lib/_internal/pub/lib/src/solver/version_solver.dart
@@ -148,6 +148,12 @@ class PubspecCache {
/// The already-requested cached pubspecs.
final _pubspecs = new Map<PackageId, Pubspec>();
+ // TODO(nweiz): Currently, if [getCachedPubspec] returns pubspecs cached via
+ // [getVersions], the "complex backtrack" test case in version_solver_test
+ // fails. Fix that. See also [BacktrackingSolver._getTransitiveDependers].
+ /// The set of package ids for which [getPubspec] has been explicitly called.
+ final _explicitlyCached = new Set<PackageId>();
+
/// The type of version resolution that was run.
final SolveType _type;
@@ -176,6 +182,8 @@ class PubspecCache {
/// Loads the pubspec for the package identified by [id].
Future<Pubspec> getPubspec(PackageId id) {
+ _explicitlyCached.add(id);
+
// Complete immediately if it's already cached.
if (_pubspecs.containsKey(id)) {
_pubspecCacheHits++;
@@ -193,7 +201,8 @@ class PubspecCache {
/// Returns the previously cached pubspec for the package identified by [id]
/// or returns `null` if not in the cache.
- Pubspec getCachedPubspec(PackageId id) => _pubspecs[id];
+ Pubspec getCachedPubspec(PackageId id) =>
+ _explicitlyCached.contains(id) ? _pubspecs[id] : null;
/// Gets the list of versions for [package].
///
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/solver/backtracking_solver.dart ('k') | sdk/lib/_internal/pub/lib/src/validator/dependency.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698