mirror of
https://github.com/dart-lang/sdk
synced 2024-09-04 16:03:44 +00:00
Make dart:math strong mode clean.
R=leafp@google.com Review URL: https://codereview.chromium.org/1961993002 .
This commit is contained in:
parent
fa48b7e17b
commit
b828752fd7
|
@ -55,8 +55,9 @@ class Point<T extends num> {
|
|||
* it, passing in a double [factor] on a `Point<int>` _causes_ _a_
|
||||
* _runtime_ _error_ in checked mode.
|
||||
*/
|
||||
Point<T> operator *(num factor) {
|
||||
return new Point<T>(x * factor, y * factor);
|
||||
Point<T> operator *(num/*T|int*/ factor) {
|
||||
return new Point<T>(
|
||||
(x * factor) as dynamic/*=T*/, (y * factor) as dynamic/*=T*/);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -209,8 +209,8 @@ class MutableRectangle<T extends num> extends _RectangleBase<T>
|
|||
* point `(left, top)`.
|
||||
*/
|
||||
MutableRectangle(this.left, this.top, T width, T height)
|
||||
: this._width = (width < 0) ? _clampToZero(width) : width,
|
||||
this._height = (height < 0) ? _clampToZero(height) : height;
|
||||
: this._width = (width < 0) ? _clampToZero/*<T>*/(width) : width,
|
||||
this._height = (height < 0) ? _clampToZero/*<T>*/(height) : height;
|
||||
|
||||
/**
|
||||
* Create a mutable rectangle spanned by the points [a] and [b];
|
||||
|
@ -244,7 +244,7 @@ class MutableRectangle<T extends num> extends _RectangleBase<T>
|
|||
* but will not change [left].
|
||||
*/
|
||||
void set width(T width) {
|
||||
if (width < 0) width = _clampToZero(width);
|
||||
if (width < 0) width = _clampToZero/*<T>*/(width);
|
||||
_width = width;
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ class MutableRectangle<T extends num> extends _RectangleBase<T>
|
|||
* but will not change [top].
|
||||
*/
|
||||
void set height(T height) {
|
||||
if (height < 0) height = _clampToZero(height);
|
||||
if (height < 0) height = _clampToZero/*<T>*/(height);
|
||||
_height = height;
|
||||
}
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ class MutableRectangle<T extends num> extends _RectangleBase<T>
|
|||
*
|
||||
* Returns `0` if value is int, `0.0` if value is double.
|
||||
*/
|
||||
num _clampToZero(num value) {
|
||||
num/*=T*/ _clampToZero/*<T extends num>*/(num/*=T*/ value) {
|
||||
assert(value < 0);
|
||||
return -value * 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue