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

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

Issue 959003003: Typecheck constructor initializers properly (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Rebase 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/core/core.js ('k') | test/codegen/expect/typed_data/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(math) { 2 (function(math) {
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;
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } 248 }
249 ['=='](other) { 249 ['=='](other) {
250 if (!dart.is(other, Point)) 250 if (!dart.is(other, Point))
251 return false; 251 return false;
252 return dart.notNull(dart.equals(this.x, dart.dload(other, 'x'))) && dart .notNull(dart.equals(this.y, dart.dload(other, 'y'))); 252 return dart.notNull(dart.equals(this.x, dart.dload(other, 'x'))) && dart .notNull(dart.equals(this.y, dart.dload(other, 'y')));
253 } 253 }
254 get hashCode() { 254 get hashCode() {
255 return _JenkinsSmiHash.hash2(this.x.hashCode, this.y.hashCode); 255 return _JenkinsSmiHash.hash2(this.x.hashCode, this.y.hashCode);
256 } 256 }
257 ['+'](other) { 257 ['+'](other) {
258 return new Point(this.x['+'](other.x), this.y['+'](other.y)); 258 return new Point(dart.as(this.x['+'](other.x), T), dart.as(this.y['+'](o ther.y), T));
259 } 259 }
260 ['-'](other) { 260 ['-'](other) {
261 return new Point(this.x['-'](other.x), this.y['-'](other.y)); 261 return new Point(dart.as(this.x['-'](other.x), T), dart.as(this.y['-'](o ther.y), T));
262 } 262 }
263 ['*'](factor) { 263 ['*'](factor) {
264 return new Point(this.x['*'](factor), this.y['*'](factor)); 264 return new Point(dart.as(this.x['*'](factor), T), dart.as(this.y['*'](fa ctor), T));
265 } 265 }
266 get magnitude() { 266 get magnitude() {
267 return sqrt(dart.notNull(this.x['*'](this.x)) + dart.notNull(this.y['*'] (this.y))); 267 return sqrt(dart.notNull(this.x['*'](this.x)) + dart.notNull(this.y['*'] (this.y)));
268 } 268 }
269 distanceTo(other) { 269 distanceTo(other) {
270 let dx = this.x['-'](other.x); 270 let dx = this.x['-'](other.x);
271 let dy = this.y['-'](other.y); 271 let dy = this.y['-'](other.y);
272 return sqrt(dart.notNull(dart.notNull(dx) * dart.notNull(dx)) + dart.not Null(dart.notNull(dy) * dart.notNull(dy))); 272 return sqrt(dart.notNull(dart.notNull(dx) * dart.notNull(dx)) + dart.not Null(dart.notNull(dy) * dart.notNull(dy)));
273 } 273 }
274 squaredDistanceTo(other) { 274 squaredDistanceTo(other) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 get hashCode() { 308 get hashCode() {
309 return _JenkinsSmiHash.hash4(this.left.hashCode, this.top.hashCode, this .right.hashCode, this.bottom.hashCode); 309 return _JenkinsSmiHash.hash4(this.left.hashCode, this.top.hashCode, this .right.hashCode, this.bottom.hashCode);
310 } 310 }
311 intersection(other) { 311 intersection(other) {
312 let x0 = max(this.left, other.left); 312 let x0 = max(this.left, other.left);
313 let x1 = min(this.left['+'](this.width), other.left['+'](other.width)); 313 let x1 = min(this.left['+'](this.width), other.left['+'](other.width));
314 if (dart.notNull(x0) <= dart.notNull(x1)) { 314 if (dart.notNull(x0) <= dart.notNull(x1)) {
315 let y0 = max(this.top, other.top); 315 let y0 = max(this.top, other.top);
316 let y1 = min(this.top['+'](this.height), other.top['+'](other.height)) ; 316 let y1 = min(this.top['+'](this.height), other.top['+'](other.height)) ;
317 if (dart.notNull(y0) <= dart.notNull(y1)) { 317 if (dart.notNull(y0) <= dart.notNull(y1)) {
318 return new Rectangle(x0, y0, dart.notNull(x1) - dart.notNull(x0), da rt.notNull(y1) - dart.notNull(y0)); 318 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 ));
319 } 319 }
320 } 320 }
321 return null; 321 return null;
322 } 322 }
323 intersects(other) { 323 intersects(other) {
324 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))); 324 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)));
325 } 325 }
326 boundingBox(other) { 326 boundingBox(other) {
327 let right = max(this.left['+'](this.width), other.left['+'](other.width) ); 327 let right = max(this.left['+'](this.width), other.left['+'](other.width) );
328 let bottom = max(this.top['+'](this.height), other.top['+'](other.height )); 328 let bottom = max(this.top['+'](this.height), other.top['+'](other.height ));
329 let left = min(this.left, other.left); 329 let left = min(this.left, other.left);
330 let top = min(this.top, other.top); 330 let top = min(this.top, other.top);
331 return new Rectangle(left, top, dart.notNull(right) - dart.notNull(left) , dart.notNull(bottom) - dart.notNull(top)); 331 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));
332 } 332 }
333 containsRectangle(another) { 333 containsRectangle(another) {
334 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))); 334 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)));
335 } 335 }
336 containsPoint(another) { 336 containsPoint(another) {
337 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))); 337 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)));
338 } 338 }
339 get topLeft() { 339 get topLeft() {
340 return new Point(this.left, this.top); 340 return new Point(this.left, this.top);
341 } 341 }
342 get topRight() { 342 get topRight() {
343 return new Point(this.left['+'](this.width), this.top); 343 return new Point(dart.as(this.left['+'](this.width), T), this.top);
344 } 344 }
345 get bottomRight() { 345 get bottomRight() {
346 return new Point(this.left['+'](this.width), this.top['+'](this.height)) ; 346 return new Point(dart.as(this.left['+'](this.width), T), dart.as(this.to p['+'](this.height), T));
347 } 347 }
348 get bottomLeft() { 348 get bottomLeft() {
349 return new Point(this.left, this.top['+'](this.height)); 349 return new Point(this.left, dart.as(this.top['+'](this.height), T));
350 } 350 }
351 } 351 }
352 return _RectangleBase; 352 return _RectangleBase;
353 }); 353 });
354 let _RectangleBase = _RectangleBase$(dynamic); 354 let _RectangleBase = _RectangleBase$(dynamic);
355 let Rectangle$ = dart.generic(function(T) { 355 let Rectangle$ = dart.generic(function(T) {
356 class Rectangle extends _RectangleBase$(T) { 356 class Rectangle extends _RectangleBase$(T) {
357 Rectangle(left, top, width, height) { 357 Rectangle(left, top, width, height) {
358 this.left = left; 358 this.left = left;
359 this.top = top; 359 this.top = top;
360 this.width = width['<'](0) ? dart.notNull(dart.throw_("Unimplemented Pre fixExpression: -width")) * 0 : width; 360 this.width = dart.as(width['<'](0) ? dart.notNull(dart.throw_("Unimpleme nted PrefixExpression: -width")) * 0 : width, T);
361 this.height = height['<'](0) ? dart.notNull(dart.throw_("Unimplemented P refixExpression: -height")) * 0 : height; 361 this.height = dart.as(height['<'](0) ? dart.notNull(dart.throw_("Unimple mented PrefixExpression: -height")) * 0 : height, T);
362 super._RectangleBase(); 362 super._RectangleBase();
363 } 363 }
364 Rectangle$fromPoints(a, b) { 364 Rectangle$fromPoints(a, b) {
365 let left = dart.as(min(a.x, b.x), T); 365 let left = dart.as(min(a.x, b.x), T);
366 let width = dart.as(core.num['-'](max(a.x, b.x), left), T); 366 let width = dart.as(core.num['-'](max(a.x, b.x), left), T);
367 let top = dart.as(min(a.y, b.y), T); 367 let top = dart.as(min(a.y, b.y), T);
368 let height = dart.as(core.num['-'](max(a.y, b.y), top), T); 368 let height = dart.as(core.num['-'](max(a.y, b.y), top), T);
369 return new Rectangle(left, top, width, height); 369 return new Rectangle(left, top, width, height);
370 } 370 }
371 } 371 }
372 dart.defineNamedConstructor(Rectangle, 'fromPoints'); 372 dart.defineNamedConstructor(Rectangle, 'fromPoints');
373 return Rectangle; 373 return Rectangle;
374 }); 374 });
375 let Rectangle = Rectangle$(dynamic); 375 let Rectangle = Rectangle$(dynamic);
376 let MutableRectangle$ = dart.generic(function(T) { 376 let MutableRectangle$ = dart.generic(function(T) {
377 class MutableRectangle extends _RectangleBase$(T) { 377 class MutableRectangle extends _RectangleBase$(T) {
378 MutableRectangle(left, top, width, height) { 378 MutableRectangle(left, top, width, height) {
379 this.left = left; 379 this.left = left;
380 this.top = top; 380 this.top = top;
381 this._width = width['<'](0) ? _clampToZero(width) : width; 381 this._width = dart.as(width['<'](0) ? _clampToZero(width) : width, T);
382 this._height = height['<'](0) ? _clampToZero(height) : height; 382 this._height = dart.as(height['<'](0) ? _clampToZero(height) : height, T );
383 super._RectangleBase(); 383 super._RectangleBase();
384 } 384 }
385 MutableRectangle$fromPoints(a, b) { 385 MutableRectangle$fromPoints(a, b) {
386 let left = dart.as(min(a.x, b.x), T); 386 let left = dart.as(min(a.x, b.x), T);
387 let width = dart.as(core.num['-'](max(a.x, b.x), left), T); 387 let width = dart.as(core.num['-'](max(a.x, b.x), left), T);
388 let top = dart.as(min(a.y, b.y), T); 388 let top = dart.as(min(a.y, b.y), T);
389 let height = dart.as(core.num['-'](max(a.y, b.y), top), T); 389 let height = dart.as(core.num['-'](max(a.y, b.y), top), T);
390 return new MutableRectangle(left, top, width, height); 390 return new MutableRectangle(left, top, width, height);
391 } 391 }
392 get width() { 392 get width() {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 math.exp = exp; 438 math.exp = exp;
439 math.log = log; 439 math.log = log;
440 math.Point = Point; 440 math.Point = Point;
441 math.Point$ = Point$; 441 math.Point$ = Point$;
442 math.Random = Random; 442 math.Random = Random;
443 math.Rectangle = Rectangle; 443 math.Rectangle = Rectangle;
444 math.Rectangle$ = Rectangle$; 444 math.Rectangle$ = Rectangle$;
445 math.MutableRectangle = MutableRectangle; 445 math.MutableRectangle = MutableRectangle;
446 math.MutableRectangle$ = MutableRectangle$; 446 math.MutableRectangle$ = MutableRectangle$;
447 })(math || (math = {})); 447 })(math || (math = {}));
OLDNEW
« no previous file with comments | « test/codegen/expect/core/core.js ('k') | test/codegen/expect/typed_data/typed_data.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698