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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/package.dart

Issue 72193002: Clean up version solver tests a bit. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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.package; 5 library pub.package;
6 6
7 import 'package:path/path.dart' as path; 7 import 'package:path/path.dart' as path;
8 8
9 import 'io.dart'; 9 import 'io.dart';
10 import 'pubspec.dart'; 10 import 'pubspec.dart';
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return "$name from $source"; 104 return "$name from $source";
105 } 105 }
106 106
107 /// Returns a [PackageRef] with this one's [name], [source], and 107 /// Returns a [PackageRef] with this one's [name], [source], and
108 /// [description]. 108 /// [description].
109 PackageRef toRef() => new PackageRef(name, source, description); 109 PackageRef toRef() => new PackageRef(name, source, description);
110 110
111 /// Returns a [PackageId] for this package with the given concrete version. 111 /// Returns a [PackageId] for this package with the given concrete version.
112 PackageId atVersion(Version version) => 112 PackageId atVersion(Version version) =>
113 new PackageId(name, source, version, description); 113 new PackageId(name, source, version, description);
114
115 /// Returns a [PackageDep] for this package with the given version constraint.
116 PackageDep withConstraint(VersionConstraint constraint) =>
117 new PackageDep(name, source, constraint, description);
114 } 118 }
115 119
116 /// A reference to a [Package], but not any particular version(s) of it. 120 /// A reference to a [Package], but not any particular version(s) of it.
117 class PackageRef extends _PackageName { 121 class PackageRef extends _PackageName {
118 PackageRef(String name, String source, description) 122 PackageRef(String name, String source, description)
119 : super(name, source, description); 123 : super(name, source, description);
120 124
121 int get hashCode => name.hashCode ^ source.hashCode; 125 int get hashCode => name.hashCode ^ source.hashCode;
122 126
123 bool operator ==(other) { 127 bool operator ==(other) {
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 186
183 bool operator ==(other) { 187 bool operator ==(other) {
184 // TODO(rnystrom): We're assuming here that we don't need to delve into the 188 // TODO(rnystrom): We're assuming here that we don't need to delve into the
185 // description. 189 // description.
186 return other is PackageDep && 190 return other is PackageDep &&
187 other.name == name && 191 other.name == name &&
188 other.source == source && 192 other.source == source &&
189 other.constraint == constraint; 193 other.constraint == constraint;
190 } 194 }
191 } 195 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698