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

Unified Diff: pkg/dev_compiler/lib/js/legacy/dart_sdk.js

Issue 2386493003: Fix type errors in math.min() and math.max(). (Closed)
Patch Set: Created 4 years, 3 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:
Download patch
Index: pkg/dev_compiler/lib/js/legacy/dart_sdk.js
diff --git a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
index 4c981ff594b2e279a632578f401f854f071ff2a6..63d08bd039f9230b0ea1f54fda05fb5672a6939b 100644
--- a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
@@ -36959,40 +36959,13 @@ dart_library.library('dart_sdk', null, /* Imports */[
math.SQRT2 = 1.4142135623730951;
math.min = function(T) {
return (a, b) => {
- if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a));
- if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b));
- if (dart.notNull(a) > dart.notNull(b)) return b;
- if (dart.notNull(a) < dart.notNull(b)) return a;
- if (typeof b == 'number') {
- if (typeof a == 'number') {
- if (a == 0.0) {
- return (dart.notNull(a) + dart.notNull(b)) * dart.notNull(a) * dart.notNull(b);
- }
- }
- if (a == 0 && dart.test(b[dartx.isNegative]) || dart.test(b[dartx.isNaN])) return b;
- return a;
- }
- return a;
+ return Math.min(_js_helper.checkNum(a), _js_helper.checkNum(b));
};
};
dart.fn(math.min, TAndTToT());
math.max = function(T) {
return (a, b) => {
- if (!(typeof a == 'number')) dart.throw(new core.ArgumentError(a));
- if (!(typeof b == 'number')) dart.throw(new core.ArgumentError(b));
- if (dart.notNull(a) > dart.notNull(b)) return a;
- if (dart.notNull(a) < dart.notNull(b)) return b;
- if (typeof b == 'number') {
- if (typeof a == 'number') {
- if (a == 0.0) {
- return dart.notNull(a) + dart.notNull(b);
- }
- }
- if (dart.test(b[dartx.isNaN])) return b;
- return a;
- }
- if (b == 0 && dart.test(a[dartx.isNegative])) return b;
- return a;
+ return Math.max(_js_helper.checkNum(a), _js_helper.checkNum(b));
};
};
dart.fn(math.max, TAndTToT$());

Powered by Google App Engine
This is Rietveld 408576698