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

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

Issue 1144303003: Use signature inheritance when method types are unchanged (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Remove empty signatures 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
« no previous file with comments | « lib/runtime/dart/isolate.js ('k') | lib/runtime/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 = 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;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, []),
80 '==': dart.functionType(core.bool, [dart.dynamic]),
81 '+': dart.functionType(Point$(T), [Point$(T)]), 79 '+': dart.functionType(Point$(T), [Point$(T)]),
82 '-': dart.functionType(Point$(T), [Point$(T)]), 80 '-': dart.functionType(Point$(T), [Point$(T)]),
83 '*': dart.functionType(Point$(T), [core.num]), 81 '*': dart.functionType(Point$(T), [core.num]),
84 distanceTo: dart.functionType(core.double, [Point$(T)]), 82 distanceTo: dart.functionType(core.double, [Point$(T)]),
85 squaredDistanceTo: dart.functionType(T, [Point$(T)]) 83 squaredDistanceTo: dart.functionType(T, [Point$(T)])
86 }) 84 })
87 }); 85 });
88 return Point; 86 return Point;
89 }); 87 });
90 let Point = Point$(); 88 let Point = Point$();
91 class Random extends core.Object { 89 class Random extends core.Object {
92 Random(seed) { 90 Random(seed) {
93 if (seed === void 0) 91 if (seed === void 0)
94 seed = null; 92 seed = null;
95 return seed == null ? dart.const(new _JSRandom()) : new _Random(seed); 93 return seed == null ? dart.const(new _JSRandom()) : new _Random(seed);
96 } 94 }
97 } 95 }
98 dart.setSignature(Random, {});
99 let _RectangleBase$ = dart.generic(function(T) { 96 let _RectangleBase$ = dart.generic(function(T) {
100 class _RectangleBase extends core.Object { 97 class _RectangleBase extends core.Object {
101 _RectangleBase() { 98 _RectangleBase() {
102 } 99 }
103 get right() { 100 get right() {
104 return dart.as(this.left['+'](this.width), T); 101 return dart.as(this.left['+'](this.width), T);
105 } 102 }
106 get bottom() { 103 get bottom() {
107 return dart.as(this.top['+'](this.height), T); 104 return dart.as(this.top['+'](this.height), T);
108 } 105 }
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 152 }
156 get bottomRight() { 153 get bottomRight() {
157 return new (Point$(T))(dart.as(this.left['+'](this.width), T), dart.as(t his.top['+'](this.height), T)); 154 return new (Point$(T))(dart.as(this.left['+'](this.width), T), dart.as(t his.top['+'](this.height), T));
158 } 155 }
159 get bottomLeft() { 156 get bottomLeft() {
160 return new (Point$(T))(this.left, dart.as(this.top['+'](this.height), T) ); 157 return new (Point$(T))(this.left, dart.as(this.top['+'](this.height), T) );
161 } 158 }
162 } 159 }
163 dart.setSignature(_RectangleBase, { 160 dart.setSignature(_RectangleBase, {
164 methods: () => ({ 161 methods: () => ({
165 toString: dart.functionType(core.String, []),
166 '==': dart.functionType(core.bool, [dart.dynamic]),
167 intersection: dart.functionType(Rectangle$(T), [Rectangle$(T)]), 162 intersection: dart.functionType(Rectangle$(T), [Rectangle$(T)]),
168 intersects: dart.functionType(core.bool, [Rectangle$(core.num)]), 163 intersects: dart.functionType(core.bool, [Rectangle$(core.num)]),
169 boundingBox: dart.functionType(Rectangle$(T), [Rectangle$(T)]), 164 boundingBox: dart.functionType(Rectangle$(T), [Rectangle$(T)]),
170 containsRectangle: dart.functionType(core.bool, [Rectangle$(core.num)]), 165 containsRectangle: dart.functionType(core.bool, [Rectangle$(core.num)]),
171 containsPoint: dart.functionType(core.bool, [Point$(core.num)]) 166 containsPoint: dart.functionType(core.bool, [Point$(core.num)])
172 }) 167 })
173 }); 168 });
174 return _RectangleBase; 169 return _RectangleBase;
175 }); 170 });
176 let _RectangleBase = _RectangleBase$(); 171 let _RectangleBase = _RectangleBase$();
177 let Rectangle$ = dart.generic(function(T) { 172 let Rectangle$ = dart.generic(function(T) {
178 class Rectangle extends _RectangleBase$(T) { 173 class Rectangle extends _RectangleBase$(T) {
179 Rectangle(left, top, width, height) { 174 Rectangle(left, top, width, height) {
180 this.left = left; 175 this.left = left;
181 this.top = top; 176 this.top = top;
182 this.width = dart.as(width['<'](0) ? dart.notNull(width['unary-']()) * 0 : width, T); 177 this.width = dart.as(width['<'](0) ? dart.notNull(width['unary-']()) * 0 : width, T);
183 this.height = dart.as(height['<'](0) ? dart.notNull(height['unary-']()) * 0 : height, T); 178 this.height = dart.as(height['<'](0) ? dart.notNull(height['unary-']()) * 0 : height, T);
184 super._RectangleBase(); 179 super._RectangleBase();
185 } 180 }
186 fromPoints(a, b) { 181 fromPoints(a, b) {
187 let left = dart.as(min(a.x, b.x), T); 182 let left = dart.as(min(a.x, b.x), T);
188 let width = dart.as(max(a.x, b.x)['-'](left), T); 183 let width = dart.as(max(a.x, b.x)['-'](left), T);
189 let top = dart.as(min(a.y, b.y), T); 184 let top = dart.as(min(a.y, b.y), T);
190 let height = dart.as(max(a.y, b.y)['-'](top), T); 185 let height = dart.as(max(a.y, b.y)['-'](top), T);
191 return new (Rectangle$(T))(left, top, width, height); 186 return new (Rectangle$(T))(left, top, width, height);
192 } 187 }
193 } 188 }
194 dart.defineNamedConstructor(Rectangle, 'fromPoints'); 189 dart.defineNamedConstructor(Rectangle, 'fromPoints');
195 dart.setSignature(Rectangle, {});
196 return Rectangle; 190 return Rectangle;
197 }); 191 });
198 let Rectangle = Rectangle$(); 192 let Rectangle = Rectangle$();
199 let _width = Symbol('_width'); 193 let _width = Symbol('_width');
200 let _height = Symbol('_height'); 194 let _height = Symbol('_height');
201 let MutableRectangle$ = dart.generic(function(T) { 195 let MutableRectangle$ = dart.generic(function(T) {
202 class MutableRectangle extends _RectangleBase$(T) { 196 class MutableRectangle extends _RectangleBase$(T) {
203 MutableRectangle(left, top, width, height) { 197 MutableRectangle(left, top, width, height) {
204 this.left = left; 198 this.left = left;
205 this.top = top; 199 this.top = top;
(...skipping 22 matching lines...) Expand all
228 } 222 }
229 set height(height) { 223 set height(height) {
230 dart.as(height, T); 224 dart.as(height, T);
231 if (height['<'](0)) 225 if (height['<'](0))
232 height = dart.as(_clampToZero(height), T); 226 height = dart.as(_clampToZero(height), T);
233 this[_height] = height; 227 this[_height] = height;
234 } 228 }
235 } 229 }
236 MutableRectangle[dart.implements] = () => [Rectangle$(T)]; 230 MutableRectangle[dart.implements] = () => [Rectangle$(T)];
237 dart.defineNamedConstructor(MutableRectangle, 'fromPoints'); 231 dart.defineNamedConstructor(MutableRectangle, 'fromPoints');
238 dart.setSignature(MutableRectangle, {});
239 return MutableRectangle; 232 return MutableRectangle;
240 }); 233 });
241 let MutableRectangle = MutableRectangle$(); 234 let MutableRectangle = MutableRectangle$();
242 function _clampToZero(value) { 235 function _clampToZero(value) {
243 dart.assert(dart.notNull(value) < 0); 236 dart.assert(dart.notNull(value) < 0);
244 return -dart.notNull(value) * 0; 237 return -dart.notNull(value) * 0;
245 } 238 }
246 dart.fn(_clampToZero, core.num, [core.num]); 239 dart.fn(_clampToZero, core.num, [core.num]);
247 let E = 2.718281828459045; 240 let E = 2.718281828459045;
248 let LN10 = 2.302585092994046; 241 let LN10 = 2.302585092994046;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 exports.sin = sin; 498 exports.sin = sin;
506 exports.cos = cos; 499 exports.cos = cos;
507 exports.tan = tan; 500 exports.tan = tan;
508 exports.acos = acos; 501 exports.acos = acos;
509 exports.asin = asin; 502 exports.asin = asin;
510 exports.atan = atan; 503 exports.atan = atan;
511 exports.sqrt = sqrt; 504 exports.sqrt = sqrt;
512 exports.exp = exp; 505 exports.exp = exp;
513 exports.log = log; 506 exports.log = log;
514 })(math, core, _js_helper); 507 })(math, core, _js_helper);
OLDNEW
« no previous file with comments | « lib/runtime/dart/isolate.js ('k') | lib/runtime/dart/typed_data.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698