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

Side by Side Diff: test/codegen/expect/dart/math.js

Issue 1011153002: js: fix core.Object, output order, static const fields (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « test/codegen/expect/dart/isolate.js ('k') | test/codegen/expect/dart/typed_data.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var math; 1 var math;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class _JenkinsSmiHash extends core.Object {
5 static combine(hash, value) {
6 hash = 536870911 & dart.notNull(hash) + dart.notNull(value);
7 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) << 10);
8 return dart.notNull(hash) ^ dart.notNull(hash) >> 6;
9 }
10 static finish(hash) {
11 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) < < 3);
12 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 11;
13 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1 5);
14 }
15 static hash2(a, b) {
16 return finish(combine(combine(0, dart.as(a, core.int)), dart.as(b, core.in t)));
17 }
18 static hash4(a, b, c, d) {
19 return finish(combine(combine(combine(combine(0, dart.as(a, core.int)), da rt.as(b, core.int)), dart.as(c, core.int)), dart.as(d, core.int)));
20 }
21 }
22 let Point$ = dart.generic(function(T) {
23 class Point extends core.Object {
24 Point(x, y) {
25 this.x = x;
26 this.y = y;
27 }
28 toString() {
29 return `Point(${this.x}, ${this.y})`;
30 }
31 ['=='](other) {
32 if (!dart.is(other, Point))
33 return false;
34 return dart.notNull(dart.equals(this.x, dart.dload(other, 'x'))) && dart .notNull(dart.equals(this.y, dart.dload(other, 'y')));
35 }
36 get hashCode() {
37 return _JenkinsSmiHash.hash2(this.x.hashCode, this.y.hashCode);
38 }
39 ['+'](other) {
40 return new Point(dart.as(this.x['+'](other.x), T), dart.as(this.y['+'](o ther.y), T));
41 }
42 ['-'](other) {
43 return new Point(dart.as(this.x['-'](other.x), T), dart.as(this.y['-'](o ther.y), T));
44 }
45 ['*'](factor) {
46 return new Point(dart.as(this.x['*'](factor), T), dart.as(this.y['*'](fa ctor), T));
47 }
48 get magnitude() {
49 return sqrt(dart.notNull(this.x['*'](this.x)) + dart.notNull(this.y['*'] (this.y)));
50 }
51 distanceTo(other) {
52 let dx = this.x['-'](other.x);
53 let dy = this.y['-'](other.y);
54 return sqrt(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dar t.notNull(dy));
55 }
56 squaredDistanceTo(other) {
57 let dx = this.x['-'](other.x);
58 let dy = this.y['-'](other.y);
59 return dart.as(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dart.notNull(dy), T);
60 }
61 }
62 return Point;
63 });
64 let Point = Point$(dart.dynamic);
65 class Random extends core.Object {
66 Random(seed) {
67 if (seed === void 0)
68 seed = null;
69 return seed === null ? new _JSRandom() : new _Random(seed);
70 }
71 }
72 let _RectangleBase$ = dart.generic(function(T) {
73 class _RectangleBase extends core.Object {
74 _RectangleBase() {
75 }
76 get right() {
77 return dart.as(this.left['+'](this.width), T);
78 }
79 get bottom() {
80 return dart.as(this.top['+'](this.height), T);
81 }
82 toString() {
83 return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.hei ght}`;
84 }
85 ['=='](other) {
86 if (!dart.is(other, Rectangle))
87 return false;
88 return dart.notNull(dart.equals(this.left, dart.dload(other, 'left'))) & & dart.notNull(dart.equals(this.top, dart.dload(other, 'top'))) && dart.notNull( dart.equals(this.right, dart.dload(other, 'right'))) && dart.notNull(dart.equals (this.bottom, dart.dload(other, 'bottom')));
89 }
90 get hashCode() {
91 return _JenkinsSmiHash.hash4(this.left.hashCode, this.top.hashCode, this .right.hashCode, this.bottom.hashCode);
92 }
93 intersection(other) {
94 let x0 = max(this.left, other.left);
95 let x1 = min(this.left['+'](this.width), other.left['+'](other.width));
96 if (dart.notNull(x0) <= dart.notNull(x1)) {
97 let y0 = max(this.top, other.top);
98 let y1 = min(this.top['+'](this.height), other.top['+'](other.height)) ;
99 if (dart.notNull(y0) <= dart.notNull(y1)) {
100 return new Rectangle(dart.as(x0, T), dart.as(y0, T), dart.as(dart.no tNull(x1) - dart.notNull(x0), T), dart.as(dart.notNull(y1) - dart.notNull(y0), T ));
101 }
102 }
103 return null;
104 }
105 intersects(other) {
106 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));
107 }
108 boundingBox(other) {
109 let right = max(this.left['+'](this.width), other.left['+'](other.width) );
110 let bottom = max(this.top['+'](this.height), other.top['+'](other.height ));
111 let left = min(this.left, other.left);
112 let top = min(this.top, other.top);
113 return new Rectangle(dart.as(left, T), dart.as(top, T), dart.as(dart.not Null(right) - dart.notNull(left), T), dart.as(dart.notNull(bottom) - dart.notNul l(top), T));
114 }
115 containsRectangle(another) {
116 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);
117 }
118 containsPoint(another) {
119 return core.num['>='](another.x, this.left) && dart.notNull(another.x) < = dart.notNull(this.left['+'](this.width)) && core.num['>='](another.y, this.top ) && dart.notNull(another.y) <= dart.notNull(this.top['+'](this.height));
120 }
121 get topLeft() {
122 return new Point(this.left, this.top);
123 }
124 get topRight() {
125 return new Point(dart.as(this.left['+'](this.width), T), this.top);
126 }
127 get bottomRight() {
128 return new Point(dart.as(this.left['+'](this.width), T), dart.as(this.to p['+'](this.height), T));
129 }
130 get bottomLeft() {
131 return new Point(this.left, dart.as(this.top['+'](this.height), T));
132 }
133 }
134 return _RectangleBase;
135 });
136 let _RectangleBase = _RectangleBase$(dart.dynamic);
137 let Rectangle$ = dart.generic(function(T) {
138 class Rectangle extends _RectangleBase$(T) {
139 Rectangle(left, top, width, height) {
140 this.left = left;
141 this.top = top;
142 this.width = dart.as(width['<'](0) ? dart.notNull(width['unary-']()) * 0 : width, T);
143 this.height = dart.as(height['<'](0) ? dart.notNull(height['unary-']()) * 0 : height, T);
144 super._RectangleBase();
145 }
146 Rectangle$fromPoints(a, b) {
147 let left = dart.as(min(a.x, b.x), T);
148 let width = dart.as(core.num['-'](max(a.x, b.x), left), T);
149 let top = dart.as(min(a.y, b.y), T);
150 let height = dart.as(core.num['-'](max(a.y, b.y), top), T);
151 return new Rectangle(left, top, width, height);
152 }
153 }
154 dart.defineNamedConstructor(Rectangle, 'fromPoints');
155 return Rectangle;
156 });
157 let Rectangle = Rectangle$(dart.dynamic);
158 let _width = Symbol('_width');
159 let _height = Symbol('_height');
160 let MutableRectangle$ = dart.generic(function(T) {
161 class MutableRectangle extends _RectangleBase$(T) {
162 MutableRectangle(left, top, width, height) {
163 this.left = left;
164 this.top = top;
165 this[_width] = dart.as(width['<'](0) ? _clampToZero(width) : width, T);
166 this[_height] = dart.as(height['<'](0) ? _clampToZero(height) : height, T);
167 super._RectangleBase();
168 }
169 MutableRectangle$fromPoints(a, b) {
170 let left = dart.as(min(a.x, b.x), T);
171 let width = dart.as(core.num['-'](max(a.x, b.x), left), T);
172 let top = dart.as(min(a.y, b.y), T);
173 let height = dart.as(core.num['-'](max(a.y, b.y), top), T);
174 return new MutableRectangle(left, top, width, height);
175 }
176 get width() {
177 return this[_width];
178 }
179 set width(width) {
180 if (width['<'](0))
181 width = dart.as(_clampToZero(width), T);
182 this[_width] = width;
183 }
184 get height() {
185 return this[_height];
186 }
187 set height(height) {
188 if (height['<'](0))
189 height = dart.as(_clampToZero(height), T);
190 this[_height] = height;
191 }
192 }
193 dart.defineNamedConstructor(MutableRectangle, 'fromPoints');
194 return MutableRectangle;
195 });
196 let MutableRectangle = MutableRectangle$(dart.dynamic);
197 // Function _clampToZero: (num) → num
198 function _clampToZero(value) {
199 dart.assert(dart.notNull(value) < 0);
200 return -dart.notNull(value) * 0;
201 }
4 let E = 2.718281828459045; 202 let E = 2.718281828459045;
5 let LN10 = 2.302585092994046; 203 let LN10 = 2.302585092994046;
6 let LN2 = 0.6931471805599453; 204 let LN2 = 0.6931471805599453;
7 let LOG2E = 1.4426950408889634; 205 let LOG2E = 1.4426950408889634;
8 let LOG10E = 0.4342944819032518; 206 let LOG10E = 0.4342944819032518;
9 let PI = 3.141592653589793; 207 let PI = 3.141592653589793;
10 let SQRT1_2 = 0.7071067811865476; 208 let SQRT1_2 = 0.7071067811865476;
11 let SQRT2 = 1.4142135623730951; 209 let SQRT2 = 1.4142135623730951;
12 // Function min: (num, num) → num 210 // Function min: (num, num) → num
13 function min(a, b) { 211 function min(a, b) {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 } 293 }
96 // Function exp: (num) → double 294 // Function exp: (num) → double
97 function exp(x) { 295 function exp(x) {
98 return Math.exp(_js_helper.checkNum(x)); 296 return Math.exp(_js_helper.checkNum(x));
99 } 297 }
100 // Function log: (num) → double 298 // Function log: (num) → double
101 function log(x) { 299 function log(x) {
102 return Math.log(_js_helper.checkNum(x)); 300 return Math.log(_js_helper.checkNum(x));
103 } 301 }
104 let _POW2_32 = 4294967296; 302 let _POW2_32 = 4294967296;
105 class _JSRandom extends dart.Object { 303 class _JSRandom extends core.Object {
106 _JSRandom() { 304 _JSRandom() {
107 } 305 }
108 nextInt(max) { 306 nextInt(max) {
109 if (dart.notNull(max) <= 0 || dart.notNull(max) > dart.notNull(_POW2_32)) { 307 if (dart.notNull(max) <= 0 || dart.notNull(max) > dart.notNull(_POW2_32)) {
110 throw new core.RangeError(`max must be in range 0 < max ≤ 2^32, was ${ma x}`); 308 throw new core.RangeError(`max must be in range 0 < max ≤ 2^32, was ${ma x}`);
111 } 309 }
112 return Math.random() * max >>> 0; 310 return Math.random() * max >>> 0;
113 } 311 }
114 nextDouble() { 312 nextDouble() {
115 return Math.random(); 313 return Math.random();
116 } 314 }
117 nextBool() { 315 nextBool() {
118 return Math.random() < 0.5; 316 return Math.random() < 0.5;
119 } 317 }
120 } 318 }
121 let _lo = Symbol('_lo'); 319 let _lo = Symbol('_lo');
122 let _hi = Symbol('_hi'); 320 let _hi = Symbol('_hi');
123 let _nextState = Symbol('_nextState'); 321 let _nextState = Symbol('_nextState');
124 class _Random extends dart.Object { 322 class _Random extends core.Object {
125 _Random(seed) { 323 _Random(seed) {
126 this[_lo] = 0; 324 this[_lo] = 0;
127 this[_hi] = 0; 325 this[_hi] = 0;
128 let empty_seed = 0; 326 let empty_seed = 0;
129 if (dart.notNull(seed) < 0) { 327 if (dart.notNull(seed) < 0) {
130 empty_seed = -1; 328 empty_seed = -1;
131 } 329 }
132 do { 330 do {
133 let low = dart.notNull(seed) & dart.notNull(_MASK32); 331 let low = dart.notNull(seed) & dart.notNull(_Random._MASK32);
134 seed = ((dart.notNull(seed) - dart.notNull(low)) / dart.notNull(_POW2_32 )).truncate(); 332 seed = ((dart.notNull(seed) - dart.notNull(low)) / dart.notNull(_POW2_32 )).truncate();
135 let high = dart.notNull(seed) & dart.notNull(_MASK32); 333 let high = dart.notNull(seed) & dart.notNull(_Random._MASK32);
136 seed = ((dart.notNull(seed) - dart.notNull(high)) / dart.notNull(_POW2_3 2)).truncate(); 334 seed = ((dart.notNull(seed) - dart.notNull(high)) / dart.notNull(_POW2_3 2)).truncate();
137 let tmplow = dart.notNull(low) << 21; 335 let tmplow = dart.notNull(low) << 21;
138 let tmphigh = dart.notNull(high) << 21 | dart.notNull(low) >> 11; 336 let tmphigh = dart.notNull(high) << 21 | dart.notNull(low) >> 11;
139 tmplow = (~dart.notNull(low) & dart.notNull(_MASK32)) + dart.notNull(tmp low); 337 tmplow = (~dart.notNull(low) & dart.notNull(_Random._MASK32)) + dart.not Null(tmplow);
140 low = dart.notNull(tmplow) & dart.notNull(_MASK32); 338 low = dart.notNull(tmplow) & dart.notNull(_Random._MASK32);
141 high = ~dart.notNull(high) + dart.notNull(tmphigh) + ((dart.notNull(tmpl ow) - dart.notNull(low)) / 4294967296).truncate() & dart.notNull(_MASK32); 339 high = ~dart.notNull(high) + dart.notNull(tmphigh) + ((dart.notNull(tmpl ow) - dart.notNull(low)) / 4294967296).truncate() & dart.notNull(_Random._MASK32 );
142 tmphigh = dart.notNull(high) >> 24; 340 tmphigh = dart.notNull(high) >> 24;
143 tmplow = dart.notNull(low) >> 24 | dart.notNull(high) << 8; 341 tmplow = dart.notNull(low) >> 24 | dart.notNull(high) << 8;
144 low = tmplow; 342 low = tmplow;
145 high = tmphigh; 343 high = tmphigh;
146 tmplow = dart.notNull(low) * 265; 344 tmplow = dart.notNull(low) * 265;
147 low = dart.notNull(tmplow) & dart.notNull(_MASK32); 345 low = dart.notNull(tmplow) & dart.notNull(_Random._MASK32);
148 high = dart.notNull(high) * 265 + ((dart.notNull(tmplow) - dart.notNull( low)) / 4294967296).truncate() & dart.notNull(_MASK32); 346 high = dart.notNull(high) * 265 + ((dart.notNull(tmplow) - dart.notNull( low)) / 4294967296).truncate() & dart.notNull(_Random._MASK32);
149 tmphigh = dart.notNull(high) >> 14; 347 tmphigh = dart.notNull(high) >> 14;
150 tmplow = dart.notNull(low) >> 14 | dart.notNull(high) << 18; 348 tmplow = dart.notNull(low) >> 14 | dart.notNull(high) << 18;
151 low = tmplow; 349 low = tmplow;
152 high = tmphigh; 350 high = tmphigh;
153 tmplow = dart.notNull(low) * 21; 351 tmplow = dart.notNull(low) * 21;
154 low = dart.notNull(tmplow) & dart.notNull(_MASK32); 352 low = dart.notNull(tmplow) & dart.notNull(_Random._MASK32);
155 high = dart.notNull(high) * 21 + ((dart.notNull(tmplow) - dart.notNull(l ow)) / 4294967296).truncate() & dart.notNull(_MASK32); 353 high = dart.notNull(high) * 21 + ((dart.notNull(tmplow) - dart.notNull(l ow)) / 4294967296).truncate() & dart.notNull(_Random._MASK32);
156 tmphigh = dart.notNull(high) >> 28; 354 tmphigh = dart.notNull(high) >> 28;
157 tmplow = dart.notNull(low) >> 28 | dart.notNull(high) << 4; 355 tmplow = dart.notNull(low) >> 28 | dart.notNull(high) << 4;
158 low = tmplow; 356 low = tmplow;
159 high = tmphigh; 357 high = tmphigh;
160 tmplow = dart.notNull(low) << 31; 358 tmplow = dart.notNull(low) << 31;
161 tmphigh = dart.notNull(high) << 31 | dart.notNull(low) >> 1; 359 tmphigh = dart.notNull(high) << 31 | dart.notNull(low) >> 1;
162 tmplow = low; 360 tmplow = low;
163 low = dart.notNull(tmplow) & dart.notNull(_MASK32); 361 low = dart.notNull(tmplow) & dart.notNull(_Random._MASK32);
164 high = dart.notNull(high) + dart.notNull(tmphigh) + ((dart.notNull(tmplo w) - dart.notNull(low)) / 4294967296).truncate() & dart.notNull(_MASK32); 362 high = dart.notNull(high) + dart.notNull(tmphigh) + ((dart.notNull(tmplo w) - dart.notNull(low)) / 4294967296).truncate() & dart.notNull(_Random._MASK32) ;
165 tmplow = dart.notNull(this[_lo]) * 1037; 363 tmplow = dart.notNull(this[_lo]) * 1037;
166 this[_lo] = dart.notNull(tmplow) & dart.notNull(_MASK32); 364 this[_lo] = dart.notNull(tmplow) & dart.notNull(_Random._MASK32);
167 this[_hi] = dart.notNull(this[_hi]) * 1037 + ((dart.notNull(tmplow) - da rt.notNull(this[_lo])) / 4294967296).truncate() & dart.notNull(_MASK32); 365 this[_hi] = dart.notNull(this[_hi]) * 1037 + ((dart.notNull(tmplow) - da rt.notNull(this[_lo])) / 4294967296).truncate() & dart.notNull(_Random._MASK32);
168 this[_lo] = low; 366 this[_lo] = low;
169 this[_hi] = high; 367 this[_hi] = high;
170 } while (seed !== empty_seed); 368 } while (seed !== empty_seed);
171 if (this[_hi] === 0 && this[_lo] === 0) { 369 if (this[_hi] === 0 && this[_lo] === 0) {
172 this[_lo] = 23063; 370 this[_lo] = 23063;
173 } 371 }
174 this[_nextState](); 372 this[_nextState]();
175 this[_nextState](); 373 this[_nextState]();
176 this[_nextState](); 374 this[_nextState]();
177 this[_nextState](); 375 this[_nextState]();
178 } 376 }
179 [_nextState]() { 377 [_nextState]() {
180 let tmpHi = 4294901760 * dart.notNull(this[_lo]); 378 let tmpHi = 4294901760 * dart.notNull(this[_lo]);
181 let tmpHiLo = dart.notNull(tmpHi) & dart.notNull(_MASK32); 379 let tmpHiLo = dart.notNull(tmpHi) & dart.notNull(_Random._MASK32);
182 let tmpHiHi = dart.notNull(tmpHi) - dart.notNull(tmpHiLo); 380 let tmpHiHi = dart.notNull(tmpHi) - dart.notNull(tmpHiLo);
183 let tmpLo = 55905 * dart.notNull(this[_lo]); 381 let tmpLo = 55905 * dart.notNull(this[_lo]);
184 let tmpLoLo = dart.notNull(tmpLo) & dart.notNull(_MASK32); 382 let tmpLoLo = dart.notNull(tmpLo) & dart.notNull(_Random._MASK32);
185 let tmpLoHi = dart.notNull(tmpLo) - dart.notNull(tmpLoLo); 383 let tmpLoHi = dart.notNull(tmpLo) - dart.notNull(tmpLoLo);
186 let newLo = dart.notNull(tmpLoLo) + dart.notNull(tmpHiLo) + dart.notNull(t his[_hi]); 384 let newLo = dart.notNull(tmpLoLo) + dart.notNull(tmpHiLo) + dart.notNull(t his[_hi]);
187 this[_lo] = dart.notNull(newLo) & dart.notNull(_MASK32); 385 this[_lo] = dart.notNull(newLo) & dart.notNull(_Random._MASK32);
188 let newLoHi = dart.notNull(newLo) - dart.notNull(this[_lo]); 386 let newLoHi = dart.notNull(newLo) - dart.notNull(this[_lo]);
189 this[_hi] = ((dart.notNull(tmpLoHi) + dart.notNull(tmpHiHi) + dart.notNull (newLoHi)) / dart.notNull(_POW2_32)).truncate() & dart.notNull(_MASK32); 387 this[_hi] = ((dart.notNull(tmpLoHi) + dart.notNull(tmpHiHi) + dart.notNull (newLoHi)) / dart.notNull(_POW2_32)).truncate() & dart.notNull(_Random._MASK32);
190 dart.assert(dart.notNull(this[_lo]) < dart.notNull(_POW2_32)); 388 dart.assert(dart.notNull(this[_lo]) < dart.notNull(_POW2_32));
191 dart.assert(dart.notNull(this[_hi]) < dart.notNull(_POW2_32)); 389 dart.assert(dart.notNull(this[_hi]) < dart.notNull(_POW2_32));
192 } 390 }
193 nextInt(max) { 391 nextInt(max) {
194 if (dart.notNull(max) <= 0 || dart.notNull(max) > dart.notNull(_POW2_32)) { 392 if (dart.notNull(max) <= 0 || dart.notNull(max) > dart.notNull(_POW2_32)) {
195 throw new core.RangeError(`max must be in range 0 < max ≤ 2^32, was ${ma x}`); 393 throw new core.RangeError(`max must be in range 0 < max ≤ 2^32, was ${ma x}`);
196 } 394 }
197 if ((dart.notNull(max) & dart.notNull(max) - 1) === 0) { 395 if ((dart.notNull(max) & dart.notNull(max) - 1) === 0) {
198 this[_nextState](); 396 this[_nextState]();
199 return dart.notNull(this[_lo]) & dart.notNull(max) - 1; 397 return dart.notNull(this[_lo]) & dart.notNull(max) - 1;
200 } 398 }
201 let rnd32 = null; 399 let rnd32 = null;
202 let result = null; 400 let result = null;
203 do { 401 do {
204 this[_nextState](); 402 this[_nextState]();
205 rnd32 = this[_lo]; 403 rnd32 = this[_lo];
206 result = rnd32.remainder(max); 404 result = rnd32.remainder(max);
207 } while (dart.notNull(rnd32) - dart.notNull(result) + dart.notNull(max) >= dart.notNull(_POW2_32)); 405 } while (dart.notNull(rnd32) - dart.notNull(result) + dart.notNull(max) >= dart.notNull(_POW2_32));
208 return result; 406 return result;
209 } 407 }
210 nextDouble() { 408 nextDouble() {
211 this[_nextState](); 409 this[_nextState]();
212 let bits26 = dart.notNull(this[_lo]) & (1 << 26) - 1; 410 let bits26 = dart.notNull(this[_lo]) & (1 << 26) - 1;
213 this[_nextState](); 411 this[_nextState]();
214 let bits27 = dart.notNull(this[_lo]) & (1 << 27) - 1; 412 let bits27 = dart.notNull(this[_lo]) & (1 << 27) - 1;
215 return (dart.notNull(bits26) * dart.notNull(_POW2_27_D) + dart.notNull(bit s27)) / dart.notNull(_POW2_53_D); 413 return (dart.notNull(bits26) * dart.notNull(_Random._POW2_27_D) + dart.not Null(bits27)) / dart.notNull(_Random._POW2_53_D);
216 } 414 }
217 nextBool() { 415 nextBool() {
218 this[_nextState](); 416 this[_nextState]();
219 return (dart.notNull(this[_lo]) & 1) === 0; 417 return (dart.notNull(this[_lo]) & 1) === 0;
220 } 418 }
221 } 419 }
222 _Random._POW2_53_D = 1.0 * 9007199254740992; 420 _Random._POW2_53_D = 1.0 * 9007199254740992;
223 _Random._POW2_27_D = 1.0 * (1 << 27); 421 _Random._POW2_27_D = 1.0 * (1 << 27);
224 _Random._MASK32 = 4294967295; 422 _Random._MASK32 = 4294967295;
225 class _JenkinsSmiHash extends dart.Object {
226 static combine(hash, value) {
227 hash = 536870911 & dart.notNull(hash) + dart.notNull(value);
228 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) << 10);
229 return dart.notNull(hash) ^ dart.notNull(hash) >> 6;
230 }
231 static finish(hash) {
232 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) < < 3);
233 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 11;
234 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1 5);
235 }
236 static hash2(a, b) {
237 return finish(combine(combine(0, dart.as(a, core.int)), dart.as(b, core.in t)));
238 }
239 static hash4(a, b, c, d) {
240 return finish(combine(combine(combine(combine(0, dart.as(a, core.int)), da rt.as(b, core.int)), dart.as(c, core.int)), dart.as(d, core.int)));
241 }
242 }
243 let Point$ = dart.generic(function(T) {
244 class Point extends dart.Object {
245 Point(x, y) {
246 this.x = x;
247 this.y = y;
248 }
249 toString() {
250 return `Point(${this.x}, ${this.y})`;
251 }
252 ['=='](other) {
253 if (!dart.is(other, Point))
254 return false;
255 return dart.notNull(dart.equals(this.x, dart.dload(other, 'x'))) && dart .notNull(dart.equals(this.y, dart.dload(other, 'y')));
256 }
257 get hashCode() {
258 return _JenkinsSmiHash.hash2(this.x.hashCode, this.y.hashCode);
259 }
260 ['+'](other) {
261 return new Point(dart.as(this.x['+'](other.x), T), dart.as(this.y['+'](o ther.y), T));
262 }
263 ['-'](other) {
264 return new Point(dart.as(this.x['-'](other.x), T), dart.as(this.y['-'](o ther.y), T));
265 }
266 ['*'](factor) {
267 return new Point(dart.as(this.x['*'](factor), T), dart.as(this.y['*'](fa ctor), T));
268 }
269 get magnitude() {
270 return sqrt(dart.notNull(this.x['*'](this.x)) + dart.notNull(this.y['*'] (this.y)));
271 }
272 distanceTo(other) {
273 let dx = this.x['-'](other.x);
274 let dy = this.y['-'](other.y);
275 return sqrt(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dar t.notNull(dy));
276 }
277 squaredDistanceTo(other) {
278 let dx = this.x['-'](other.x);
279 let dy = this.y['-'](other.y);
280 return dart.as(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dart.notNull(dy), T);
281 }
282 }
283 return Point;
284 });
285 let Point = Point$(dynamic);
286 class Random extends dart.Object {
287 Random(seed) {
288 if (seed === void 0)
289 seed = null;
290 return seed === null ? new _JSRandom() : new _Random(seed);
291 }
292 }
293 let _RectangleBase$ = dart.generic(function(T) {
294 class _RectangleBase extends dart.Object {
295 _RectangleBase() {
296 }
297 get right() {
298 return dart.as(this.left['+'](this.width), T);
299 }
300 get bottom() {
301 return dart.as(this.top['+'](this.height), T);
302 }
303 toString() {
304 return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.hei ght}`;
305 }
306 ['=='](other) {
307 if (!dart.is(other, Rectangle))
308 return false;
309 return dart.notNull(dart.equals(this.left, dart.dload(other, 'left'))) & & dart.notNull(dart.equals(this.top, dart.dload(other, 'top'))) && dart.notNull( dart.equals(this.right, dart.dload(other, 'right'))) && dart.notNull(dart.equals (this.bottom, dart.dload(other, 'bottom')));
310 }
311 get hashCode() {
312 return _JenkinsSmiHash.hash4(this.left.hashCode, this.top.hashCode, this .right.hashCode, this.bottom.hashCode);
313 }
314 intersection(other) {
315 let x0 = max(this.left, other.left);
316 let x1 = min(this.left['+'](this.width), other.left['+'](other.width));
317 if (dart.notNull(x0) <= dart.notNull(x1)) {
318 let y0 = max(this.top, other.top);
319 let y1 = min(this.top['+'](this.height), other.top['+'](other.height)) ;
320 if (dart.notNull(y0) <= dart.notNull(y1)) {
321 return new Rectangle(dart.as(x0, T), dart.as(y0, T), dart.as(dart.no tNull(x1) - dart.notNull(x0), T), dart.as(dart.notNull(y1) - dart.notNull(y0), T ));
322 }
323 }
324 return null;
325 }
326 intersects(other) {
327 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));
328 }
329 boundingBox(other) {
330 let right = max(this.left['+'](this.width), other.left['+'](other.width) );
331 let bottom = max(this.top['+'](this.height), other.top['+'](other.height ));
332 let left = min(this.left, other.left);
333 let top = min(this.top, other.top);
334 return new Rectangle(dart.as(left, T), dart.as(top, T), dart.as(dart.not Null(right) - dart.notNull(left), T), dart.as(dart.notNull(bottom) - dart.notNul l(top), T));
335 }
336 containsRectangle(another) {
337 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);
338 }
339 containsPoint(another) {
340 return core.num['>='](another.x, this.left) && dart.notNull(another.x) < = dart.notNull(this.left['+'](this.width)) && core.num['>='](another.y, this.top ) && dart.notNull(another.y) <= dart.notNull(this.top['+'](this.height));
341 }
342 get topLeft() {
343 return new Point(this.left, this.top);
344 }
345 get topRight() {
346 return new Point(dart.as(this.left['+'](this.width), T), this.top);
347 }
348 get bottomRight() {
349 return new Point(dart.as(this.left['+'](this.width), T), dart.as(this.to p['+'](this.height), T));
350 }
351 get bottomLeft() {
352 return new Point(this.left, dart.as(this.top['+'](this.height), T));
353 }
354 }
355 return _RectangleBase;
356 });
357 let _RectangleBase = _RectangleBase$(dynamic);
358 let Rectangle$ = dart.generic(function(T) {
359 class Rectangle extends _RectangleBase$(T) {
360 Rectangle(left, top, width, height) {
361 this.left = left;
362 this.top = top;
363 this.width = dart.as(width['<'](0) ? dart.notNull(width['unary-']()) * 0 : width, T);
364 this.height = dart.as(height['<'](0) ? dart.notNull(height['unary-']()) * 0 : height, T);
365 super._RectangleBase();
366 }
367 Rectangle$fromPoints(a, b) {
368 let left = dart.as(min(a.x, b.x), T);
369 let width = dart.as(core.num['-'](max(a.x, b.x), left), T);
370 let top = dart.as(min(a.y, b.y), T);
371 let height = dart.as(core.num['-'](max(a.y, b.y), top), T);
372 return new Rectangle(left, top, width, height);
373 }
374 }
375 dart.defineNamedConstructor(Rectangle, 'fromPoints');
376 return Rectangle;
377 });
378 let Rectangle = Rectangle$(dynamic);
379 let _width = Symbol('_width');
380 let _height = Symbol('_height');
381 let MutableRectangle$ = dart.generic(function(T) {
382 class MutableRectangle extends _RectangleBase$(T) {
383 MutableRectangle(left, top, width, height) {
384 this.left = left;
385 this.top = top;
386 this[_width] = dart.as(width['<'](0) ? _clampToZero(width) : width, T);
387 this[_height] = dart.as(height['<'](0) ? _clampToZero(height) : height, T);
388 super._RectangleBase();
389 }
390 MutableRectangle$fromPoints(a, b) {
391 let left = dart.as(min(a.x, b.x), T);
392 let width = dart.as(core.num['-'](max(a.x, b.x), left), T);
393 let top = dart.as(min(a.y, b.y), T);
394 let height = dart.as(core.num['-'](max(a.y, b.y), top), T);
395 return new MutableRectangle(left, top, width, height);
396 }
397 get width() {
398 return this[_width];
399 }
400 set width(width) {
401 if (width['<'](0))
402 width = dart.as(_clampToZero(width), T);
403 this[_width] = width;
404 }
405 get height() {
406 return this[_height];
407 }
408 set height(height) {
409 if (height['<'](0))
410 height = dart.as(_clampToZero(height), T);
411 this[_height] = height;
412 }
413 }
414 dart.defineNamedConstructor(MutableRectangle, 'fromPoints');
415 return MutableRectangle;
416 });
417 let MutableRectangle = MutableRectangle$(dynamic);
418 // Function _clampToZero: (num) → num
419 function _clampToZero(value) {
420 dart.assert(dart.notNull(value) < 0);
421 return -dart.notNull(value) * 0;
422 }
423 // Exports: 423 // Exports:
424 exports.Point = Point;
425 exports.Point$ = Point$;
426 exports.Random = Random;
427 exports.Rectangle = Rectangle;
428 exports.Rectangle$ = Rectangle$;
429 exports.MutableRectangle = MutableRectangle;
430 exports.MutableRectangle$ = MutableRectangle$;
424 exports.E = E; 431 exports.E = E;
425 exports.LN10 = LN10; 432 exports.LN10 = LN10;
426 exports.LN2 = LN2; 433 exports.LN2 = LN2;
427 exports.LOG2E = LOG2E; 434 exports.LOG2E = LOG2E;
428 exports.LOG10E = LOG10E; 435 exports.LOG10E = LOG10E;
429 exports.PI = PI; 436 exports.PI = PI;
430 exports.SQRT1_2 = SQRT1_2; 437 exports.SQRT1_2 = SQRT1_2;
431 exports.SQRT2 = SQRT2; 438 exports.SQRT2 = SQRT2;
432 exports.min = min; 439 exports.min = min;
433 exports.max = max; 440 exports.max = max;
434 exports.atan2 = atan2; 441 exports.atan2 = atan2;
435 exports.pow = pow; 442 exports.pow = pow;
436 exports.sin = sin; 443 exports.sin = sin;
437 exports.cos = cos; 444 exports.cos = cos;
438 exports.tan = tan; 445 exports.tan = tan;
439 exports.acos = acos; 446 exports.acos = acos;
440 exports.asin = asin; 447 exports.asin = asin;
441 exports.atan = atan; 448 exports.atan = atan;
442 exports.sqrt = sqrt; 449 exports.sqrt = sqrt;
443 exports.exp = exp; 450 exports.exp = exp;
444 exports.log = log; 451 exports.log = log;
445 exports.Point = Point;
446 exports.Point$ = Point$;
447 exports.Random = Random;
448 exports.Rectangle = Rectangle;
449 exports.Rectangle$ = Rectangle$;
450 exports.MutableRectangle = MutableRectangle;
451 exports.MutableRectangle$ = MutableRectangle$;
452 })(math || (math = {})); 452 })(math || (math = {}));
OLDNEW
« no previous file with comments | « test/codegen/expect/dart/isolate.js ('k') | test/codegen/expect/dart/typed_data.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698