| OLD | NEW |
| 1 var math; | 1 var math; |
| 2 (function(math) { | 2 (function(math) { |
| 3 'use strict'; | 3 'use strict'; |
| 4 let _lo = Symbol('_lo'); |
| 5 let _hi = Symbol('_hi'); |
| 6 let _nextState = Symbol('_nextState'); |
| 7 let _width = Symbol('_width'); |
| 8 let _height = Symbol('_height'); |
| 4 let E = 2.718281828459045; | 9 let E = 2.718281828459045; |
| 5 let LN10 = 2.302585092994046; | 10 let LN10 = 2.302585092994046; |
| 6 let LN2 = 0.6931471805599453; | 11 let LN2 = 0.6931471805599453; |
| 7 let LOG2E = 1.4426950408889634; | 12 let LOG2E = 1.4426950408889634; |
| 8 let LOG10E = 0.4342944819032518; | 13 let LOG10E = 0.4342944819032518; |
| 9 let PI = 3.141592653589793; | 14 let PI = 3.141592653589793; |
| 10 let SQRT1_2 = 0.7071067811865476; | 15 let SQRT1_2 = 0.7071067811865476; |
| 11 let SQRT2 = 1.4142135623730951; | 16 let SQRT2 = 1.4142135623730951; |
| 12 // Function min: (num, num) → num | 17 // Function min: (num, num) → num |
| 13 function min(a, b) { | 18 function min(a, b) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } | 118 } |
| 114 nextDouble() { | 119 nextDouble() { |
| 115 return Math.random(); | 120 return Math.random(); |
| 116 } | 121 } |
| 117 nextBool() { | 122 nextBool() { |
| 118 return Math.random() < 0.5; | 123 return Math.random() < 0.5; |
| 119 } | 124 } |
| 120 } | 125 } |
| 121 class _Random extends dart.Object { | 126 class _Random extends dart.Object { |
| 122 _Random(seed) { | 127 _Random(seed) { |
| 123 this._lo = 0; | 128 this[_lo] = 0; |
| 124 this._hi = 0; | 129 this[_hi] = 0; |
| 125 let empty_seed = 0; | 130 let empty_seed = 0; |
| 126 if (seed < 0) { | 131 if (seed < 0) { |
| 127 empty_seed = -1; | 132 empty_seed = -1; |
| 128 } | 133 } |
| 129 do { | 134 do { |
| 130 let low = seed & _MASK32; | 135 let low = seed & _MASK32; |
| 131 seed = ((seed - low) / _POW2_32).truncate(); | 136 seed = ((seed - low) / _POW2_32).truncate(); |
| 132 let high = seed & _MASK32; | 137 let high = seed & _MASK32; |
| 133 seed = ((seed - high) / _POW2_32).truncate(); | 138 seed = ((seed - high) / _POW2_32).truncate(); |
| 134 let tmplow = low << 21; | 139 let tmplow = low << 21; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 152 high = high * 21 + ((tmplow - low) / 4294967296).truncate() & _MASK32; | 157 high = high * 21 + ((tmplow - low) / 4294967296).truncate() & _MASK32; |
| 153 tmphigh = high >> 28; | 158 tmphigh = high >> 28; |
| 154 tmplow = low >> 28 | high << 4; | 159 tmplow = low >> 28 | high << 4; |
| 155 low = tmplow; | 160 low = tmplow; |
| 156 high = tmphigh; | 161 high = tmphigh; |
| 157 tmplow = low << 31; | 162 tmplow = low << 31; |
| 158 tmphigh = high << 31 | low >> 1; | 163 tmphigh = high << 31 | low >> 1; |
| 159 tmplow = low; | 164 tmplow = low; |
| 160 low = tmplow & _MASK32; | 165 low = tmplow & _MASK32; |
| 161 high = high + tmphigh + ((tmplow - low) / 4294967296).truncate() & _MASK
32; | 166 high = high + tmphigh + ((tmplow - low) / 4294967296).truncate() & _MASK
32; |
| 162 tmplow = this._lo * 1037; | 167 tmplow = this[_lo] * 1037; |
| 163 this._lo = tmplow & _MASK32; | 168 this[_lo] = tmplow & _MASK32; |
| 164 this._hi = this._hi * 1037 + ((tmplow - this._lo) / 4294967296).truncate
() & _MASK32; | 169 this[_hi] = this[_hi] * 1037 + ((tmplow - this[_lo]) / 4294967296).trunc
ate() & _MASK32; |
| 165 this._lo = low; | 170 this[_lo] = low; |
| 166 this._hi = high; | 171 this[_hi] = high; |
| 167 } while (seed !== empty_seed); | 172 } while (seed !== empty_seed); |
| 168 if (dart.notNull(this._hi === 0) && dart.notNull(this._lo === 0)) { | 173 if (dart.notNull(this[_hi] === 0) && dart.notNull(this[_lo] === 0)) { |
| 169 this._lo = 23063; | 174 this[_lo] = 23063; |
| 170 } | 175 } |
| 171 this._nextState(); | 176 this[_nextState](); |
| 172 this._nextState(); | 177 this[_nextState](); |
| 173 this._nextState(); | 178 this[_nextState](); |
| 174 this._nextState(); | 179 this[_nextState](); |
| 175 } | 180 } |
| 176 _nextState() { | 181 [_nextState]() { |
| 177 let tmpHi = 4294901760 * this._lo; | 182 let tmpHi = 4294901760 * this[_lo]; |
| 178 let tmpHiLo = tmpHi & _MASK32; | 183 let tmpHiLo = tmpHi & _MASK32; |
| 179 let tmpHiHi = tmpHi - tmpHiLo; | 184 let tmpHiHi = tmpHi - tmpHiLo; |
| 180 let tmpLo = 55905 * this._lo; | 185 let tmpLo = 55905 * this[_lo]; |
| 181 let tmpLoLo = tmpLo & _MASK32; | 186 let tmpLoLo = tmpLo & _MASK32; |
| 182 let tmpLoHi = tmpLo - tmpLoLo; | 187 let tmpLoHi = tmpLo - tmpLoLo; |
| 183 let newLo = tmpLoLo + tmpHiLo + this._hi; | 188 let newLo = tmpLoLo + tmpHiLo + this[_hi]; |
| 184 this._lo = newLo & _MASK32; | 189 this[_lo] = newLo & _MASK32; |
| 185 let newLoHi = newLo - this._lo; | 190 let newLoHi = newLo - this[_lo]; |
| 186 this._hi = ((tmpLoHi + tmpHiHi + newLoHi) / _POW2_32).truncate() & _MASK32
; | 191 this[_hi] = ((tmpLoHi + tmpHiHi + newLoHi) / _POW2_32).truncate() & _MASK3
2; |
| 187 dart.assert(this._lo < _POW2_32); | 192 dart.assert(this[_lo] < _POW2_32); |
| 188 dart.assert(this._hi < _POW2_32); | 193 dart.assert(this[_hi] < _POW2_32); |
| 189 } | 194 } |
| 190 nextInt(max) { | 195 nextInt(max) { |
| 191 if (dart.notNull(max <= 0) || dart.notNull(max > _POW2_32)) { | 196 if (dart.notNull(max <= 0) || dart.notNull(max > _POW2_32)) { |
| 192 throw new core.RangeError(`max must be in range 0 < max ≤ 2^32, was ${ma
x}`); | 197 throw new core.RangeError(`max must be in range 0 < max ≤ 2^32, was ${ma
x}`); |
| 193 } | 198 } |
| 194 if ((max & max - 1) === 0) { | 199 if ((max & max - 1) === 0) { |
| 195 this._nextState(); | 200 this[_nextState](); |
| 196 return this._lo & max - 1; | 201 return this[_lo] & max - 1; |
| 197 } | 202 } |
| 198 let rnd32 = null; | 203 let rnd32 = null; |
| 199 let result = null; | 204 let result = null; |
| 200 do { | 205 do { |
| 201 this._nextState(); | 206 this[_nextState](); |
| 202 rnd32 = this._lo; | 207 rnd32 = this[_lo]; |
| 203 result = dart.notNull(rnd32.remainder(max)); | 208 result = dart.notNull(rnd32.remainder(max)); |
| 204 } while (rnd32 - result + max >= _POW2_32); | 209 } while (rnd32 - result + max >= _POW2_32); |
| 205 return result; | 210 return result; |
| 206 } | 211 } |
| 207 nextDouble() { | 212 nextDouble() { |
| 208 this._nextState(); | 213 this[_nextState](); |
| 209 let bits26 = this._lo & (1 << 26) - 1; | 214 let bits26 = this[_lo] & (1 << 26) - 1; |
| 210 this._nextState(); | 215 this[_nextState](); |
| 211 let bits27 = this._lo & (1 << 27) - 1; | 216 let bits27 = this[_lo] & (1 << 27) - 1; |
| 212 return (bits26 * _POW2_27_D + bits27) / _POW2_53_D; | 217 return (bits26 * _POW2_27_D + bits27) / _POW2_53_D; |
| 213 } | 218 } |
| 214 nextBool() { | 219 nextBool() { |
| 215 this._nextState(); | 220 this[_nextState](); |
| 216 return (this._lo & 1) === 0; | 221 return (this[_lo] & 1) === 0; |
| 217 } | 222 } |
| 218 } | 223 } |
| 219 _Random._POW2_53_D = 1.0 * 9007199254740992; | 224 _Random._POW2_53_D = 1.0 * 9007199254740992; |
| 220 _Random._POW2_27_D = 1.0 * (1 << 27); | 225 _Random._POW2_27_D = 1.0 * (1 << 27); |
| 221 _Random._MASK32 = 4294967295; | 226 _Random._MASK32 = 4294967295; |
| 222 class _JenkinsSmiHash extends dart.Object { | 227 class _JenkinsSmiHash extends dart.Object { |
| 223 static combine(hash, value) { | 228 static combine(hash, value) { |
| 224 hash = 536870911 & hash + value; | 229 hash = 536870911 & hash + value; |
| 225 hash = 536870911 & hash + ((524287 & hash) << 10); | 230 hash = 536870911 & hash + ((524287 & hash) << 10); |
| 226 return hash ^ hash >> 6; | 231 return hash ^ hash >> 6; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 } | 376 } |
| 372 dart.defineNamedConstructor(Rectangle, 'fromPoints'); | 377 dart.defineNamedConstructor(Rectangle, 'fromPoints'); |
| 373 return Rectangle; | 378 return Rectangle; |
| 374 }); | 379 }); |
| 375 let Rectangle = Rectangle$(dynamic); | 380 let Rectangle = Rectangle$(dynamic); |
| 376 let MutableRectangle$ = dart.generic(function(T) { | 381 let MutableRectangle$ = dart.generic(function(T) { |
| 377 class MutableRectangle extends _RectangleBase$(T) { | 382 class MutableRectangle extends _RectangleBase$(T) { |
| 378 MutableRectangle(left, top, width, height) { | 383 MutableRectangle(left, top, width, height) { |
| 379 this.left = left; | 384 this.left = left; |
| 380 this.top = top; | 385 this.top = top; |
| 381 this._width = dart.as(width['<'](0) ? _clampToZero(width) : width, T); | 386 this[_width] = dart.as(width['<'](0) ? _clampToZero(width) : width, T); |
| 382 this._height = dart.as(height['<'](0) ? _clampToZero(height) : height, T
); | 387 this[_height] = dart.as(height['<'](0) ? _clampToZero(height) : height,
T); |
| 383 super._RectangleBase(); | 388 super._RectangleBase(); |
| 384 } | 389 } |
| 385 MutableRectangle$fromPoints(a, b) { | 390 MutableRectangle$fromPoints(a, b) { |
| 386 let left = dart.as(min(a.x, b.x), T); | 391 let left = dart.as(min(a.x, b.x), T); |
| 387 let width = dart.as(core.num['-'](max(a.x, b.x), left), T); | 392 let width = dart.as(core.num['-'](max(a.x, b.x), left), T); |
| 388 let top = dart.as(min(a.y, b.y), T); | 393 let top = dart.as(min(a.y, b.y), T); |
| 389 let height = dart.as(core.num['-'](max(a.y, b.y), top), T); | 394 let height = dart.as(core.num['-'](max(a.y, b.y), top), T); |
| 390 return new MutableRectangle(left, top, width, height); | 395 return new MutableRectangle(left, top, width, height); |
| 391 } | 396 } |
| 392 get width() { | 397 get width() { |
| 393 return this._width; | 398 return this[_width]; |
| 394 } | 399 } |
| 395 set width(width) { | 400 set width(width) { |
| 396 if (width['<'](0)) | 401 if (width['<'](0)) |
| 397 width = dart.as(_clampToZero(width), T); | 402 width = dart.as(_clampToZero(width), T); |
| 398 this._width = width; | 403 this[_width] = width; |
| 399 } | 404 } |
| 400 get height() { | 405 get height() { |
| 401 return this._height; | 406 return this[_height]; |
| 402 } | 407 } |
| 403 set height(height) { | 408 set height(height) { |
| 404 if (height['<'](0)) | 409 if (height['<'](0)) |
| 405 height = dart.as(_clampToZero(height), T); | 410 height = dart.as(_clampToZero(height), T); |
| 406 this._height = height; | 411 this[_height] = height; |
| 407 } | 412 } |
| 408 } | 413 } |
| 409 dart.defineNamedConstructor(MutableRectangle, 'fromPoints'); | 414 dart.defineNamedConstructor(MutableRectangle, 'fromPoints'); |
| 410 return MutableRectangle; | 415 return MutableRectangle; |
| 411 }); | 416 }); |
| 412 let MutableRectangle = MutableRectangle$(dynamic); | 417 let MutableRectangle = MutableRectangle$(dynamic); |
| 413 // Function _clampToZero: (num) → num | 418 // Function _clampToZero: (num) → num |
| 414 function _clampToZero(value) { | 419 function _clampToZero(value) { |
| 415 dart.assert(dart.notNull(value) < 0); | 420 dart.assert(dart.notNull(value) < 0); |
| 416 return dart.notNull(-dart.notNull(value)) * 0; | 421 return dart.notNull(-dart.notNull(value)) * 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 438 math.exp = exp; | 443 math.exp = exp; |
| 439 math.log = log; | 444 math.log = log; |
| 440 math.Point = Point; | 445 math.Point = Point; |
| 441 math.Point$ = Point$; | 446 math.Point$ = Point$; |
| 442 math.Random = Random; | 447 math.Random = Random; |
| 443 math.Rectangle = Rectangle; | 448 math.Rectangle = Rectangle; |
| 444 math.Rectangle$ = Rectangle$; | 449 math.Rectangle$ = Rectangle$; |
| 445 math.MutableRectangle = MutableRectangle; | 450 math.MutableRectangle = MutableRectangle; |
| 446 math.MutableRectangle$ = MutableRectangle$; | 451 math.MutableRectangle$ = MutableRectangle$; |
| 447 })(math || (math = {})); | 452 })(math || (math = {})); |
| OLD | NEW |