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

Side by Side Diff: sdk/lib/html/dart2js/html_dart2js.dart

Issue 18034021: Fixing analyzer warnings on overloading == but not get hashCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /// The Dart HTML library. 1 /// The Dart HTML library.
2 /// 2 ///
3 /// For examples, see 3 /// For examples, see
4 /// [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples) 4 /// [Dart HTML5 Samples](https://github.com/dart-lang/dart-html5-samples)
5 /// on Github. 5 /// on Github.
6 library dart.dom.html; 6 library dart.dom.html;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:collection'; 9 import 'dart:collection';
10 import 'dart:_collection-dev' hide Symbol; 10 import 'dart:_collection-dev' hide Symbol;
(...skipping 24490 matching lines...) Expand 10 before | Expand all | Expand 10 after
24501 String toString() { 24501 String toString() {
24502 return '($left, $top, $width, $height)'; 24502 return '($left, $top, $width, $height)';
24503 } 24503 }
24504 24504
24505 bool operator ==(other) { 24505 bool operator ==(other) {
24506 if (other is !Rect) return false; 24506 if (other is !Rect) return false;
24507 return left == other.left && top == other.top && width == other.width && 24507 return left == other.left && top == other.top && width == other.width &&
24508 height == other.height; 24508 height == other.height;
24509 } 24509 }
24510 24510
24511 int get hashCode => JenkinsSmiHash.hash4(left.hashCode, top.hashCode,
24512 width.hashCode, height.hashCode);
24513
24511 /** 24514 /**
24512 * Computes the intersection of this rectangle and the rectangle parameter. 24515 * Computes the intersection of this rectangle and the rectangle parameter.
24513 * Returns null if there is no intersection. 24516 * Returns null if there is no intersection.
24514 */ 24517 */
24515 Rect intersection(Rect rect) { 24518 Rect intersection(Rect rect) {
24516 var x0 = max(left, rect.left); 24519 var x0 = max(left, rect.left);
24517 var x1 = min(left + width, rect.left + rect.width); 24520 var x1 = min(left + width, rect.left + rect.width);
24518 24521
24519 if (x0 <= x1) { 24522 if (x0 <= x1) {
24520 var y0 = max(top, rect.top); 24523 var y0 = max(top, rect.top);
(...skipping 3083 matching lines...) Expand 10 before | Expand all | Expand 10 after
27604 27607
27605 const Point([num x = 0, num y = 0]): x = x, y = y; 27608 const Point([num x = 0, num y = 0]): x = x, y = y;
27606 27609
27607 String toString() => '($x, $y)'; 27610 String toString() => '($x, $y)';
27608 27611
27609 bool operator ==(other) { 27612 bool operator ==(other) {
27610 if (other is !Point) return false; 27613 if (other is !Point) return false;
27611 return x == other.x && y == other.y; 27614 return x == other.x && y == other.y;
27612 } 27615 }
27613 27616
27617 int get hashCode => JenkinsSmiHash.hash2(x.hashCode, y.hashCode);
27618
27614 Point operator +(Point other) { 27619 Point operator +(Point other) {
27615 return new Point(x + other.x, y + other.y); 27620 return new Point(x + other.x, y + other.y);
27616 } 27621 }
27617 27622
27618 Point operator -(Point other) { 27623 Point operator -(Point other) {
27619 return new Point(x - other.x, y - other.y); 27624 return new Point(x - other.x, y - other.y);
27620 } 27625 }
27621 27626
27622 Point operator *(num factor) { 27627 Point operator *(num factor) {
27623 return new Point(x * factor, y * factor); 27628 return new Point(x * factor, y * factor);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
27726 String toString() { 27731 String toString() {
27727 return '($left, $top, $width, $height)'; 27732 return '($left, $top, $width, $height)';
27728 } 27733 }
27729 27734
27730 bool operator ==(other) { 27735 bool operator ==(other) {
27731 if (other is !Rect) return false; 27736 if (other is !Rect) return false;
27732 return left == other.left && top == other.top && width == other.width && 27737 return left == other.left && top == other.top && width == other.width &&
27733 height == other.height; 27738 height == other.height;
27734 } 27739 }
27735 27740
27741 int get hashCode => JenkinsSmiHash.hash4(left.hashCode, top.hashCode,
27742 width.hashCode, height.hashCode);
27743
27736 /** 27744 /**
27737 * Computes the intersection of this rectangle and the rectangle parameter. 27745 * Computes the intersection of this rectangle and the rectangle parameter.
27738 * Returns null if there is no intersection. 27746 * Returns null if there is no intersection.
27739 */ 27747 */
27740 Rect intersection(Rect rect) { 27748 Rect intersection(Rect rect) {
27741 var x0 = max(left, rect.left); 27749 var x0 = max(left, rect.left);
27742 var x1 = min(left + width, rect.left + rect.width); 27750 var x1 = min(left + width, rect.left + rect.width);
27743 27751
27744 if (x0 <= x1) { 27752 if (x0 <= x1) {
27745 var y0 = max(top, rect.top); 27753 var y0 = max(top, rect.top);
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
28936 _position = nextPosition; 28944 _position = nextPosition;
28937 return true; 28945 return true;
28938 } 28946 }
28939 _current = null; 28947 _current = null;
28940 _position = _array.length; 28948 _position = _array.length;
28941 return false; 28949 return false;
28942 } 28950 }
28943 28951
28944 T get current => _current; 28952 T get current => _current;
28945 } 28953 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/html/dartium/html_dartium.dart » ('j') | sdk/lib/html/html_common/jenkins_smi_hash.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698