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

Side by Side Diff: lib/runtime/dart/math.js

Issue 1145283002: Use short array syntax in method signatures (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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 = dart.defineLibrary(math, {}); 1 var math = dart.defineLibrary(math, {});
2 var core = dart.import(core); 2 var core = dart.import(core);
3 var _js_helper = dart.lazyImport(_js_helper); 3 var _js_helper = dart.lazyImport(_js_helper);
4 (function(exports, core, _js_helper) { 4 (function(exports, core, _js_helper) {
5 'use strict'; 5 'use strict';
6 class _JenkinsSmiHash extends core.Object { 6 class _JenkinsSmiHash extends core.Object {
7 static combine(hash, value) { 7 static combine(hash, value) {
8 hash = 536870911 & dart.notNull(hash) + dart.notNull(value); 8 hash = 536870911 & dart.notNull(hash) + dart.notNull(value);
9 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) << 10); 9 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) << 10);
10 return dart.notNull(hash) ^ dart.notNull(hash) >> 6; 10 return dart.notNull(hash) ^ dart.notNull(hash) >> 6;
11 } 11 }
12 static finish(hash) { 12 static finish(hash) {
13 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) < < 3); 13 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) < < 3);
14 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 11; 14 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 11;
15 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1 5); 15 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1 5);
16 } 16 }
17 static hash2(a, b) { 17 static hash2(a, b) {
18 return _JenkinsSmiHash.finish(_JenkinsSmiHash.combine(_JenkinsSmiHash.comb ine(0, dart.as(a, core.int)), dart.as(b, core.int))); 18 return _JenkinsSmiHash.finish(_JenkinsSmiHash.combine(_JenkinsSmiHash.comb ine(0, dart.as(a, core.int)), dart.as(b, core.int)));
19 } 19 }
20 static hash4(a, b, c, d) { 20 static hash4(a, b, c, d) {
21 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))); 21 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)));
22 } 22 }
23 } 23 }
24 dart.setSignature(_JenkinsSmiHash, { 24 dart.setSignature(_JenkinsSmiHash, {
25 statics: () => ({ 25 statics: () => ({
26 combine: dart.functionType(core.int, [core.int, core.int]), 26 combine: [core.int, [core.int, core.int]],
27 finish: dart.functionType(core.int, [core.int]), 27 finish: [core.int, [core.int]],
28 hash2: dart.functionType(core.int, [dart.dynamic, dart.dynamic]), 28 hash2: [core.int, [dart.dynamic, dart.dynamic]],
29 hash4: dart.functionType(core.int, [dart.dynamic, dart.dynamic, dart.dynam ic, dart.dynamic]) 29 hash4: [core.int, [dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic] ]
30 }), 30 }),
31 names: ['combine', 'finish', 'hash2', 'hash4'] 31 names: ['combine', 'finish', 'hash2', 'hash4']
32 }); 32 });
33 let Point$ = dart.generic(function(T) { 33 let Point$ = dart.generic(function(T) {
34 class Point extends core.Object { 34 class Point extends core.Object {
35 Point(x, y) { 35 Point(x, y) {
36 this.x = x; 36 this.x = x;
37 this.y = y; 37 this.y = y;
38 } 38 }
39 toString() { 39 toString() {
(...skipping 29 matching lines...) Expand all
69 } 69 }
70 squaredDistanceTo(other) { 70 squaredDistanceTo(other) {
71 dart.as(other, Point$(T)); 71 dart.as(other, Point$(T));
72 let dx = this.x['-'](other.x); 72 let dx = this.x['-'](other.x);
73 let dy = this.y['-'](other.y); 73 let dy = this.y['-'](other.y);
74 return dart.as(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dart.notNull(dy), T); 74 return dart.as(dart.notNull(dx) * dart.notNull(dx) + dart.notNull(dy) * dart.notNull(dy), T);
75 } 75 }
76 } 76 }
77 dart.setSignature(Point, { 77 dart.setSignature(Point, {
78 methods: () => ({ 78 methods: () => ({
79 toString: dart.functionType(core.String, []), 79 toString: [core.String, []],
80 '==': dart.functionType(core.bool, [dart.dynamic]), 80 '==': [core.bool, [dart.dynamic]],
81 '+': dart.functionType(Point$(T), [Point$(T)]), 81 '+': [Point$(T), [Point$(T)]],
82 '-': dart.functionType(Point$(T), [Point$(T)]), 82 '-': [Point$(T), [Point$(T)]],
83 '*': dart.functionType(Point$(T), [core.num]), 83 '*': [Point$(T), [core.num]],
84 distanceTo: dart.functionType(core.double, [Point$(T)]), 84 distanceTo: [core.double, [Point$(T)]],
85 squaredDistanceTo: dart.functionType(T, [Point$(T)]) 85 squaredDistanceTo: [T, [Point$(T)]]
86 }) 86 })
87 }); 87 });
88 return Point; 88 return Point;
89 }); 89 });
90 let Point = Point$(); 90 let Point = Point$();
91 class Random extends core.Object { 91 class Random extends core.Object {
92 Random(seed) { 92 Random(seed) {
93 if (seed === void 0) 93 if (seed === void 0)
94 seed = null; 94 seed = null;
95 return seed == null ? dart.const(new _JSRandom()) : new _Random(seed); 95 return seed == null ? dart.const(new _JSRandom()) : new _Random(seed);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 get bottomRight() { 156 get bottomRight() {
157 return new (Point$(T))(dart.as(this.left['+'](this.width), T), dart.as(t his.top['+'](this.height), T)); 157 return new (Point$(T))(dart.as(this.left['+'](this.width), T), dart.as(t his.top['+'](this.height), T));
158 } 158 }
159 get bottomLeft() { 159 get bottomLeft() {
160 return new (Point$(T))(this.left, dart.as(this.top['+'](this.height), T) ); 160 return new (Point$(T))(this.left, dart.as(this.top['+'](this.height), T) );
161 } 161 }
162 } 162 }
163 dart.setSignature(_RectangleBase, { 163 dart.setSignature(_RectangleBase, {
164 methods: () => ({ 164 methods: () => ({
165 toString: dart.functionType(core.String, []), 165 toString: [core.String, []],
166 '==': dart.functionType(core.bool, [dart.dynamic]), 166 '==': [core.bool, [dart.dynamic]],
167 intersection: dart.functionType(Rectangle$(T), [Rectangle$(T)]), 167 intersection: [Rectangle$(T), [Rectangle$(T)]],
168 intersects: dart.functionType(core.bool, [Rectangle$(core.num)]), 168 intersects: [core.bool, [Rectangle$(core.num)]],
169 boundingBox: dart.functionType(Rectangle$(T), [Rectangle$(T)]), 169 boundingBox: [Rectangle$(T), [Rectangle$(T)]],
170 containsRectangle: dart.functionType(core.bool, [Rectangle$(core.num)]), 170 containsRectangle: [core.bool, [Rectangle$(core.num)]],
171 containsPoint: dart.functionType(core.bool, [Point$(core.num)]) 171 containsPoint: [core.bool, [Point$(core.num)]]
172 }) 172 })
173 }); 173 });
174 return _RectangleBase; 174 return _RectangleBase;
175 }); 175 });
176 let _RectangleBase = _RectangleBase$(); 176 let _RectangleBase = _RectangleBase$();
177 let Rectangle$ = dart.generic(function(T) { 177 let Rectangle$ = dart.generic(function(T) {
178 class Rectangle extends _RectangleBase$(T) { 178 class Rectangle extends _RectangleBase$(T) {
179 Rectangle(left, top, width, height) { 179 Rectangle(left, top, width, height) {
180 this.left = left; 180 this.left = left;
181 this.top = top; 181 this.top = top;
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 nextDouble() { 357 nextDouble() {
358 return Math.random(); 358 return Math.random();
359 } 359 }
360 nextBool() { 360 nextBool() {
361 return Math.random() < 0.5; 361 return Math.random() < 0.5;
362 } 362 }
363 } 363 }
364 _JSRandom[dart.implements] = () => [Random]; 364 _JSRandom[dart.implements] = () => [Random];
365 dart.setSignature(_JSRandom, { 365 dart.setSignature(_JSRandom, {
366 methods: () => ({ 366 methods: () => ({
367 nextInt: dart.functionType(core.int, [core.int]), 367 nextInt: [core.int, [core.int]],
368 nextDouble: dart.functionType(core.double, []), 368 nextDouble: [core.double, []],
369 nextBool: dart.functionType(core.bool, []) 369 nextBool: [core.bool, []]
370 }) 370 })
371 }); 371 });
372 let _lo = Symbol('_lo'); 372 let _lo = Symbol('_lo');
373 let _hi = Symbol('_hi'); 373 let _hi = Symbol('_hi');
374 let _nextState = Symbol('_nextState'); 374 let _nextState = Symbol('_nextState');
375 class _Random extends core.Object { 375 class _Random extends core.Object {
376 _Random(seed) { 376 _Random(seed) {
377 this[_lo] = 0; 377 this[_lo] = 0;
378 this[_hi] = 0; 378 this[_hi] = 0;
379 let empty_seed = 0; 379 let empty_seed = 0;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 return (dart.notNull(bits26) * dart.notNull(_Random._POW2_27_D) + dart.not Null(bits27)) / dart.notNull(_Random._POW2_53_D); 466 return (dart.notNull(bits26) * dart.notNull(_Random._POW2_27_D) + dart.not Null(bits27)) / dart.notNull(_Random._POW2_53_D);
467 } 467 }
468 nextBool() { 468 nextBool() {
469 this[_nextState](); 469 this[_nextState]();
470 return (dart.notNull(this[_lo]) & 1) == 0; 470 return (dart.notNull(this[_lo]) & 1) == 0;
471 } 471 }
472 } 472 }
473 _Random[dart.implements] = () => [Random]; 473 _Random[dart.implements] = () => [Random];
474 dart.setSignature(_Random, { 474 dart.setSignature(_Random, {
475 methods: () => ({ 475 methods: () => ({
476 [_nextState]: dart.functionType(dart.void, []), 476 [_nextState]: [dart.void, []],
477 nextInt: dart.functionType(core.int, [core.int]), 477 nextInt: [core.int, [core.int]],
478 nextDouble: dart.functionType(core.double, []), 478 nextDouble: [core.double, []],
479 nextBool: dart.functionType(core.bool, []) 479 nextBool: [core.bool, []]
480 }) 480 })
481 }); 481 });
482 _Random._POW2_53_D = 1.0 * 9007199254740992; 482 _Random._POW2_53_D = 1.0 * 9007199254740992;
483 _Random._POW2_27_D = 1.0 * (1 << 27); 483 _Random._POW2_27_D = 1.0 * (1 << 27);
484 _Random._MASK32 = 4294967295; 484 _Random._MASK32 = 4294967295;
485 // Exports: 485 // Exports:
486 exports.Point$ = Point$; 486 exports.Point$ = Point$;
487 exports.Point = Point; 487 exports.Point = Point;
488 exports.Random = Random; 488 exports.Random = Random;
489 exports.Rectangle$ = Rectangle$; 489 exports.Rectangle$ = Rectangle$;
(...skipping 15 matching lines...) Expand all
505 exports.sin = sin; 505 exports.sin = sin;
506 exports.cos = cos; 506 exports.cos = cos;
507 exports.tan = tan; 507 exports.tan = tan;
508 exports.acos = acos; 508 exports.acos = acos;
509 exports.asin = asin; 509 exports.asin = asin;
510 exports.atan = atan; 510 exports.atan = atan;
511 exports.sqrt = sqrt; 511 exports.sqrt = sqrt;
512 exports.exp = exp; 512 exports.exp = exp;
513 exports.log = log; 513 exports.log = log;
514 })(math, core, _js_helper); 514 })(math, core, _js_helper);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698