Index: sdk/lib/uri/uri.dart |
diff --git a/sdk/lib/uri/uri.dart b/sdk/lib/uri/uri.dart |
index 4933d9d625b2f165882d795bdd3c1e272c3fd07d..6b01a0638c58de7b883d2d7c940b1019e49af44a 100644 |
--- a/sdk/lib/uri/uri.dart |
+++ b/sdk/lib/uri/uri.dart |
@@ -229,6 +229,27 @@ class Uri { |
return sb.toString(); |
} |
+ bool operator==(other) { |
+ if (other is! Uri) return false; |
+ Uri uri = other; |
+ return scheme == uri.scheme && |
+ userInfo == uri.userInfo && |
+ domain == uri.domain && |
+ port == uri.port && |
+ path == uri.path && |
+ query == uri.query && |
+ fragment == uri.fragment; |
+ } |
+ |
+ int get hashCode { |
+ int combine(part, current) { |
+ // The sum is truncated to 30 bits to make sure it fits into a Smi. |
+ return (current * 31 + part.hashCode) & 0x3FFFFFFF; |
+ } |
+ return combine(scheme, combine(userInfo, combine(domain, combine(port, |
+ combine(path, combine(query, combine(fragment, 1))))))); |
+ } |
+ |
static void _addIfNonEmpty(StringBuffer sb, String test, |
String first, String second) { |
if ("" != test) { |