diff --git a/lib/src/matching_link_result.dart b/lib/src/matching_link_result.dart index 615d28b850..e8e1c68785 100644 --- a/lib/src/matching_link_result.dart +++ b/lib/src/matching_link_result.dart @@ -4,7 +4,6 @@ import 'package:dartdoc/src/model/comment_referable.dart'; import 'package:dartdoc/src/model/model.dart'; -import 'package:dartdoc/src/quiver.dart'; class MatchingLinkResult { final CommentReferable? commentReferable; @@ -20,7 +19,7 @@ class MatchingLinkResult { } @override - int get hashCode => hash2(commentReferable, warn); + int get hashCode => Object.hash(commentReferable, warn); @override String toString() { diff --git a/lib/src/quiver.dart b/lib/src/quiver.dart index 614d58b937..706f1e428c 100644 --- a/lib/src/quiver.dart +++ b/lib/src/quiver.dart @@ -11,32 +11,3 @@ /// The returned iterable is a lazily-evaluated view on the input iterables. Iterable concat(Iterable> iterables) => iterables.expand((x) => x); - -// From lib/src/core/hash.dart: - -/// Generates a hash code for two objects. -int hash2(Object? a, Object? b) => - _finish(_combine(_combine(0, a.hashCode), b.hashCode)); - -/// Generates a hash code for three objects. -int hash3(Object? a, Object? b, Object? c) => _finish( - _combine(_combine(_combine(0, a.hashCode), b.hashCode), c.hashCode)); - -/// Generates a hash code for four objects. -int hash4(Object? a, Object? b, Object? c, Object? d) => _finish(_combine( - _combine(_combine(_combine(0, a.hashCode), b.hashCode), c.hashCode), - d.hashCode)); - -// Jenkins hash functions - -int _combine(int hash, int value) { - hash = 0x1fffffff & (hash + value); - hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10)); - return hash ^ (hash >> 6); -} - -int _finish(int hash) { - hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3)); - hash = hash ^ (hash >> 11); - return 0x1fffffff & (hash + ((0x00003fff & hash) << 15)); -} diff --git a/lib/src/tuple.dart b/lib/src/tuple.dart index 9f89ee2037..b8cbdafc3b 100644 --- a/lib/src/tuple.dart +++ b/lib/src/tuple.dart @@ -5,8 +5,6 @@ // file for details. All rights reserved. Use of this source code is governed // by a BSD-style license that can be found in the LICENSE file. -import 'package:dartdoc/src/quiver.dart' as quiver; - /// Represents a 2-tuple, or pair. class Tuple2 { /// Returns the first item of the tuple @@ -26,7 +24,7 @@ class Tuple2 { other is Tuple2 && other.item1 == item1 && other.item2 == item2; @override - int get hashCode => quiver.hash2(item1.hashCode, item2.hashCode); + int get hashCode => Object.hash(item1, item2); } /// Represents a 3-tuple, or triple. @@ -54,8 +52,7 @@ class Tuple3 { other.item3 == item3; @override - int get hashCode => - quiver.hash3(item1.hashCode, item2.hashCode, item3.hashCode); + int get hashCode => Object.hash(item1, item2, item3); } /// Represents a 4-tuple, or quadruple. @@ -87,6 +84,5 @@ class Tuple4 { other.item4 == item4; @override - int get hashCode => quiver.hash4( - item1.hashCode, item2.hashCode, item3.hashCode, item4.hashCode); + int get hashCode => Object.hash(item1, item2, item3, item4); } diff --git a/pubspec.yaml b/pubspec.yaml index 98a53c7e7d..b38570a663 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 4.1.0 description: A non-interactive HTML documentation generator for Dart source code. homepage: https://github.com/dart-lang/dartdoc environment: - sdk: '>=2.12.0 <3.0.0' + sdk: '>=2.14.0 <3.0.0' dependencies: analyzer: ^2.7.0 diff --git a/test/quiver_test.dart b/test/quiver_test.dart index 341cce4568..a44c2f1330 100644 --- a/test/quiver_test.dart +++ b/test/quiver_test.dart @@ -54,21 +54,4 @@ void main() { expect(ab, [1, 2, 3, 4, 5, 6]); }); }); - - group('hash', () { - test('hash2 should return an int', () { - var h = hash2('123', 456); - expect(h, isA()); - }); - - test('hash3 should return an int', () { - var h = hash3('123', 456, true); - expect(h, isA()); - }); - - test('hash4 should return an int', () { - var h = hash4('123', 456, true, []); - expect(h, isA()); - }); - }); }