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

Unified Diff: pkg/analyzer/lib/src/util/fast_uri.dart

Issue 2225243003: Revert "Reapply fast-URI patch." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « CHANGELOG.md ('k') | runtime/lib/uri_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/util/fast_uri.dart
diff --git a/pkg/analyzer/lib/src/util/fast_uri.dart b/pkg/analyzer/lib/src/util/fast_uri.dart
index 0df5ce05ae85257bbf96471396802c7723685194..8af548c82640e91fc126f9b29fcc099891cb9211 100644
--- a/pkg/analyzer/lib/src/util/fast_uri.dart
+++ b/pkg/analyzer/lib/src/util/fast_uri.dart
@@ -62,7 +62,23 @@ class FastUri implements Uri {
bool get hasFragment => false;
@override
- int get hashCode => _text.hashCode;
+ int get hashCode {
+ // This code is copied from the standard Uri implementation.
+ // It is important that Uri and FastUri generate compatible hashCodes
+ // because Uri and FastUri may be used as keys in the same map.
+ 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 _hashCode ??= combine(
+ scheme,
+ combine(
+ userInfo,
+ combine(
+ host,
+ combine(port,
+ combine(path, combine(query, combine(fragment, 1)))))));
+ }
@override
bool get hasPort => false;
« no previous file with comments | « CHANGELOG.md ('k') | runtime/lib/uri_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698