[html] Avoid dynamic in Rectangle operator ==

* Rely on type promotion instead.
* The is! type promotion isn't working in the CFE yet.

Change-Id: Ia4c8b4bcbac50cd0ab07c60f7440ef3837675b7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/122179
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Nicholas Shahan 2019-10-21 19:40:18 +00:00 committed by commit-bot@chromium.org
parent aa569dfff0
commit 2495c5ca9f
5 changed files with 60 additions and 65 deletions

View file

@ -10842,13 +10842,12 @@ class DomRectReadOnly extends Interceptor implements Rectangle {
return 'Rectangle ($left, $top) $width x $height';
}
bool operator ==(other) {
if (other is! Rectangle) return false;
return left == other.left &&
top == other.top &&
width == other.width &&
height == other.height;
}
bool operator ==(other) =>
other is Rectangle &&
left == other.left &&
top == other.top &&
width == other.width &&
height == other.height;
int get hashCode => _JenkinsSmiHash.hash4(
left.hashCode, top.hashCode, width.hashCode, height.hashCode);
@ -32939,13 +32938,12 @@ class _DomRect extends DomRectReadOnly implements Rectangle {
return 'Rectangle ($left, $top) $width x $height';
}
bool operator ==(other) {
if (other is! Rectangle) return false;
return left == other.left &&
top == other.top &&
width == other.width &&
height == other.height;
}
bool operator ==(other) =>
other is Rectangle &&
left == other.left &&
top == other.top &&
width == other.width &&
height == other.height;
int get hashCode => _JenkinsSmiHash.hash4(
left.hashCode, top.hashCode, width.hashCode, height.hashCode);
@ -34970,8 +34968,8 @@ abstract class CssRect implements Rectangle<num> {
}
// TODO(jacobr): these methods are duplicated from _RectangleBase in dart:math
// Ideally we would provide a RectangleMixin class that provides this implementation.
// In an ideal world we would exp
// Ideally we would provide a RectangleMixin class that provides this
// implementation. In an ideal world we would exp
/** The x-coordinate of the right edge. */
num get right => left + width;
/** The y-coordinate of the bottom edge. */
@ -34981,13 +34979,12 @@ abstract class CssRect implements Rectangle<num> {
return 'Rectangle ($left, $top) $width x $height';
}
bool operator ==(other) {
if (other is! Rectangle) return false;
return left == other.left &&
top == other.top &&
right == other.right &&
bottom == other.bottom;
}
bool operator ==(other) =>
other is Rectangle &&
left == other.left &&
top == other.top &&
right == other.right &&
bottom == other.bottom;
int get hashCode => _JenkinsSmiHash.hash4(
left.hashCode, top.hashCode, right.hashCode, bottom.hashCode);

View file

@ -10844,13 +10844,12 @@ class DomRectReadOnly extends Interceptor implements Rectangle {
return 'Rectangle ($left, $top) $width x $height';
}
bool operator ==(other) {
if (other is! Rectangle) return false;
return left == other.left &&
top == other.top &&
width == other.width &&
height == other.height;
}
bool operator ==(other) =>
other is Rectangle &&
left == other.left &&
top == other.top &&
width == other.width &&
height == other.height;
int get hashCode => _JenkinsSmiHash.hash4(
left.hashCode, top.hashCode, width.hashCode, height.hashCode);
@ -32941,13 +32940,12 @@ class _DomRect extends DomRectReadOnly implements Rectangle {
return 'Rectangle ($left, $top) $width x $height';
}
bool operator ==(other) {
if (other is! Rectangle) return false;
return left == other.left &&
top == other.top &&
width == other.width &&
height == other.height;
}
bool operator ==(other) =>
other is Rectangle &&
left == other.left &&
top == other.top &&
width == other.width &&
height == other.height;
int get hashCode => _JenkinsSmiHash.hash4(
left.hashCode, top.hashCode, width.hashCode, height.hashCode);
@ -34972,8 +34970,8 @@ abstract class CssRect implements Rectangle<num> {
}
// TODO(jacobr): these methods are duplicated from _RectangleBase in dart:math
// Ideally we would provide a RectangleMixin class that provides this implementation.
// In an ideal world we would exp
// Ideally we would provide a RectangleMixin class that provides this
// implementation. In an ideal world we would exp
/** The x-coordinate of the right edge. */
num get right => left + width;
/** The y-coordinate of the bottom edge. */
@ -34983,13 +34981,12 @@ abstract class CssRect implements Rectangle<num> {
return 'Rectangle ($left, $top) $width x $height';
}
bool operator ==(other) {
if (other is! Rectangle) return false;
return left == other.left &&
top == other.top &&
right == other.right &&
bottom == other.bottom;
}
bool operator ==(other) =>
other is Rectangle &&
left == other.left &&
top == other.top &&
right == other.right &&
bottom == other.bottom;
int get hashCode => _JenkinsSmiHash.hash4(
left.hashCode, top.hashCode, right.hashCode, bottom.hashCode);

View file

@ -269,8 +269,8 @@ abstract class CssRect implements Rectangle<num> {
}
// TODO(jacobr): these methods are duplicated from _RectangleBase in dart:math
// Ideally we would provide a RectangleMixin class that provides this implementation.
// In an ideal world we would exp
// Ideally we would provide a RectangleMixin class that provides this
// implementation. In an ideal world we would exp
/** The x-coordinate of the right edge. */
num get right => left + width;
/** The y-coordinate of the bottom edge. */
@ -280,13 +280,12 @@ abstract class CssRect implements Rectangle<num> {
return 'Rectangle ($left, $top) $width x $height';
}
bool operator ==(other) {
if (other is! Rectangle) return false;
return left == other.left &&
top == other.top &&
right == other.right &&
bottom == other.bottom;
}
bool operator ==(other) =>
other is Rectangle &&
left == other.left &&
top == other.top &&
right == other.right &&
bottom == other.bottom;
int get hashCode => _JenkinsSmiHash.hash4(
left.hashCode, top.hashCode, right.hashCode, bottom.hashCode);

View file

@ -11,11 +11,12 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS implements
return 'Rectangle ($left, $top) $width x $height';
}
bool operator ==(other) {
if (other is !Rectangle) return false;
return left == other.left && top == other.top && width == other.width &&
height == other.height;
}
bool operator ==(other) =>
other is Rectangle &&
left == other.left &&
top == other.top &&
width == other.width &&
height == other.height;
int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode,
width.hashCode, height.hashCode);

View file

@ -11,11 +11,12 @@ $(ANNOTATIONS)$(NATIVESPEC)$(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS implements
return 'Rectangle ($left, $top) $width x $height';
}
bool operator ==(other) {
if (other is !Rectangle) return false;
return left == other.left && top == other.top && width == other.width &&
height == other.height;
}
bool operator ==(other) =>
other is Rectangle &&
left == other.left &&
top == other.top &&
width == other.width &&
height == other.height;
int get hashCode => _JenkinsSmiHash.hash4(left.hashCode, top.hashCode,
width.hashCode, height.hashCode);