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

Side by Side Diff: utils/pub/package.dart

Issue 11191078: Make hashCode a getter and not a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 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 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 /** 111 /**
112 * The metadata used by the package's [source] to identify and locate it. It 112 * The metadata used by the package's [source] to identify and locate it. It
113 * contains whatever [Source]-specific data it needs to be able to install 113 * contains whatever [Source]-specific data it needs to be able to install
114 * the package. For example, the description of a git sourced package might 114 * the package. For example, the description of a git sourced package might
115 * by the URL "git://github.com/dart/uilib.git". 115 * by the URL "git://github.com/dart/uilib.git".
116 */ 116 */
117 final description; 117 final description;
118 118
119 PackageId(this.name, this.source, this.version, this.description); 119 PackageId(this.name, this.source, this.version, this.description);
120 120
121 int hashCode() => name.hashCode() ^ 121 int get hashCode => name.hashCode ^
122 source.name.hashCode() ^ 122 source.name.hashCode ^
123 version.hashCode(); 123 version.hashCode;
124 124
125 bool operator ==(other) { 125 bool operator ==(other) {
126 if (other is! PackageId) return false; 126 if (other is! PackageId) return false;
127 // TODO(rnystrom): We're assuming here the name/version/source tuple is 127 // TODO(rnystrom): We're assuming here the name/version/source tuple is
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 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698