| Index: pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart
|
| diff --git a/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart
|
| index 73a6723374f22404b79880f8fb09faf0282ba15a..d727e225aea559aed2528733994b47c4050872a1 100644
|
| --- a/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart
|
| +++ b/pkg/dev_compiler/tool/input_sdk/patch/math_patch.dart
|
| @@ -8,52 +8,43 @@ import 'dart:_js_helper' show patch, checkNum;
|
| import 'dart:typed_data' show ByteData;
|
|
|
| @patch
|
| -num/*=T*/ min/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b)
|
| - => JS('num', r'Math.min(#, #)', checkNum(a), checkNum(b)) as num/*=T*/;
|
| +num/*=T*/ min/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b) =>
|
| + JS('num', r'Math.min(#, #)', checkNum(a), checkNum(b)) as num/*=T*/;
|
|
|
| @patch
|
| -num/*=T*/ max/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b)
|
| - => JS('num', r'Math.max(#, #)', checkNum(a), checkNum(b)) as num/*=T*/;
|
| +num/*=T*/ max/*<T extends num>*/(num/*=T*/ a, num/*=T*/ b) =>
|
| + JS('num', r'Math.max(#, #)', checkNum(a), checkNum(b)) as num/*=T*/;
|
|
|
| @patch
|
| -double sqrt(num x)
|
| - => JS('num', r'Math.sqrt(#)', checkNum(x));
|
| +double sqrt(num x) => JS('num', r'Math.sqrt(#)', checkNum(x));
|
|
|
| @patch
|
| -double sin(num x)
|
| - => JS('num', r'Math.sin(#)', checkNum(x));
|
| +double sin(num x) => JS('num', r'Math.sin(#)', checkNum(x));
|
|
|
| @patch
|
| -double cos(num x)
|
| - => JS('num', r'Math.cos(#)', checkNum(x));
|
| +double cos(num x) => JS('num', r'Math.cos(#)', checkNum(x));
|
|
|
| @patch
|
| -double tan(num x)
|
| - => JS('num', r'Math.tan(#)', checkNum(x));
|
| +double tan(num x) => JS('num', r'Math.tan(#)', checkNum(x));
|
|
|
| @patch
|
| -double acos(num x)
|
| - => JS('num', r'Math.acos(#)', checkNum(x));
|
| +double acos(num x) => JS('num', r'Math.acos(#)', checkNum(x));
|
|
|
| @patch
|
| -double asin(num x)
|
| - => JS('num', r'Math.asin(#)', checkNum(x));
|
| +double asin(num x) => JS('num', r'Math.asin(#)', checkNum(x));
|
|
|
| @patch
|
| -double atan(num x)
|
| - => JS('num', r'Math.atan(#)', checkNum(x));
|
| +double atan(num x) => JS('num', r'Math.atan(#)', checkNum(x));
|
|
|
| @patch
|
| -double atan2(num a, num b)
|
| - => JS('num', r'Math.atan2(#, #)', checkNum(a), checkNum(b));
|
| +double atan2(num a, num b) =>
|
| + JS('num', r'Math.atan2(#, #)', checkNum(a), checkNum(b));
|
|
|
| @patch
|
| -double exp(num x)
|
| - => JS('num', r'Math.exp(#)', checkNum(x));
|
| +double exp(num x) => JS('num', r'Math.exp(#)', checkNum(x));
|
|
|
| @patch
|
| -double log(num x)
|
| - => JS('num', r'Math.log(#)', checkNum(x));
|
| +double log(num x) => JS('num', r'Math.log(#)', checkNum(x));
|
|
|
| @patch
|
| num pow(num x, num exponent) {
|
| @@ -99,7 +90,6 @@ class _JSRandom implements Random {
|
| bool nextBool() => JS("bool", "Math.random() < 0.5");
|
| }
|
|
|
| -
|
| class _Random implements Random {
|
| // Constants used by the algorithm or masking.
|
| static const double _POW2_53_D = 1.0 * (0x20000000000000);
|
| @@ -202,9 +192,9 @@ class _Random implements Random {
|
| // _hi = state >> 32;
|
| void _nextState() {
|
| // Simulate (0xFFFFDA61 * lo + hi) without overflowing 53 bits.
|
| - int tmpHi = 0xFFFF0000 * _lo; // At most 48 bits of significant result.
|
| - int tmpHiLo = tmpHi & _MASK32; // Get the lower 32 bits.
|
| - int tmpHiHi = tmpHi - tmpHiLo; // And just the upper 32 bits.
|
| + int tmpHi = 0xFFFF0000 * _lo; // At most 48 bits of significant result.
|
| + int tmpHiLo = tmpHi & _MASK32; // Get the lower 32 bits.
|
| + int tmpHiHi = tmpHi - tmpHiLo; // And just the upper 32 bits.
|
| int tmpLo = 0xDA61 * _lo;
|
| int tmpLoLo = tmpLo & _MASK32;
|
| int tmpLoHi = tmpLo - tmpLoLo;
|
| @@ -251,7 +241,6 @@ class _Random implements Random {
|
| }
|
| }
|
|
|
| -
|
| class _JSSecureRandom implements Random {
|
| // Reused buffer with room enough for a double.
|
| final _buffer = new ByteData(8);
|
| @@ -271,7 +260,7 @@ class _JSSecureRandom implements Random {
|
| /// Fill _buffer from [start] to `start + length` with random bytes.
|
| void _getRandomBytes(int start, int length) {
|
| JS("void", "crypto.getRandomValues(#)",
|
| - _buffer.buffer.asUint8List(start, length));
|
| + _buffer.buffer.asUint8List(start, length));
|
| }
|
|
|
| bool nextBool() {
|
| @@ -294,7 +283,7 @@ class _JSSecureRandom implements Random {
|
| // The getFloat64 method is big-endian as default.
|
| double result = _buffer.getFloat64(0) - 1.0;
|
| if (highByte & 0x10 != 0) {
|
| - result += 1.1102230246251565e-16; // pow(2,-53).
|
| + result += 1.1102230246251565e-16; // pow(2,-53).
|
| }
|
| return result;
|
| }
|
|
|