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

Unified Diff: sdk/lib/_internal/js_runtime/lib/math_patch.dart

Issue 2858353003: Move Dart versions of math.min() and math.max() into VM patch file. (Closed)
Patch Set: Merge branch 'master' into min-max Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/math_patch.dart ('k') | sdk/lib/math/math.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/math_patch.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/math_patch.dart b/sdk/lib/_internal/js_runtime/lib/math_patch.dart
index 5148540229c88ee7d1838ba9ecdb5f0b6b04f7c5..b37ba521b3e5b812409db9007d4274f04a33a1fa 100644
--- a/sdk/lib/_internal/js_runtime/lib/math_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/math_patch.dart
@@ -8,6 +8,14 @@ import 'dart:_js_helper' show patch, checkNum;
import 'dart:typed_data' show ByteData;
@patch
+T min<T extends num>(T a, T b) =>
+ JS('num', r'Math.min(#, #)', checkNum(a), checkNum(b)) as T;
+
+@patch
+T max<T extends num>(T a, T b) =>
+ JS('num', r'Math.max(#, #)', checkNum(a), checkNum(b)) as T;
+
+@patch
double sqrt(num x) => JS('num', r'Math.sqrt(#)', checkNum(x));
@patch
« no previous file with comments | « runtime/lib/math_patch.dart ('k') | sdk/lib/math/math.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698