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

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

Issue 1117793002: add checks needed for covariant generics, and List<E> (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; 1 var math;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class _JenkinsSmiHash extends core.Object { 4 class _JenkinsSmiHash extends core.Object {
5 static combine(hash, value) { 5 static combine(hash, value) {
6 hash = 536870911 & dart.notNull(hash) + dart.notNull(value); 6 hash = 536870911 & dart.notNull(hash) + dart.notNull(value);
7 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) << 10); 7 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) << 10);
8 return dart.notNull(hash) ^ dart.notNull(hash) >> 6; 8 return dart.notNull(hash) ^ dart.notNull(hash) >> 6;
9 } 9 }
10 static finish(hash) { 10 static finish(hash) {
11 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) < < 3); 11 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) < < 3);
12 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 11; 12 hash = dart.notNull(hash) ^ dart.notNull(hash) >> 11;
13 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1 5); 13 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1 5);
14 } 14 }
15 static hash2(a, b) { 15 static hash2(a, b) {
16 return _JenkinsSmiHash.finish(_JenkinsSmiHash.combine(_JenkinsSmiHash.comb ine(0, dart.as(a, core.int)), dart.as(b, core.int))); 16 return _JenkinsSmiHash.finish(_JenkinsSmiHash.combine(_JenkinsSmiHash.comb ine(0, dart.as(a, core.int)), dart.as(b, core.int)));
17 } 17 }
18 static hash4(a, b, c, d) { 18 static hash4(a, b, c, d) {
19 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))); 19 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)));
20 } 20 }
21 } 21 }
22 let Point$ = dart.generic(function(T) { 22 let Point$ = dart.generic(function(T) {
23 class Point extends core.Object { 23 class Point extends core.Object {
24 Point(x, y) { 24 Point(x, y) {
25 dart.as(x, T);
26 dart.as(y, T);
25 this.x = x; 27 this.x = x;
26 this.y = y; 28 this.y = y;
27 } 29 }
28 toString() { 30 toString() {
29 return `Point(${this.x}, ${this.y})`; 31 return `Point(${this.x}, ${this.y})`;
30 } 32 }
31 ['=='](other) { 33 ['=='](other) {
32 if (!dart.is(other, Point)) 34 if (!dart.is(other, Point))
33 return false; 35 return false;
34 return dart.notNull(dart.equals(this.x, dart.dload(other, 'x'))) && dart .notNull(dart.equals(this.y, dart.dload(other, 'y'))); 36 return dart.notNull(dart.equals(this.x, dart.dload(other, 'x'))) && dart .notNull(dart.equals(this.y, dart.dload(other, 'y')));
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 get bottomLeft() { 132 get bottomLeft() {
131 return new (Point$(T))(this.left, dart.as(this.top['+'](this.height), T) ); 133 return new (Point$(T))(this.left, dart.as(this.top['+'](this.height), T) );
132 } 134 }
133 } 135 }
134 return _RectangleBase; 136 return _RectangleBase;
135 }); 137 });
136 let _RectangleBase = _RectangleBase$(); 138 let _RectangleBase = _RectangleBase$();
137 let Rectangle$ = dart.generic(function(T) { 139 let Rectangle$ = dart.generic(function(T) {
138 class Rectangle extends _RectangleBase$(T) { 140 class Rectangle extends _RectangleBase$(T) {
139 Rectangle(left, top, width, height) { 141 Rectangle(left, top, width, height) {
142 dart.as(left, T);
143 dart.as(top, T);
144 dart.as(width, T);
145 dart.as(height, T);
140 this.left = left; 146 this.left = left;
141 this.top = top; 147 this.top = top;
142 this.width = dart.as(width['<'](0) ? dart.notNull(width['unary-']()) * 0 : width, T); 148 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); 149 this.height = dart.as(height['<'](0) ? dart.notNull(height['unary-']()) * 0 : height, T);
144 super._RectangleBase(); 150 super._RectangleBase();
145 } 151 }
146 fromPoints(a, b) { 152 fromPoints(a, b) {
147 let left = dart.as(min(a.x, b.x), T); 153 let left = dart.as(min(a.x, b.x), T);
148 let width = dart.as(core.num['-'](max(a.x, b.x), left), T); 154 let width = dart.as(core.num['-'](max(a.x, b.x), left), T);
149 let top = dart.as(min(a.y, b.y), T); 155 let top = dart.as(min(a.y, b.y), T);
150 let height = dart.as(core.num['-'](max(a.y, b.y), top), T); 156 let height = dart.as(core.num['-'](max(a.y, b.y), top), T);
151 return new (Rectangle$(T))(left, top, width, height); 157 return new (Rectangle$(T))(left, top, width, height);
152 } 158 }
153 } 159 }
154 dart.defineNamedConstructor(Rectangle, 'fromPoints'); 160 dart.defineNamedConstructor(Rectangle, 'fromPoints');
155 return Rectangle; 161 return Rectangle;
156 }); 162 });
157 let Rectangle = Rectangle$(); 163 let Rectangle = Rectangle$();
158 let _width = Symbol('_width'); 164 let _width = Symbol('_width');
159 let _height = Symbol('_height'); 165 let _height = Symbol('_height');
160 let MutableRectangle$ = dart.generic(function(T) { 166 let MutableRectangle$ = dart.generic(function(T) {
161 class MutableRectangle extends _RectangleBase$(T) { 167 class MutableRectangle extends _RectangleBase$(T) {
162 MutableRectangle(left, top, width, height) { 168 MutableRectangle(left, top, width, height) {
169 dart.as(left, T);
170 dart.as(top, T);
171 dart.as(width, T);
172 dart.as(height, T);
163 this.left = left; 173 this.left = left;
164 this.top = top; 174 this.top = top;
165 this[_width] = dart.as(width['<'](0) ? _clampToZero(width) : width, T); 175 this[_width] = dart.as(width['<'](0) ? _clampToZero(width) : width, T);
166 this[_height] = dart.as(height['<'](0) ? _clampToZero(height) : height, T); 176 this[_height] = dart.as(height['<'](0) ? _clampToZero(height) : height, T);
167 super._RectangleBase(); 177 super._RectangleBase();
168 } 178 }
169 fromPoints(a, b) { 179 fromPoints(a, b) {
170 let left = dart.as(min(a.x, b.x), T); 180 let left = dart.as(min(a.x, b.x), T);
171 let width = dart.as(core.num['-'](max(a.x, b.x), left), T); 181 let width = dart.as(core.num['-'](max(a.x, b.x), left), T);
172 let top = dart.as(min(a.y, b.y), T); 182 let top = dart.as(min(a.y, b.y), T);
173 let height = dart.as(core.num['-'](max(a.y, b.y), top), T); 183 let height = dart.as(core.num['-'](max(a.y, b.y), top), T);
174 return new (MutableRectangle$(T))(left, top, width, height); 184 return new (MutableRectangle$(T))(left, top, width, height);
175 } 185 }
176 get width() { 186 get width() {
177 return this[_width]; 187 return this[_width];
178 } 188 }
179 set width(width) { 189 set width(width) {
190 dart.as(width, T);
180 if (width['<'](0)) 191 if (width['<'](0))
181 width = dart.as(_clampToZero(width), T); 192 width = dart.as(_clampToZero(width), T);
182 this[_width] = width; 193 this[_width] = width;
183 } 194 }
184 get height() { 195 get height() {
185 return this[_height]; 196 return this[_height];
186 } 197 }
187 set height(height) { 198 set height(height) {
199 dart.as(height, T);
188 if (height['<'](0)) 200 if (height['<'](0))
189 height = dart.as(_clampToZero(height), T); 201 height = dart.as(_clampToZero(height), T);
190 this[_height] = height; 202 this[_height] = height;
191 } 203 }
192 } 204 }
193 MutableRectangle[dart.implements] = () => [Rectangle$(T)]; 205 MutableRectangle[dart.implements] = () => [Rectangle$(T)];
194 dart.defineNamedConstructor(MutableRectangle, 'fromPoints'); 206 dart.defineNamedConstructor(MutableRectangle, 'fromPoints');
195 return MutableRectangle; 207 return MutableRectangle;
196 }); 208 });
197 let MutableRectangle = MutableRectangle$(); 209 let MutableRectangle = MutableRectangle$();
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 exports.sin = sin; 458 exports.sin = sin;
447 exports.cos = cos; 459 exports.cos = cos;
448 exports.tan = tan; 460 exports.tan = tan;
449 exports.acos = acos; 461 exports.acos = acos;
450 exports.asin = asin; 462 exports.asin = asin;
451 exports.atan = atan; 463 exports.atan = atan;
452 exports.sqrt = sqrt; 464 exports.sqrt = sqrt;
453 exports.exp = exp; 465 exports.exp = exp;
454 exports.log = log; 466 exports.log = log;
455 })(math || (math = {})); 467 })(math || (math = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698