OLD | NEW |
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('package'); | 5 #library('package'); |
6 | 6 |
7 #import('io.dart'); | 7 #import('io.dart'); |
8 #import('pubspec.dart'); | 8 #import('pubspec.dart'); |
9 #import('source.dart'); | 9 #import('source.dart'); |
10 #import('source_registry.dart'); | 10 #import('source_registry.dart'); |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // enough to uniquely identify the package and that we don't need to delve | 128 // enough to uniquely identify the package and that we don't need to delve |
129 // into the description. | 129 // into the description. |
130 return other.name == name && | 130 return other.name == name && |
131 other.source.name == source.name && | 131 other.source.name == source.name && |
132 other.version == version; | 132 other.version == version; |
133 } | 133 } |
134 | 134 |
135 String toString() => "$name $version from ${source.name}"; | 135 String toString() => "$name $version from ${source.name}"; |
136 | 136 |
137 int compareTo(Comparable other) { | 137 int compareTo(Comparable other) { |
138 if (other is! PackageId) throw new IllegalArgumentException(other); | 138 if (other is! PackageId) throw new ArgumentError(other); |
139 | 139 |
140 var sourceComp = source.name.compareTo(other.source.name); | 140 var sourceComp = source.name.compareTo(other.source.name); |
141 if (sourceComp != 0) return sourceComp; | 141 if (sourceComp != 0) return sourceComp; |
142 | 142 |
143 var nameComp = name.compareTo(other.name); | 143 var nameComp = name.compareTo(other.name); |
144 if (nameComp != 0) return nameComp; | 144 if (nameComp != 0) return nameComp; |
145 | 145 |
146 return version.compareTo(other.version); | 146 return version.compareTo(other.version); |
147 } | 147 } |
148 | 148 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 class PubspecNameMismatchException implements Exception { | 214 class PubspecNameMismatchException implements Exception { |
215 final String expectedName; | 215 final String expectedName; |
216 final String actualName; | 216 final String actualName; |
217 | 217 |
218 PubspecNameMismatchException(this.expectedName, this.actualName); | 218 PubspecNameMismatchException(this.expectedName, this.actualName); |
219 | 219 |
220 String toString() => 'The name you specified for your dependency, ' | 220 String toString() => 'The name you specified for your dependency, ' |
221 '"$expectedName", doesn\'t match the name "$actualName" in its pubspec.'; | 221 '"$expectedName", doesn\'t match the name "$actualName" in its pubspec.'; |
222 } | 222 } |
OLD | NEW |