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

Unified Diff: pkg/analysis_server/lib/src/resource.dart

Issue 345063005: Fix operator== and hashCode for File and Folder objects. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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: pkg/analysis_server/lib/src/resource.dart
diff --git a/pkg/analysis_server/lib/src/resource.dart b/pkg/analysis_server/lib/src/resource.dart
index 50fb4422a6d40d600844f26f870d642f75cf1c5a..8110ebf7042dbd1b82a52da06b2260c68dcbc322 100644
--- a/pkg/analysis_server/lib/src/resource.dart
+++ b/pkg/analysis_server/lib/src/resource.dart
@@ -116,7 +116,10 @@ abstract class _MemoryResource implements Resource {
@override
bool operator ==(other) {
- return identical(this, other);
+ if (runtimeType != other.runtimeType) {
+ return false;
+ }
+ return path == other.path;
}
@override
@@ -496,7 +499,15 @@ abstract class _PhysicalResource implements Resource {
String get path => _entry.absolute.path;
@override
- get hashCode => _entry.hashCode;
+ get hashCode => path.hashCode;
+
+ @override
+ bool operator==(other) {
+ if (runtimeType != other.runtimeType) {
+ return false;
+ }
+ return path == other.path;
+ }
@override
String get shortName => basename(path);

Powered by Google App Engine
This is Rietveld 408576698