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

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

Issue 338103004: Use metadata for patching. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 6 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 | « sdk/lib/_internal/lib/js_helper.dart ('k') | sdk/lib/_internal/lib/mirrors_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/lib/math_patch.dart
diff --git a/sdk/lib/_internal/lib/math_patch.dart b/sdk/lib/_internal/lib/math_patch.dart
index 2ba47aa4846611159d03037c8d42afdf87c4e804..0a4370873ec4a974c22d11ee1cfb5082677e9c3e 100644
--- a/sdk/lib/_internal/lib/math_patch.dart
+++ b/sdk/lib/_internal/lib/math_patch.dart
@@ -4,39 +4,50 @@
// Patch file for dart:math library.
import 'dart:_foreign_helper' show JS;
-import 'dart:_js_helper' show checkNum;
+import 'dart:_js_helper' show patch, checkNum;
-patch double sqrt(num x)
+@patch
+double sqrt(num x)
=> JS('double', r'Math.sqrt(#)', checkNum(x));
-patch double sin(num x)
+@patch
+double sin(num x)
=> JS('double', r'Math.sin(#)', checkNum(x));
-patch double cos(num x)
+@patch
+double cos(num x)
=> JS('double', r'Math.cos(#)', checkNum(x));
-patch double tan(num x)
+@patch
+double tan(num x)
=> JS('double', r'Math.tan(#)', checkNum(x));
-patch double acos(num x)
+@patch
+double acos(num x)
=> JS('double', r'Math.acos(#)', checkNum(x));
-patch double asin(num x)
+@patch
+double asin(num x)
=> JS('double', r'Math.asin(#)', checkNum(x));
-patch double atan(num x)
+@patch
+double atan(num x)
=> JS('double', r'Math.atan(#)', checkNum(x));
-patch double atan2(num a, num b)
+@patch
+double atan2(num a, num b)
=> JS('double', r'Math.atan2(#, #)', checkNum(a), checkNum(b));
-patch double exp(num x)
+@patch
+double exp(num x)
=> JS('double', r'Math.exp(#)', checkNum(x));
-patch double log(num x)
+@patch
+double log(num x)
=> JS('double', r'Math.log(#)', checkNum(x));
-patch num pow(num x, num exponent) {
+@patch
+num pow(num x, num exponent) {
checkNum(x);
checkNum(exponent);
return JS('num', r'Math.pow(#, #)', x, exponent);
@@ -44,8 +55,10 @@ patch num pow(num x, num exponent) {
const int _POW2_32 = 0x100000000;
-patch class Random {
- patch factory Random([int seed]) =>
+@patch
+class Random {
+ @patch
+ factory Random([int seed]) =>
(seed == null) ? const _JSRandom() : new _Random(seed);
}
« no previous file with comments | « sdk/lib/_internal/lib/js_helper.dart ('k') | sdk/lib/_internal/lib/mirrors_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698