| OLD | NEW |
| 1 dart_library.library('dart/math', null, /* Imports */[ | 1 dart_library.library('dart/math', null, /* Imports */[ |
| 2 "dart_runtime/dart", | 2 "dart_runtime/dart", |
| 3 'dart/core' | 3 'dart/core' |
| 4 ], /* Lazy imports */[ | 4 ], /* Lazy imports */[ |
| 5 'dart/_js_helper' | 5 'dart/_js_helper' |
| 6 ], function(exports, dart, core, _js_helper) { | 6 ], function(exports, dart, core, _js_helper) { |
| 7 'use strict'; | 7 'use strict'; |
| 8 let dartx = dart.dartx; | 8 let dartx = dart.dartx; |
| 9 class _JenkinsSmiHash extends core.Object { | 9 class _JenkinsSmiHash extends core.Object { |
| 10 static combine(hash, value) { | 10 static combine(hash, value) { |
| 11 hash = 536870911 & dart.notNull(hash) + dart.notNull(value); | 11 hash = 536870911 & dart.notNull(hash) + dart.notNull(value); |
| 12 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) <<
10); | 12 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) <<
10); |
| 13 return dart.notNull(hash) ^ dart.notNull(hash) >> 6; | 13 return dart.notNull(hash) ^ dart.notNull(hash) >> 6; |
| 14 } | 14 } |
| 15 static finish(hash) { | 15 static finish(hash) { |
| 16 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) <
< 3); | 16 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) <
< 3); |
| 17 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 11; | 17 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 11; |
| 18 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1
5); | 18 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1
5); |
| 19 } | 19 } |
| 20 static hash2(a, b) { | 20 static hash2(a, b) { |
| 21 return _JenkinsSmiHash.finish(_JenkinsSmiHash.combine(_JenkinsSmiHash.comb
ine(0, dart.as(a, core.int)), dart.as(b, core.int))); | 21 return dart.dcall(_JenkinsSmiHash.finish, dart.dcall(_JenkinsSmiHash.combi
ne, dart.dcall(_JenkinsSmiHash.combine, 0, a), b)); |
| 22 } | 22 } |
| 23 static hash4(a, b, c, d) { | 23 static hash4(a, b, c, d) { |
| 24 return _JenkinsSmiHash.finish(_JenkinsSmiHash.combine(_JenkinsSmiHash.comb
ine(_JenkinsSmiHash.combine(_JenkinsSmiHash.combine(0, dart.as(a, core.int)), da
rt.as(b, core.int)), dart.as(c, core.int)), dart.as(d, core.int))); | 24 return dart.dcall(_JenkinsSmiHash.finish, dart.dcall(_JenkinsSmiHash.combi
ne, dart.dcall(_JenkinsSmiHash.combine, dart.dcall(_JenkinsSmiHash.combine, dart
.dcall(_JenkinsSmiHash.combine, 0, a), b), c), d)); |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 dart.setSignature(_JenkinsSmiHash, { | 27 dart.setSignature(_JenkinsSmiHash, { |
| 28 statics: () => ({ | 28 statics: () => ({ |
| 29 combine: [core.int, [core.int, core.int]], | 29 combine: [core.int, [core.int, core.int]], |
| 30 finish: [core.int, [core.int]], | 30 finish: [core.int, [core.int]], |
| 31 hash2: [core.int, [dart.dynamic, dart.dynamic]], | 31 hash2: [core.int, [dart.dynamic, dart.dynamic]], |
| 32 hash4: [core.int, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]
] | 32 hash4: [core.int, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]
] |
| 33 }), | 33 }), |
| 34 names: ['combine', 'finish', 'hash2', 'hash4'] | 34 names: ['combine', 'finish', 'hash2', 'hash4'] |
| 35 }); | 35 }); |
| 36 let Point$ = dart.generic(function(T) { | 36 let Point$ = dart.generic(function(T) { |
| 37 class Point extends core.Object { | 37 class Point extends core.Object { |
| 38 Point(x, y) { | 38 Point(x, y) { |
| 39 this.x = x; | 39 this.x = x; |
| 40 this.y = y; | 40 this.y = y; |
| 41 } | 41 } |
| 42 toString() { | 42 toString() { |
| 43 return `Point(${this.x}, ${this.y})`; | 43 return `Point(${this.x}, ${this.y})`; |
| 44 } | 44 } |
| 45 ['=='](other) { | 45 ['=='](other) { |
| 46 if (!dart.is(other, Point$())) | 46 if (!dart.is(other, Point$())) |
| 47 return false; | 47 return false; |
| 48 return dart.equals(this.x, dart.dload(other, 'x')) && dart.equals(this.y
, dart.dload(other, 'y')); | 48 return dart.equals(this.x, dart.dload(other, 'x')) && dart.equals(this.y
, dart.dload(other, 'y')); |
| 49 } | 49 } |
| 50 get hashCode() { | 50 get hashCode() { |
| 51 return _JenkinsSmiHash.hash2(dart.hashCode(this.x), dart.hashCode(this.y
)); | 51 return dart.dcall(_JenkinsSmiHash.hash2, dart.hashCode(this.x), dart.has
hCode(this.y)); |
| 52 } | 52 } |
| 53 ['+'](other) { | 53 ['+'](other) { |
| 54 dart.as(other, Point$(T)); | 54 dart.as(other, Point$(T)); |
| 55 return new (Point$(T))(dart.as(this.x['+'](other.x), T), dart.as(this.y[
'+'](other.y), T)); | 55 return new (Point$(T))(dart.as(this.x['+'](other.x), T), dart.as(this.y[
'+'](other.y), T)); |
| 56 } | 56 } |
| 57 ['-'](other) { | 57 ['-'](other) { |
| 58 dart.as(other, Point$(T)); | 58 dart.as(other, Point$(T)); |
| 59 return new (Point$(T))(dart.as(this.x['-'](other.x), T), dart.as(this.y[
'-'](other.y), T)); | 59 return new (Point$(T))(dart.as(this.x['-'](other.x), T), dart.as(this.y[
'-'](other.y), T)); |
| 60 } | 60 } |
| 61 ['*'](factor) { | 61 ['*'](factor) { |
| 62 return new (Point$(T))(dart.as(this.x['*'](factor), T), dart.as(this.y['
*'](factor), T)); | 62 return new (Point$(T))(dart.as(this.x['*'](factor), T), dart.as(this.y['
*'](factor), T)); |
| 63 } | 63 } |
| 64 get magnitude() { | 64 get magnitude() { |
| 65 return sqrt(dart.notNull(this.x['*'](this.x)) + dart.notNull(this.y['*']
(this.y))); | 65 return dart.dcall(sqrt, dart.notNull(this.x['*'](this.x)) + dart.notNull
(this.y['*'](this.y))); |
| 66 } | 66 } |
| 67 distanceTo(other) { | 67 distanceTo(other) { |
| 68 dart.as(other, Point$(T)); | 68 dart.as(other, Point$(T)); |
| 69 let dx = this.x['-'](other.x); | 69 let dx = this.x['-'](other.x); |
| 70 let dy = this.y['-'](other.y); | 70 let dy = this.y['-'](other.y); |
| 71 return sqrt(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dar
t.notNull(dy)); | 71 return dart.dcall(sqrt, dart.dsend(dart.dsend(dx, '*', dx), '+', dart.ds
end(dy, '*', dy))); |
| 72 } | 72 } |
| 73 squaredDistanceTo(other) { | 73 squaredDistanceTo(other) { |
| 74 dart.as(other, Point$(T)); | 74 dart.as(other, Point$(T)); |
| 75 let dx = this.x['-'](other.x); | 75 let dx = this.x['-'](other.x); |
| 76 let dy = this.y['-'](other.y); | 76 let dy = this.y['-'](other.y); |
| 77 return dart.as(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) *
dart.notNull(dy), T); | 77 return dart.as(dart.dsend(dart.dsend(dx, '*', dx), '+', dart.dsend(dy, '
*', dy)), T); |
| 78 } | 78 } |
| 79 } | 79 } |
| 80 dart.setSignature(Point, { | 80 dart.setSignature(Point, { |
| 81 constructors: () => ({Point: [Point$(T), [T, T]]}), | 81 constructors: () => ({Point: [Point$(T), [T, T]]}), |
| 82 methods: () => ({ | 82 methods: () => ({ |
| 83 '+': [Point$(T), [Point$(T)]], | 83 '+': [Point$(T), [Point$(T)]], |
| 84 '-': [Point$(T), [Point$(T)]], | 84 '-': [Point$(T), [Point$(T)]], |
| 85 '*': [Point$(T), [core.num]], | 85 '*': [Point$(T), [core.num]], |
| 86 distanceTo: [core.double, [Point$(T)]], | 86 distanceTo: [core.double, [Point$(T)]], |
| 87 squaredDistanceTo: [T, [Point$(T)]] | 87 squaredDistanceTo: [T, [Point$(T)]] |
| (...skipping 24 matching lines...) Expand all Loading... |
| 112 } | 112 } |
| 113 toString() { | 113 toString() { |
| 114 return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.hei
ght}`; | 114 return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.hei
ght}`; |
| 115 } | 115 } |
| 116 ['=='](other) { | 116 ['=='](other) { |
| 117 if (!dart.is(other, Rectangle)) | 117 if (!dart.is(other, Rectangle)) |
| 118 return false; | 118 return false; |
| 119 return dart.equals(this.left, dart.dload(other, 'left')) && dart.equals(
this.top, dart.dload(other, 'top')) && dart.equals(this.right, dart.dload(other,
'right')) && dart.equals(this.bottom, dart.dload(other, 'bottom')); | 119 return dart.equals(this.left, dart.dload(other, 'left')) && dart.equals(
this.top, dart.dload(other, 'top')) && dart.equals(this.right, dart.dload(other,
'right')) && dart.equals(this.bottom, dart.dload(other, 'bottom')); |
| 120 } | 120 } |
| 121 get hashCode() { | 121 get hashCode() { |
| 122 return _JenkinsSmiHash.hash4(dart.hashCode(this.left), dart.hashCode(thi
s.top), dart.hashCode(this.right), dart.hashCode(this.bottom)); | 122 return dart.dcall(_JenkinsSmiHash.hash4, dart.hashCode(this.left), dart.
hashCode(this.top), dart.hashCode(this.right), dart.hashCode(this.bottom)); |
| 123 } | 123 } |
| 124 intersection(other) { | 124 intersection(other) { |
| 125 dart.as(other, Rectangle$(T)); | 125 dart.as(other, Rectangle$(T)); |
| 126 let x0 = max(this.left, other.left); | 126 let x0 = dart.dcall(max, this.left, other.left); |
| 127 let x1 = min(this.left['+'](this.width), other.left['+'](other.width)); | 127 let x1 = dart.dcall(min, this.left['+'](this.width), other.left['+'](oth
er.width)); |
| 128 if (dart.notNull(x0) <= dart.notNull(x1)) { | 128 if (dart.notNull(dart.as(dart.dsend(x0, '<=', x1), core.bool))) { |
| 129 let y0 = max(this.top, other.top); | 129 let y0 = dart.dcall(max, this.top, other.top); |
| 130 let y1 = min(this.top['+'](this.height), other.top['+'](other.height))
; | 130 let y1 = dart.dcall(min, this.top['+'](this.height), other.top['+'](ot
her.height)); |
| 131 if (dart.notNull(y0) <= dart.notNull(y1)) { | 131 if (dart.notNull(dart.as(dart.dsend(y0, '<=', y1), core.bool))) { |
| 132 return new (Rectangle$(T))(dart.as(x0, T), dart.as(y0, T), dart.as(d
art.notNull(x1) - dart.notNull(x0), T), dart.as(dart.notNull(y1) - dart.notNull(
y0), T)); | 132 return new (Rectangle$(T))(dart.as(x0, T), dart.as(y0, T), dart.as(d
art.dsend(x1, '-', x0), T), dart.as(dart.dsend(y1, '-', y0), T)); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 return null; | 135 return null; |
| 136 } | 136 } |
| 137 intersects(other) { | 137 intersects(other) { |
| 138 return dart.notNull(this.left['<='](dart.notNull(other.left) + dart.notN
ull(other.width))) && dart.notNull(other.left) <= dart.notNull(this.left['+'](th
is.width)) && dart.notNull(this.top['<='](dart.notNull(other.top) + dart.notNull
(other.height))) && dart.notNull(other.top) <= dart.notNull(this.top['+'](this.h
eight)); | 138 return dart.notNull(this.left['<='](dart.notNull(other.left) + dart.notN
ull(other.width))) && dart.notNull(other.left) <= dart.notNull(this.left['+'](th
is.width)) && dart.notNull(this.top['<='](dart.notNull(other.top) + dart.notNull
(other.height))) && dart.notNull(other.top) <= dart.notNull(this.top['+'](this.h
eight)); |
| 139 } | 139 } |
| 140 boundingBox(other) { | 140 boundingBox(other) { |
| 141 dart.as(other, Rectangle$(T)); | 141 dart.as(other, Rectangle$(T)); |
| 142 let right = max(this.left['+'](this.width), other.left['+'](other.width)
); | 142 let right = dart.dcall(max, this.left['+'](this.width), other.left['+'](
other.width)); |
| 143 let bottom = max(this.top['+'](this.height), other.top['+'](other.height
)); | 143 let bottom = dart.dcall(max, this.top['+'](this.height), other.top['+'](
other.height)); |
| 144 let left = min(this.left, other.left); | 144 let left = dart.dcall(min, this.left, other.left); |
| 145 let top = min(this.top, other.top); | 145 let top = dart.dcall(min, this.top, other.top); |
| 146 return new (Rectangle$(T))(dart.as(left, T), dart.as(top, T), dart.as(da
rt.notNull(right) - dart.notNull(left), T), dart.as(dart.notNull(bottom) - dart.
notNull(top), T)); | 146 return new (Rectangle$(T))(dart.as(left, T), dart.as(top, T), dart.as(da
rt.dsend(right, '-', left), T), dart.as(dart.dsend(bottom, '-', top), T)); |
| 147 } | 147 } |
| 148 containsRectangle(another) { | 148 containsRectangle(another) { |
| 149 return dart.notNull(this.left['<='](another.left)) && dart.notNull(this.
left['+'](this.width)) >= dart.notNull(another.left) + dart.notNull(another.widt
h) && dart.notNull(this.top['<='](another.top)) && dart.notNull(this.top['+'](th
is.height)) >= dart.notNull(another.top) + dart.notNull(another.height); | 149 return dart.notNull(this.left['<='](another.left)) && dart.notNull(this.
left['+'](this.width)) >= dart.notNull(another.left) + dart.notNull(another.widt
h) && dart.notNull(this.top['<='](another.top)) && dart.notNull(this.top['+'](th
is.height)) >= dart.notNull(another.top) + dart.notNull(another.height); |
| 150 } | 150 } |
| 151 containsPoint(another) { | 151 containsPoint(another) { |
| 152 return another.x[dartx['>=']](this.left) && dart.notNull(another.x) <= d
art.notNull(this.left['+'](this.width)) && another.y[dartx['>=']](this.top) && d
art.notNull(another.y) <= dart.notNull(this.top['+'](this.height)); | 152 return another.x[dartx['>=']](this.left) && dart.notNull(another.x) <= d
art.notNull(this.left['+'](this.width)) && another.y[dartx['>=']](this.top) && d
art.notNull(another.y) <= dart.notNull(this.top['+'](this.height)); |
| 153 } | 153 } |
| 154 get topLeft() { | 154 get topLeft() { |
| 155 return new (Point$(T))(this.left, this.top); | 155 return new (Point$(T))(this.left, this.top); |
| 156 } | 156 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 180 let Rectangle$ = dart.generic(function(T) { | 180 let Rectangle$ = dart.generic(function(T) { |
| 181 class Rectangle extends _RectangleBase$(T) { | 181 class Rectangle extends _RectangleBase$(T) { |
| 182 Rectangle(left, top, width, height) { | 182 Rectangle(left, top, width, height) { |
| 183 this.left = left; | 183 this.left = left; |
| 184 this.top = top; | 184 this.top = top; |
| 185 this.width = dart.as(dart.notNull(width['<'](0)) ? dart.notNull(width['u
nary-']()) * 0 : width, T); | 185 this.width = dart.as(dart.notNull(width['<'](0)) ? dart.notNull(width['u
nary-']()) * 0 : width, T); |
| 186 this.height = dart.as(dart.notNull(height['<'](0)) ? dart.notNull(height
['unary-']()) * 0 : height, T); | 186 this.height = dart.as(dart.notNull(height['<'](0)) ? dart.notNull(height
['unary-']()) * 0 : height, T); |
| 187 super._RectangleBase(); | 187 super._RectangleBase(); |
| 188 } | 188 } |
| 189 static fromPoints(a, b) { | 189 static fromPoints(a, b) { |
| 190 let left = dart.as(min(a.x, b.x), T); | 190 let left = dart.as(dart.dcall(min, a.x, b.x), T); |
| 191 let width = dart.as(max(a.x, b.x)[dartx['-']](left), T); | 191 let width = dart.as(dart.dcall(max, a.x, b.x)[dartx['-']](left), T); |
| 192 let top = dart.as(min(a.y, b.y), T); | 192 let top = dart.as(dart.dcall(min, a.y, b.y), T); |
| 193 let height = dart.as(max(a.y, b.y)[dartx['-']](top), T); | 193 let height = dart.as(dart.dcall(max, a.y, b.y)[dartx['-']](top), T); |
| 194 return new (Rectangle$(T))(left, top, width, height); | 194 return new (Rectangle$(T))(left, top, width, height); |
| 195 } | 195 } |
| 196 } | 196 } |
| 197 dart.setSignature(Rectangle, { | 197 dart.setSignature(Rectangle, { |
| 198 constructors: () => ({ | 198 constructors: () => ({ |
| 199 Rectangle: [Rectangle$(T), [T, T, T, T]], | 199 Rectangle: [Rectangle$(T), [T, T, T, T]], |
| 200 fromPoints: [Rectangle$(T), [Point$(T), Point$(T)]] | 200 fromPoints: [Rectangle$(T), [Point$(T), Point$(T)]] |
| 201 }) | 201 }) |
| 202 }); | 202 }); |
| 203 return Rectangle; | 203 return Rectangle; |
| 204 }); | 204 }); |
| 205 let Rectangle = Rectangle$(); | 205 let Rectangle = Rectangle$(); |
| 206 let _width = Symbol('_width'); | 206 let _width = Symbol('_width'); |
| 207 let _height = Symbol('_height'); | 207 let _height = Symbol('_height'); |
| 208 let MutableRectangle$ = dart.generic(function(T) { | 208 let MutableRectangle$ = dart.generic(function(T) { |
| 209 class MutableRectangle extends _RectangleBase$(T) { | 209 class MutableRectangle extends _RectangleBase$(T) { |
| 210 MutableRectangle(left, top, width, height) { | 210 MutableRectangle(left, top, width, height) { |
| 211 this.left = left; | 211 this.left = left; |
| 212 this.top = top; | 212 this.top = top; |
| 213 this[_width] = dart.as(dart.notNull(width['<'](0)) ? _clampToZero(width)
: width, T); | 213 this[_width] = dart.as(dart.notNull(width['<'](0)) ? dart.dcall(_clampTo
Zero, width) : width, T); |
| 214 this[_height] = dart.as(dart.notNull(height['<'](0)) ? _clampToZero(heig
ht) : height, T); | 214 this[_height] = dart.as(dart.notNull(height['<'](0)) ? dart.dcall(_clamp
ToZero, height) : height, T); |
| 215 super._RectangleBase(); | 215 super._RectangleBase(); |
| 216 } | 216 } |
| 217 static fromPoints(a, b) { | 217 static fromPoints(a, b) { |
| 218 let left = dart.as(min(a.x, b.x), T); | 218 let left = dart.as(dart.dcall(min, a.x, b.x), T); |
| 219 let width = dart.as(max(a.x, b.x)[dartx['-']](left), T); | 219 let width = dart.as(dart.dcall(max, a.x, b.x)[dartx['-']](left), T); |
| 220 let top = dart.as(min(a.y, b.y), T); | 220 let top = dart.as(dart.dcall(min, a.y, b.y), T); |
| 221 let height = dart.as(max(a.y, b.y)[dartx['-']](top), T); | 221 let height = dart.as(dart.dcall(max, a.y, b.y)[dartx['-']](top), T); |
| 222 return new (MutableRectangle$(T))(left, top, width, height); | 222 return new (MutableRectangle$(T))(left, top, width, height); |
| 223 } | 223 } |
| 224 get width() { | 224 get width() { |
| 225 return this[_width]; | 225 return this[_width]; |
| 226 } | 226 } |
| 227 set width(width) { | 227 set width(width) { |
| 228 dart.as(width, T); | 228 dart.as(width, T); |
| 229 if (dart.notNull(width['<'](0))) | 229 if (dart.notNull(width['<'](0))) |
| 230 width = dart.as(_clampToZero(width), T); | 230 width = dart.as(dart.dcall(_clampToZero, width), T); |
| 231 this[_width] = width; | 231 this[_width] = width; |
| 232 } | 232 } |
| 233 get height() { | 233 get height() { |
| 234 return this[_height]; | 234 return this[_height]; |
| 235 } | 235 } |
| 236 set height(height) { | 236 set height(height) { |
| 237 dart.as(height, T); | 237 dart.as(height, T); |
| 238 if (dart.notNull(height['<'](0))) | 238 if (dart.notNull(height['<'](0))) |
| 239 height = dart.as(_clampToZero(height), T); | 239 height = dart.as(dart.dcall(_clampToZero, height), T); |
| 240 this[_height] = height; | 240 this[_height] = height; |
| 241 } | 241 } |
| 242 } | 242 } |
| 243 MutableRectangle[dart.implements] = () => [Rectangle$(T)]; | 243 MutableRectangle[dart.implements] = () => [Rectangle$(T)]; |
| 244 dart.setSignature(MutableRectangle, { | 244 dart.setSignature(MutableRectangle, { |
| 245 constructors: () => ({ | 245 constructors: () => ({ |
| 246 MutableRectangle: [MutableRectangle$(T), [T, T, T, T]], | 246 MutableRectangle: [MutableRectangle$(T), [T, T, T, T]], |
| 247 fromPoints: [MutableRectangle$(T), [Point$(T), Point$(T)]] | 247 fromPoints: [MutableRectangle$(T), [Point$(T), Point$(T)]] |
| 248 }) | 248 }) |
| 249 }); | 249 }); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 if (dart.notNull(b[dartx.isNaN])) | 303 if (dart.notNull(b[dartx.isNaN])) |
| 304 return b; | 304 return b; |
| 305 return a; | 305 return a; |
| 306 } | 306 } |
| 307 if (b == 0 && dart.notNull(a[dartx.isNegative])) | 307 if (b == 0 && dart.notNull(a[dartx.isNegative])) |
| 308 return b; | 308 return b; |
| 309 return a; | 309 return a; |
| 310 } | 310 } |
| 311 dart.fn(max, core.num, [core.num, core.num]); | 311 dart.fn(max, core.num, [core.num, core.num]); |
| 312 function atan2(a, b) { | 312 function atan2(a, b) { |
| 313 return Math.atan2(_js_helper.checkNum(a), _js_helper.checkNum(b)); | 313 return dart.as(Math.atan2(dart.dcall(_js_helper.checkNum, a), dart.dcall(_js
_helper.checkNum, b)), core.double); |
| 314 } | 314 } |
| 315 dart.fn(atan2, core.double, [core.num, core.num]); | 315 dart.fn(atan2, core.double, [core.num, core.num]); |
| 316 function pow(x, exponent) { | 316 function pow(x, exponent) { |
| 317 _js_helper.checkNum(x); | 317 dart.dcall(_js_helper.checkNum, x); |
| 318 _js_helper.checkNum(exponent); | 318 dart.dcall(_js_helper.checkNum, exponent); |
| 319 return Math.pow(x, exponent); | 319 return dart.as(Math.pow(x, exponent), core.num); |
| 320 } | 320 } |
| 321 dart.fn(pow, core.num, [core.num, core.num]); | 321 dart.fn(pow, core.num, [core.num, core.num]); |
| 322 function sin(x) { | 322 function sin(x) { |
| 323 return Math.sin(_js_helper.checkNum(x)); | 323 return dart.as(Math.sin(dart.dcall(_js_helper.checkNum, x)), core.double); |
| 324 } | 324 } |
| 325 dart.fn(sin, core.double, [core.num]); | 325 dart.fn(sin, core.double, [core.num]); |
| 326 function cos(x) { | 326 function cos(x) { |
| 327 return Math.cos(_js_helper.checkNum(x)); | 327 return dart.as(Math.cos(dart.dcall(_js_helper.checkNum, x)), core.double); |
| 328 } | 328 } |
| 329 dart.fn(cos, core.double, [core.num]); | 329 dart.fn(cos, core.double, [core.num]); |
| 330 function tan(x) { | 330 function tan(x) { |
| 331 return Math.tan(_js_helper.checkNum(x)); | 331 return dart.as(Math.tan(dart.dcall(_js_helper.checkNum, x)), core.double); |
| 332 } | 332 } |
| 333 dart.fn(tan, core.double, [core.num]); | 333 dart.fn(tan, core.double, [core.num]); |
| 334 function acos(x) { | 334 function acos(x) { |
| 335 return Math.acos(_js_helper.checkNum(x)); | 335 return dart.as(Math.acos(dart.dcall(_js_helper.checkNum, x)), core.double); |
| 336 } | 336 } |
| 337 dart.fn(acos, core.double, [core.num]); | 337 dart.fn(acos, core.double, [core.num]); |
| 338 function asin(x) { | 338 function asin(x) { |
| 339 return Math.asin(_js_helper.checkNum(x)); | 339 return dart.as(Math.asin(dart.dcall(_js_helper.checkNum, x)), core.double); |
| 340 } | 340 } |
| 341 dart.fn(asin, core.double, [core.num]); | 341 dart.fn(asin, core.double, [core.num]); |
| 342 function atan(x) { | 342 function atan(x) { |
| 343 return Math.atan(_js_helper.checkNum(x)); | 343 return dart.as(Math.atan(dart.dcall(_js_helper.checkNum, x)), core.double); |
| 344 } | 344 } |
| 345 dart.fn(atan, core.double, [core.num]); | 345 dart.fn(atan, core.double, [core.num]); |
| 346 function sqrt(x) { | 346 function sqrt(x) { |
| 347 return Math.sqrt(_js_helper.checkNum(x)); | 347 return dart.as(Math.sqrt(dart.dcall(_js_helper.checkNum, x)), core.double); |
| 348 } | 348 } |
| 349 dart.fn(sqrt, core.double, [core.num]); | 349 dart.fn(sqrt, core.double, [core.num]); |
| 350 function exp(x) { | 350 function exp(x) { |
| 351 return Math.exp(_js_helper.checkNum(x)); | 351 return dart.as(Math.exp(dart.dcall(_js_helper.checkNum, x)), core.double); |
| 352 } | 352 } |
| 353 dart.fn(exp, core.double, [core.num]); | 353 dart.fn(exp, core.double, [core.num]); |
| 354 function log(x) { | 354 function log(x) { |
| 355 return Math.log(_js_helper.checkNum(x)); | 355 return dart.as(Math.log(dart.dcall(_js_helper.checkNum, x)), core.double); |
| 356 } | 356 } |
| 357 dart.fn(log, core.double, [core.num]); | 357 dart.fn(log, core.double, [core.num]); |
| 358 let _POW2_32 = 4294967296; | 358 let _POW2_32 = 4294967296; |
| 359 class _JSRandom extends core.Object { | 359 class _JSRandom extends core.Object { |
| 360 _JSRandom() { | 360 _JSRandom() { |
| 361 } | 361 } |
| 362 nextInt(max) { | 362 nextInt(max) { |
| 363 if (dart.notNull(max) <= 0 || dart.notNull(max) > dart.notNull(_POW2_32))
{ | 363 if (dart.notNull(max) <= 0 || dart.notNull(max) > dart.notNull(_POW2_32))
{ |
| 364 dart.throw(new core.RangeError(`max must be in range 0 < max ≤ 2^32, was
${max}`)); | 364 dart.throw(new core.RangeError(`max must be in range 0 < max ≤ 2^32, was
${max}`)); |
| 365 } | 365 } |
| 366 return Math.random() * max >>> 0; | 366 return dart.as(Math.random() * max >>> 0, core.int); |
| 367 } | 367 } |
| 368 nextDouble() { | 368 nextDouble() { |
| 369 return Math.random(); | 369 return dart.as(Math.random(), core.double); |
| 370 } | 370 } |
| 371 nextBool() { | 371 nextBool() { |
| 372 return Math.random() < 0.5; | 372 return dart.as(Math.random() < 0.5, core.bool); |
| 373 } | 373 } |
| 374 } | 374 } |
| 375 _JSRandom[dart.implements] = () => [Random]; | 375 _JSRandom[dart.implements] = () => [Random]; |
| 376 dart.setSignature(_JSRandom, { | 376 dart.setSignature(_JSRandom, { |
| 377 constructors: () => ({_JSRandom: [_JSRandom, []]}), | 377 constructors: () => ({_JSRandom: [_JSRandom, []]}), |
| 378 methods: () => ({ | 378 methods: () => ({ |
| 379 nextInt: [core.int, [core.int]], | 379 nextInt: [core.int, [core.int]], |
| 380 nextDouble: [core.double, []], | 380 nextDouble: [core.double, []], |
| 381 nextBool: [core.bool, []] | 381 nextBool: [core.bool, []] |
| 382 }) | 382 }) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 high = dart.notNull(high) + dart.notNull(tmphigh) + ((dart.notNull(tmplo
w) - dart.notNull(low)) / 4294967296)[dartx.truncate]() & dart.notNull(_Random._
MASK32); | 427 high = dart.notNull(high) + dart.notNull(tmphigh) + ((dart.notNull(tmplo
w) - dart.notNull(low)) / 4294967296)[dartx.truncate]() & dart.notNull(_Random._
MASK32); |
| 428 tmplow = dart.notNull(this[_lo]) * 1037; | 428 tmplow = dart.notNull(this[_lo]) * 1037; |
| 429 this[_lo] = dart.notNull(tmplow) & dart.notNull(_Random._MASK32); | 429 this[_lo] = dart.notNull(tmplow) & dart.notNull(_Random._MASK32); |
| 430 this[_hi] = dart.notNull(this[_hi]) * 1037 + ((dart.notNull(tmplow) - da
rt.notNull(this[_lo])) / 4294967296)[dartx.truncate]() & dart.notNull(_Random._M
ASK32); | 430 this[_hi] = dart.notNull(this[_hi]) * 1037 + ((dart.notNull(tmplow) - da
rt.notNull(this[_lo])) / 4294967296)[dartx.truncate]() & dart.notNull(_Random._M
ASK32); |
| 431 this[_lo] = dart.notNull(this[_lo]) ^ dart.notNull(low); | 431 this[_lo] = dart.notNull(this[_lo]) ^ dart.notNull(low); |
| 432 this[_hi] = dart.notNull(this[_hi]) ^ dart.notNull(high); | 432 this[_hi] = dart.notNull(this[_hi]) ^ dart.notNull(high); |
| 433 } while (seed != empty_seed); | 433 } while (seed != empty_seed); |
| 434 if (this[_hi] == 0 && this[_lo] == 0) { | 434 if (this[_hi] == 0 && this[_lo] == 0) { |
| 435 this[_lo] = 23063; | 435 this[_lo] = 23063; |
| 436 } | 436 } |
| 437 this[_nextState](); | 437 dart.dcall(this[_nextState]); |
| 438 this[_nextState](); | 438 dart.dcall(this[_nextState]); |
| 439 this[_nextState](); | 439 dart.dcall(this[_nextState]); |
| 440 this[_nextState](); | 440 dart.dcall(this[_nextState]); |
| 441 } | 441 } |
| 442 [_nextState]() { | 442 [_nextState]() { |
| 443 let tmpHi = 4294901760 * dart.notNull(this[_lo]); | 443 let tmpHi = 4294901760 * dart.notNull(this[_lo]); |
| 444 let tmpHiLo = dart.notNull(tmpHi) & dart.notNull(_Random._MASK32); | 444 let tmpHiLo = dart.notNull(tmpHi) & dart.notNull(_Random._MASK32); |
| 445 let tmpHiHi = dart.notNull(tmpHi) - dart.notNull(tmpHiLo); | 445 let tmpHiHi = dart.notNull(tmpHi) - dart.notNull(tmpHiLo); |
| 446 let tmpLo = 55905 * dart.notNull(this[_lo]); | 446 let tmpLo = 55905 * dart.notNull(this[_lo]); |
| 447 let tmpLoLo = dart.notNull(tmpLo) & dart.notNull(_Random._MASK32); | 447 let tmpLoLo = dart.notNull(tmpLo) & dart.notNull(_Random._MASK32); |
| 448 let tmpLoHi = dart.notNull(tmpLo) - dart.notNull(tmpLoLo); | 448 let tmpLoHi = dart.notNull(tmpLo) - dart.notNull(tmpLoLo); |
| 449 let newLo = dart.notNull(tmpLoLo) + dart.notNull(tmpHiLo) + dart.notNull(t
his[_hi]); | 449 let newLo = dart.notNull(tmpLoLo) + dart.notNull(tmpHiLo) + dart.notNull(t
his[_hi]); |
| 450 this[_lo] = dart.notNull(newLo) & dart.notNull(_Random._MASK32); | 450 this[_lo] = dart.notNull(newLo) & dart.notNull(_Random._MASK32); |
| 451 let newLoHi = dart.notNull(newLo) - dart.notNull(this[_lo]); | 451 let newLoHi = dart.notNull(newLo) - dart.notNull(this[_lo]); |
| 452 this[_hi] = ((dart.notNull(tmpLoHi) + dart.notNull(tmpHiHi) + dart.notNull
(newLoHi)) / dart.notNull(_POW2_32))[dartx.truncate]() & dart.notNull(_Random._M
ASK32); | 452 this[_hi] = ((dart.notNull(tmpLoHi) + dart.notNull(tmpHiHi) + dart.notNull
(newLoHi)) / dart.notNull(_POW2_32))[dartx.truncate]() & dart.notNull(_Random._M
ASK32); |
| 453 dart.assert(dart.notNull(this[_lo]) < dart.notNull(_POW2_32)); | 453 dart.assert(dart.notNull(this[_lo]) < dart.notNull(_POW2_32)); |
| 454 dart.assert(dart.notNull(this[_hi]) < dart.notNull(_POW2_32)); | 454 dart.assert(dart.notNull(this[_hi]) < dart.notNull(_POW2_32)); |
| 455 } | 455 } |
| 456 nextInt(max) { | 456 nextInt(max) { |
| 457 if (dart.notNull(max) <= 0 || dart.notNull(max) > dart.notNull(_POW2_32))
{ | 457 if (dart.notNull(max) <= 0 || dart.notNull(max) > dart.notNull(_POW2_32))
{ |
| 458 dart.throw(new core.RangeError(`max must be in range 0 < max ≤ 2^32, was
${max}`)); | 458 dart.throw(new core.RangeError(`max must be in range 0 < max ≤ 2^32, was
${max}`)); |
| 459 } | 459 } |
| 460 if ((dart.notNull(max) & dart.notNull(max) - 1) == 0) { | 460 if ((dart.notNull(max) & dart.notNull(max) - 1) == 0) { |
| 461 this[_nextState](); | 461 dart.dcall(this[_nextState]); |
| 462 return dart.notNull(this[_lo]) & dart.notNull(max) - 1; | 462 return dart.notNull(this[_lo]) & dart.notNull(max) - 1; |
| 463 } | 463 } |
| 464 let rnd32 = null; | 464 let rnd32 = null; |
| 465 let result = null; | 465 let result = null; |
| 466 do { | 466 do { |
| 467 this[_nextState](); | 467 dart.dcall(this[_nextState]); |
| 468 rnd32 = this[_lo]; | 468 rnd32 = this[_lo]; |
| 469 result = rnd32[dartx.remainder](max); | 469 result = dart.dcall(rnd32[dartx.remainder], max); |
| 470 } while (dart.notNull(rnd32) - dart.notNull(result) + dart.notNull(max) >=
dart.notNull(_POW2_32)); | 470 } while (dart.notNull(rnd32) - dart.notNull(result) + dart.notNull(max) >=
dart.notNull(_POW2_32)); |
| 471 return result; | 471 return result; |
| 472 } | 472 } |
| 473 nextDouble() { | 473 nextDouble() { |
| 474 this[_nextState](); | 474 dart.dcall(this[_nextState]); |
| 475 let bits26 = dart.notNull(this[_lo]) & (1 << 26) - 1; | 475 let bits26 = dart.notNull(this[_lo]) & (1 << 26) - 1; |
| 476 this[_nextState](); | 476 dart.dcall(this[_nextState]); |
| 477 let bits27 = dart.notNull(this[_lo]) & (1 << 27) - 1; | 477 let bits27 = dart.notNull(this[_lo]) & (1 << 27) - 1; |
| 478 return (dart.notNull(bits26) * dart.notNull(_Random._POW2_27_D) + dart.not
Null(bits27)) / dart.notNull(_Random._POW2_53_D); | 478 return (dart.notNull(bits26) * dart.notNull(_Random._POW2_27_D) + dart.not
Null(bits27)) / dart.notNull(_Random._POW2_53_D); |
| 479 } | 479 } |
| 480 nextBool() { | 480 nextBool() { |
| 481 this[_nextState](); | 481 dart.dcall(this[_nextState]); |
| 482 return (dart.notNull(this[_lo]) & 1) == 0; | 482 return (dart.notNull(this[_lo]) & 1) == 0; |
| 483 } | 483 } |
| 484 } | 484 } |
| 485 _Random[dart.implements] = () => [Random]; | 485 _Random[dart.implements] = () => [Random]; |
| 486 dart.setSignature(_Random, { | 486 dart.setSignature(_Random, { |
| 487 constructors: () => ({_Random: [_Random, [core.int]]}), | 487 constructors: () => ({_Random: [_Random, [core.int]]}), |
| 488 methods: () => ({ | 488 methods: () => ({ |
| 489 [_nextState]: [dart.void, []], | 489 [_nextState]: [dart.void, []], |
| 490 nextInt: [core.int, [core.int]], | 490 nextInt: [core.int, [core.int]], |
| 491 nextDouble: [core.double, []], | 491 nextDouble: [core.double, []], |
| (...skipping 26 matching lines...) Expand all Loading... |
| 518 exports.sin = sin; | 518 exports.sin = sin; |
| 519 exports.cos = cos; | 519 exports.cos = cos; |
| 520 exports.tan = tan; | 520 exports.tan = tan; |
| 521 exports.acos = acos; | 521 exports.acos = acos; |
| 522 exports.asin = asin; | 522 exports.asin = asin; |
| 523 exports.atan = atan; | 523 exports.atan = atan; |
| 524 exports.sqrt = sqrt; | 524 exports.sqrt = sqrt; |
| 525 exports.exp = exp; | 525 exports.exp = exp; |
| 526 exports.log = log; | 526 exports.log = log; |
| 527 }); | 527 }); |
| OLD | NEW |