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

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

Issue 977613002: Make int and double nullable by default (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: actually upload changes 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
OLDNEW
1 var math; 1 var math;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 let E = 2.718281828459045; 4 let E = 2.718281828459045;
5 let LN10 = 2.302585092994046; 5 let LN10 = 2.302585092994046;
6 let LN2 = 0.6931471805599453; 6 let LN2 = 0.6931471805599453;
7 let LOG2E = 1.4426950408889634; 7 let LOG2E = 1.4426950408889634;
8 let LOG10E = 0.4342944819032518; 8 let LOG10E = 0.4342944819032518;
9 let PI = 3.141592653589793; 9 let PI = 3.141592653589793;
10 let SQRT1_2 = 0.7071067811865476; 10 let SQRT1_2 = 0.7071067811865476;
11 let SQRT2 = 1.4142135623730951; 11 let SQRT2 = 1.4142135623730951;
12 // Function min: (num, num) → num 12 // Function min: (num, num) → num
13 function min(a, b) { 13 function min(a, b) {
14 if (!dart.is(a, core.num)) 14 if (!dart.is(a, core.num))
15 throw new core.ArgumentError(a); 15 throw new core.ArgumentError(a);
16 if (!dart.is(b, core.num)) 16 if (!dart.is(b, core.num))
17 throw new core.ArgumentError(b); 17 throw new core.ArgumentError(b);
18 if (dart.notNull(a) > dart.notNull(b)) 18 if (dart.notNull(a) > dart.notNull(b))
19 return b; 19 return b;
20 if (dart.notNull(a) < dart.notNull(b)) 20 if (dart.notNull(a) < dart.notNull(b))
21 return a; 21 return a;
22 if (typeof b == number) { 22 if (typeof b == number) {
23 if (typeof a == number) { 23 if (typeof a == number) {
24 if (a === 0.0) { 24 if (a === 0.0) {
25 return (a + b) * a * b; 25 return (dart.notNull(a) + dart.notNull(b)) * dart.notNull(a) * dart.no tNull(b);
26 } 26 }
27 } 27 }
28 if (dart.notNull(dart.notNull(a === 0) && dart.notNull(b.isNegative)) || d art.notNull(b.isNaN)) 28 if (a === 0 && dart.notNull(b.isNegative) || dart.notNull(b.isNaN))
29 return b; 29 return b;
30 return a; 30 return a;
31 } 31 }
32 return a; 32 return a;
33 } 33 }
34 // Function max: (num, num) → num 34 // Function max: (num, num) → num
35 function max(a, b) { 35 function max(a, b) {
36 if (!dart.is(a, core.num)) 36 if (!dart.is(a, core.num))
37 throw new core.ArgumentError(a); 37 throw new core.ArgumentError(a);
38 if (!dart.is(b, core.num)) 38 if (!dart.is(b, core.num))
39 throw new core.ArgumentError(b); 39 throw new core.ArgumentError(b);
40 if (dart.notNull(a) > dart.notNull(b)) 40 if (dart.notNull(a) > dart.notNull(b))
41 return a; 41 return a;
42 if (dart.notNull(a) < dart.notNull(b)) 42 if (dart.notNull(a) < dart.notNull(b))
43 return b; 43 return b;
44 if (typeof b == number) { 44 if (typeof b == number) {
45 if (typeof a == number) { 45 if (typeof a == number) {
46 if (a === 0.0) { 46 if (a === 0.0) {
47 return a + b; 47 return dart.notNull(a) + dart.notNull(b);
48 } 48 }
49 } 49 }
50 if (b.isNaN) 50 if (b.isNaN)
51 return b; 51 return b;
52 return a; 52 return a;
53 } 53 }
54 if (dart.notNull(b === 0) && dart.notNull(a.isNegative)) 54 if (b === 0 && dart.notNull(a.isNegative))
55 return b; 55 return b;
56 return a; 56 return a;
57 } 57 }
58 // Function atan2: (num, num) → double 58 // Function atan2: (num, num) → double
59 function atan2(a, b) { 59 function atan2(a, b) {
60 return Math.atan2(_js_helper.checkNum(a), _js_helper.checkNum(b)); 60 return Math.atan2(_js_helper.checkNum(a), _js_helper.checkNum(b));
61 } 61 }
62 // Function pow: (num, num) → num 62 // Function pow: (num, num) → num
63 function pow(x, exponent) { 63 function pow(x, exponent) {
64 _js_helper.checkNum(x); 64 _js_helper.checkNum(x);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 99 }
100 // Function log: (num) → double 100 // Function log: (num) → double
101 function log(x) { 101 function log(x) {
102 return Math.log(_js_helper.checkNum(x)); 102 return Math.log(_js_helper.checkNum(x));
103 } 103 }
104 let _POW2_32 = 4294967296; 104 let _POW2_32 = 4294967296;
105 class _JSRandom extends dart.Object { 105 class _JSRandom extends dart.Object {
106 _JSRandom() { 106 _JSRandom() {
107 } 107 }
108 nextInt(max) { 108 nextInt(max) {
109 if (dart.notNull(max <= 0) || dart.notNull(max > _POW2_32)) { 109 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}`); 110 throw new core.RangeError(`max must be in range 0 < max ≤ 2^32, was ${ma x}`);
111 } 111 }
112 return Math.random() * max >>> 0; 112 return Math.random() * max >>> 0;
113 } 113 }
114 nextDouble() { 114 nextDouble() {
115 return Math.random(); 115 return Math.random();
116 } 116 }
117 nextBool() { 117 nextBool() {
118 return Math.random() < 0.5; 118 return Math.random() < 0.5;
119 } 119 }
120 } 120 }
121 let _lo = Symbol('_lo'); 121 let _lo = Symbol('_lo');
122 let _hi = Symbol('_hi'); 122 let _hi = Symbol('_hi');
123 let _nextState = Symbol('_nextState'); 123 let _nextState = Symbol('_nextState');
124 class _Random extends dart.Object { 124 class _Random extends dart.Object {
125 _Random(seed) { 125 _Random(seed) {
126 this[_lo] = 0; 126 this[_lo] = 0;
127 this[_hi] = 0; 127 this[_hi] = 0;
128 let empty_seed = 0; 128 let empty_seed = 0;
129 if (seed < 0) { 129 if (dart.notNull(seed) < 0) {
130 empty_seed = -1; 130 empty_seed = -1;
131 } 131 }
132 do { 132 do {
133 let low = seed & _MASK32; 133 let low = dart.notNull(seed) & dart.notNull(_MASK32);
134 seed = ((seed - low) / _POW2_32).truncate(); 134 seed = ((dart.notNull(seed) - dart.notNull(low)) / dart.notNull(_POW2_32 )).truncate();
135 let high = seed & _MASK32; 135 let high = dart.notNull(seed) & dart.notNull(_MASK32);
136 seed = ((seed - high) / _POW2_32).truncate(); 136 seed = ((dart.notNull(seed) - dart.notNull(high)) / dart.notNull(_POW2_3 2)).truncate();
137 let tmplow = low << 21; 137 let tmplow = dart.notNull(low) << 21;
138 let tmphigh = high << 21 | low >> 11; 138 let tmphigh = dart.notNull(high) << 21 | dart.notNull(low) >> 11;
139 tmplow = (~low & _MASK32) + tmplow; 139 tmplow = (~dart.notNull(low) & dart.notNull(_MASK32)) + dart.notNull(tmp low);
140 low = tmplow & _MASK32; 140 low = dart.notNull(tmplow) & dart.notNull(_MASK32);
141 high = ~high + tmphigh + ((tmplow - low) / 4294967296).truncate() & _MAS K32; 141 high = ~dart.notNull(high) + dart.notNull(tmphigh) + ((dart.notNull(tmpl ow) - dart.notNull(low)) / 4294967296).truncate() & dart.notNull(_MASK32);
142 tmphigh = high >> 24; 142 tmphigh = dart.notNull(high) >> 24;
143 tmplow = low >> 24 | high << 8; 143 tmplow = dart.notNull(low) >> 24 | dart.notNull(high) << 8;
144 low = tmplow; 144 low = tmplow;
145 high = tmphigh; 145 high = tmphigh;
146 tmplow = low * 265; 146 tmplow = dart.notNull(low) * 265;
147 low = tmplow & _MASK32; 147 low = dart.notNull(tmplow) & dart.notNull(_MASK32);
148 high = high * 265 + ((tmplow - low) / 4294967296).truncate() & _MASK32; 148 high = dart.notNull(high) * 265 + ((dart.notNull(tmplow) - dart.notNull( low)) / 4294967296).truncate() & dart.notNull(_MASK32);
149 tmphigh = high >> 14; 149 tmphigh = dart.notNull(high) >> 14;
150 tmplow = low >> 14 | high << 18; 150 tmplow = dart.notNull(low) >> 14 | dart.notNull(high) << 18;
151 low = tmplow; 151 low = tmplow;
152 high = tmphigh; 152 high = tmphigh;
153 tmplow = low * 21; 153 tmplow = dart.notNull(low) * 21;
154 low = tmplow & _MASK32; 154 low = dart.notNull(tmplow) & dart.notNull(_MASK32);
155 high = high * 21 + ((tmplow - low) / 4294967296).truncate() & _MASK32; 155 high = dart.notNull(high) * 21 + ((dart.notNull(tmplow) - dart.notNull(l ow)) / 4294967296).truncate() & dart.notNull(_MASK32);
156 tmphigh = high >> 28; 156 tmphigh = dart.notNull(high) >> 28;
157 tmplow = low >> 28 | high << 4; 157 tmplow = dart.notNull(low) >> 28 | dart.notNull(high) << 4;
158 low = tmplow; 158 low = tmplow;
159 high = tmphigh; 159 high = tmphigh;
160 tmplow = low << 31; 160 tmplow = dart.notNull(low) << 31;
161 tmphigh = high << 31 | low >> 1; 161 tmphigh = dart.notNull(high) << 31 | dart.notNull(low) >> 1;
162 tmplow = low; 162 tmplow = low;
163 low = tmplow & _MASK32; 163 low = dart.notNull(tmplow) & dart.notNull(_MASK32);
164 high = high + tmphigh + ((tmplow - low) / 4294967296).truncate() & _MASK 32; 164 high = dart.notNull(high) + dart.notNull(tmphigh) + ((dart.notNull(tmplo w) - dart.notNull(low)) / 4294967296).truncate() & dart.notNull(_MASK32);
165 tmplow = this[_lo] * 1037; 165 tmplow = dart.notNull(this[_lo]) * 1037;
166 this[_lo] = tmplow & _MASK32; 166 this[_lo] = dart.notNull(tmplow) & dart.notNull(_MASK32);
167 this[_hi] = this[_hi] * 1037 + ((tmplow - this[_lo]) / 4294967296).trunc ate() & _MASK32; 167 this[_hi] = dart.notNull(this[_hi]) * 1037 + ((dart.notNull(tmplow) - da rt.notNull(this[_lo])) / 4294967296).truncate() & dart.notNull(_MASK32);
168 this[_lo] = low; 168 this[_lo] = low;
169 this[_hi] = high; 169 this[_hi] = high;
170 } while (seed !== empty_seed); 170 } while (seed !== empty_seed);
171 if (dart.notNull(this[_hi] === 0) && dart.notNull(this[_lo] === 0)) { 171 if (this[_hi] === 0 && this[_lo] === 0) {
172 this[_lo] = 23063; 172 this[_lo] = 23063;
173 } 173 }
174 this[_nextState](); 174 this[_nextState]();
175 this[_nextState](); 175 this[_nextState]();
176 this[_nextState](); 176 this[_nextState]();
177 this[_nextState](); 177 this[_nextState]();
178 } 178 }
179 [_nextState]() { 179 [_nextState]() {
180 let tmpHi = 4294901760 * this[_lo]; 180 let tmpHi = 4294901760 * dart.notNull(this[_lo]);
181 let tmpHiLo = tmpHi & _MASK32; 181 let tmpHiLo = dart.notNull(tmpHi) & dart.notNull(_MASK32);
182 let tmpHiHi = tmpHi - tmpHiLo; 182 let tmpHiHi = dart.notNull(tmpHi) - dart.notNull(tmpHiLo);
183 let tmpLo = 55905 * this[_lo]; 183 let tmpLo = 55905 * dart.notNull(this[_lo]);
184 let tmpLoLo = tmpLo & _MASK32; 184 let tmpLoLo = dart.notNull(tmpLo) & dart.notNull(_MASK32);
185 let tmpLoHi = tmpLo - tmpLoLo; 185 let tmpLoHi = dart.notNull(tmpLo) - dart.notNull(tmpLoLo);
186 let newLo = tmpLoLo + tmpHiLo + this[_hi]; 186 let newLo = dart.notNull(tmpLoLo) + dart.notNull(tmpHiLo) + dart.notNull(t his[_hi]);
187 this[_lo] = newLo & _MASK32; 187 this[_lo] = dart.notNull(newLo) & dart.notNull(_MASK32);
188 let newLoHi = newLo - this[_lo]; 188 let newLoHi = dart.notNull(newLo) - dart.notNull(this[_lo]);
189 this[_hi] = ((tmpLoHi + tmpHiHi + newLoHi) / _POW2_32).truncate() & _MASK3 2; 189 this[_hi] = ((dart.notNull(tmpLoHi) + dart.notNull(tmpHiHi) + dart.notNull (newLoHi)) / dart.notNull(_POW2_32)).truncate() & dart.notNull(_MASK32);
190 dart.assert(this[_lo] < _POW2_32); 190 dart.assert(dart.notNull(this[_lo]) < dart.notNull(_POW2_32));
191 dart.assert(this[_hi] < _POW2_32); 191 dart.assert(dart.notNull(this[_hi]) < dart.notNull(_POW2_32));
192 } 192 }
193 nextInt(max) { 193 nextInt(max) {
194 if (dart.notNull(max <= 0) || dart.notNull(max > _POW2_32)) { 194 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}`); 195 throw new core.RangeError(`max must be in range 0 < max ≤ 2^32, was ${ma x}`);
196 } 196 }
197 if ((max & max - 1) === 0) { 197 if ((dart.notNull(max) & dart.notNull(max) - 1) === 0) {
198 this[_nextState](); 198 this[_nextState]();
199 return this[_lo] & max - 1; 199 return dart.notNull(this[_lo]) & dart.notNull(max) - 1;
200 } 200 }
201 let rnd32 = null; 201 let rnd32 = null;
202 let result = null; 202 let result = null;
203 do { 203 do {
204 this[_nextState](); 204 this[_nextState]();
205 rnd32 = this[_lo]; 205 rnd32 = this[_lo];
206 result = dart.notNull(rnd32.remainder(max)); 206 result = rnd32.remainder(max);
207 } while (rnd32 - result + max >= _POW2_32); 207 } while (dart.notNull(rnd32) - dart.notNull(result) + dart.notNull(max) >= dart.notNull(_POW2_32));
208 return result; 208 return result;
209 } 209 }
210 nextDouble() { 210 nextDouble() {
211 this[_nextState](); 211 this[_nextState]();
212 let bits26 = this[_lo] & (1 << 26) - 1; 212 let bits26 = dart.notNull(this[_lo]) & (1 << 26) - 1;
213 this[_nextState](); 213 this[_nextState]();
214 let bits27 = this[_lo] & (1 << 27) - 1; 214 let bits27 = dart.notNull(this[_lo]) & (1 << 27) - 1;
215 return (bits26 * _POW2_27_D + bits27) / _POW2_53_D; 215 return (dart.notNull(bits26) * dart.notNull(_POW2_27_D) + dart.notNull(bit s27)) / dart.notNull(_POW2_53_D);
216 } 216 }
217 nextBool() { 217 nextBool() {
218 this[_nextState](); 218 this[_nextState]();
219 return (this[_lo] & 1) === 0; 219 return (dart.notNull(this[_lo]) & 1) === 0;
220 } 220 }
221 } 221 }
222 _Random._POW2_53_D = 1.0 * 9007199254740992; 222 _Random._POW2_53_D = 1.0 * 9007199254740992;
223 _Random._POW2_27_D = 1.0 * (1 << 27); 223 _Random._POW2_27_D = 1.0 * (1 << 27);
224 _Random._MASK32 = 4294967295; 224 _Random._MASK32 = 4294967295;
225 class _JenkinsSmiHash extends dart.Object { 225 class _JenkinsSmiHash extends dart.Object {
226 static combine(hash, value) { 226 static combine(hash, value) {
227 hash = 536870911 & hash + value; 227 hash = 536870911 & dart.notNull(hash) + dart.notNull(value);
228 hash = 536870911 & hash + ((524287 & hash) << 10); 228 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) << 10);
229 return hash ^ hash >> 6; 229 return dart.notNull(hash) ^ dart.notNull(hash) >> 6;
230 } 230 }
231 static finish(hash) { 231 static finish(hash) {
232 hash = 536870911 & hash + ((67108863 & hash) << 3); 232 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) < < 3);
233 hash = hash ^ hash >> 11; 233 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 11;
234 return 536870911 & hash + ((16383 & hash) << 15); 234 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1 5);
235 } 235 }
236 static hash2(a, b) { 236 static hash2(a, b) {
237 return finish(combine(combine(0, dart.as(a, core.int)), dart.as(b, core.in t))); 237 return finish(combine(combine(0, dart.as(a, core.int)), dart.as(b, core.in t)));
238 } 238 }
239 static hash4(a, b, c, d) { 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))); 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 } 241 }
242 } 242 }
243 let Point$ = dart.generic(function(T) { 243 let Point$ = dart.generic(function(T) {
244 class Point extends dart.Object { 244 class Point extends dart.Object {
(...skipping 20 matching lines...) Expand all
265 } 265 }
266 ['*'](factor) { 266 ['*'](factor) {
267 return new Point(dart.as(this.x['*'](factor), T), dart.as(this.y['*'](fa ctor), T)); 267 return new Point(dart.as(this.x['*'](factor), T), dart.as(this.y['*'](fa ctor), T));
268 } 268 }
269 get magnitude() { 269 get magnitude() {
270 return sqrt(dart.notNull(this.x['*'](this.x)) + dart.notNull(this.y['*'] (this.y))); 270 return sqrt(dart.notNull(this.x['*'](this.x)) + dart.notNull(this.y['*'] (this.y)));
271 } 271 }
272 distanceTo(other) { 272 distanceTo(other) {
273 let dx = this.x['-'](other.x); 273 let dx = this.x['-'](other.x);
274 let dy = this.y['-'](other.y); 274 let dy = this.y['-'](other.y);
275 return sqrt(dart.notNull(dart.notNull(dx) * dart.notNull(dx)) + dart.not Null(dart.notNull(dy) * dart.notNull(dy))); 275 return sqrt(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dar t.notNull(dy));
276 } 276 }
277 squaredDistanceTo(other) { 277 squaredDistanceTo(other) {
278 let dx = this.x['-'](other.x); 278 let dx = this.x['-'](other.x);
279 let dy = this.y['-'](other.y); 279 let dy = this.y['-'](other.y);
280 return dart.as(dart.notNull(dart.notNull(dx) * dart.notNull(dx)) + dart. notNull(dart.notNull(dy) * dart.notNull(dy)), T); 280 return dart.as(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dart.notNull(dy), T);
281 } 281 }
282 } 282 }
283 return Point; 283 return Point;
284 }); 284 });
285 let Point = Point$(dynamic); 285 let Point = Point$(dynamic);
286 class Random extends dart.Object { 286 class Random extends dart.Object {
287 Random(seed) { 287 Random(seed) {
288 if (seed === void 0) 288 if (seed === void 0)
289 seed = null; 289 seed = null;
290 return seed === null ? new _JSRandom() : new _Random(seed); 290 return seed === null ? new _JSRandom() : new _Random(seed);
291 } 291 }
292 } 292 }
293 let _RectangleBase$ = dart.generic(function(T) { 293 let _RectangleBase$ = dart.generic(function(T) {
294 class _RectangleBase extends dart.Object { 294 class _RectangleBase extends dart.Object {
295 _RectangleBase() { 295 _RectangleBase() {
296 } 296 }
297 get right() { 297 get right() {
298 return dart.as(this.left['+'](this.width), T); 298 return dart.as(this.left['+'](this.width), T);
299 } 299 }
300 get bottom() { 300 get bottom() {
301 return dart.as(this.top['+'](this.height), T); 301 return dart.as(this.top['+'](this.height), T);
302 } 302 }
303 toString() { 303 toString() {
304 return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.hei ght}`; 304 return `Rectangle (${this.left}, ${this.top}) ${this.width} x ${this.hei ght}`;
305 } 305 }
306 ['=='](other) { 306 ['=='](other) {
307 if (!dart.is(other, Rectangle)) 307 if (!dart.is(other, Rectangle))
308 return false; 308 return false;
309 return dart.notNull(dart.notNull(dart.notNull(dart.equals(this.left, dar t.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'))); 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 } 310 }
311 get hashCode() { 311 get hashCode() {
312 return _JenkinsSmiHash.hash4(this.left.hashCode, this.top.hashCode, this .right.hashCode, this.bottom.hashCode); 312 return _JenkinsSmiHash.hash4(this.left.hashCode, this.top.hashCode, this .right.hashCode, this.bottom.hashCode);
313 } 313 }
314 intersection(other) { 314 intersection(other) {
315 let x0 = max(this.left, other.left); 315 let x0 = max(this.left, other.left);
316 let x1 = min(this.left['+'](this.width), other.left['+'](other.width)); 316 let x1 = min(this.left['+'](this.width), other.left['+'](other.width));
317 if (dart.notNull(x0) <= dart.notNull(x1)) { 317 if (dart.notNull(x0) <= dart.notNull(x1)) {
318 let y0 = max(this.top, other.top); 318 let y0 = max(this.top, other.top);
319 let y1 = min(this.top['+'](this.height), other.top['+'](other.height)) ; 319 let y1 = min(this.top['+'](this.height), other.top['+'](other.height)) ;
320 if (dart.notNull(y0) <= dart.notNull(y1)) { 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 )); 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 } 322 }
323 } 323 }
324 return null; 324 return null;
325 } 325 }
326 intersects(other) { 326 intersects(other) {
327 return dart.notNull(dart.notNull(dart.notNull(this.left['<='](dart.notNu ll(other.left) + dart.notNull(other.width))) && dart.notNull(dart.notNull(other. left) <= dart.notNull(this.left['+'](this.width)))) && dart.notNull(this.top['<= '](dart.notNull(other.top) + dart.notNull(other.height)))) && dart.notNull(dart. notNull(other.top) <= dart.notNull(this.top['+'](this.height))); 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 } 328 }
329 boundingBox(other) { 329 boundingBox(other) {
330 let right = max(this.left['+'](this.width), other.left['+'](other.width) ); 330 let right = max(this.left['+'](this.width), other.left['+'](other.width) );
331 let bottom = max(this.top['+'](this.height), other.top['+'](other.height )); 331 let bottom = max(this.top['+'](this.height), other.top['+'](other.height ));
332 let left = min(this.left, other.left); 332 let left = min(this.left, other.left);
333 let top = min(this.top, other.top); 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)); 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 } 335 }
336 containsRectangle(another) { 336 containsRectangle(another) {
337 return dart.notNull(dart.notNull(dart.notNull(this.left['<='](another.le ft)) && dart.notNull(dart.notNull(this.left['+'](this.width)) >= dart.notNull(da rt.notNull(another.left) + dart.notNull(another.width)))) && dart.notNull(this.t op['<='](another.top))) && dart.notNull(dart.notNull(this.top['+'](this.height)) >= dart.notNull(dart.notNull(another.top) + dart.notNull(another.height))); 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 } 338 }
339 containsPoint(another) { 339 containsPoint(another) {
340 return dart.notNull(dart.notNull(dart.notNull(core.num['>='](another.x, this.left)) && dart.notNull(dart.notNull(another.x) <= dart.notNull(this.left['+ '](this.width)))) && dart.notNull(core.num['>='](another.y, this.top))) && dart. notNull(dart.notNull(another.y) <= dart.notNull(this.top['+'](this.height))); 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 } 341 }
342 get topLeft() { 342 get topLeft() {
343 return new Point(this.left, this.top); 343 return new Point(this.left, this.top);
344 } 344 }
345 get topRight() { 345 get topRight() {
346 return new Point(dart.as(this.left['+'](this.width), T), this.top); 346 return new Point(dart.as(this.left['+'](this.width), T), this.top);
347 } 347 }
348 get bottomRight() { 348 get bottomRight() {
349 return new Point(dart.as(this.left['+'](this.width), T), dart.as(this.to p['+'](this.height), T)); 349 return new Point(dart.as(this.left['+'](this.width), T), dart.as(this.to p['+'](this.height), T));
350 } 350 }
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 this[_height] = height; 411 this[_height] = height;
412 } 412 }
413 } 413 }
414 dart.defineNamedConstructor(MutableRectangle, 'fromPoints'); 414 dart.defineNamedConstructor(MutableRectangle, 'fromPoints');
415 return MutableRectangle; 415 return MutableRectangle;
416 }); 416 });
417 let MutableRectangle = MutableRectangle$(dynamic); 417 let MutableRectangle = MutableRectangle$(dynamic);
418 // Function _clampToZero: (num) → num 418 // Function _clampToZero: (num) → num
419 function _clampToZero(value) { 419 function _clampToZero(value) {
420 dart.assert(dart.notNull(value) < 0); 420 dart.assert(dart.notNull(value) < 0);
421 return dart.notNull(-dart.notNull(value)) * 0; 421 return -dart.notNull(value) * 0;
422 } 422 }
423 // Exports: 423 // Exports:
424 exports.E = E; 424 exports.E = E;
425 exports.LN10 = LN10; 425 exports.LN10 = LN10;
426 exports.LN2 = LN2; 426 exports.LN2 = LN2;
427 exports.LOG2E = LOG2E; 427 exports.LOG2E = LOG2E;
428 exports.LOG10E = LOG10E; 428 exports.LOG10E = LOG10E;
429 exports.PI = PI; 429 exports.PI = PI;
430 exports.SQRT1_2 = SQRT1_2; 430 exports.SQRT1_2 = SQRT1_2;
431 exports.SQRT2 = SQRT2; 431 exports.SQRT2 = SQRT2;
(...skipping 11 matching lines...) Expand all
443 exports.exp = exp; 443 exports.exp = exp;
444 exports.log = log; 444 exports.log = log;
445 exports.Point = Point; 445 exports.Point = Point;
446 exports.Point$ = Point$; 446 exports.Point$ = Point$;
447 exports.Random = Random; 447 exports.Random = Random;
448 exports.Rectangle = Rectangle; 448 exports.Rectangle = Rectangle;
449 exports.Rectangle$ = Rectangle$; 449 exports.Rectangle$ = Rectangle$;
450 exports.MutableRectangle = MutableRectangle; 450 exports.MutableRectangle = MutableRectangle;
451 exports.MutableRectangle$ = MutableRectangle$; 451 exports.MutableRectangle$ = MutableRectangle$;
452 })(math || (math = {})); 452 })(math || (math = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698