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

Side by Side Diff: test/codegen/expect/dart/_interceptors.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 _interceptors; 1 var _interceptors;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 // Function _symbolToString: (Symbol) → String 4 // Function _symbolToString: (Symbol) → String
5 function _symbolToString(symbol) { 5 function _symbolToString(symbol) {
6 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol)); 6 return _internal.Symbol.getName(dart.as(symbol, _internal.Symbol));
7 } 7 }
8 // Function _symbolMapToStringMap: (Map<Symbol, dynamic>) → dynamic 8 // Function _symbolMapToStringMap: (Map<Symbol, dynamic>) → dynamic
9 function _symbolMapToStringMap(map) { 9 function _symbolMapToStringMap(map) {
10 if (map === null) 10 if (map === null)
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return interceptor; 84 return interceptor;
85 } 85 }
86 dart.copyProperties(exports, { 86 dart.copyProperties(exports, {
87 get mapTypeToInterceptor() { 87 get mapTypeToInterceptor() {
88 return _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_names.M AP_TYPE_TO_INTERCEPTOR, core.String)); 88 return _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_embedded_names.M AP_TYPE_TO_INTERCEPTOR, core.String));
89 } 89 }
90 }); 90 });
91 // Function findIndexForNativeSubclassType: (Type) → int 91 // Function findIndexForNativeSubclassType: (Type) → int
92 function findIndexForNativeSubclassType(type) { 92 function findIndexForNativeSubclassType(type) {
93 if (exports.mapTypeToInterceptor == null) 93 if (exports.mapTypeToInterceptor == null)
94 return dart.as(null, core.int); 94 return null;
95 let map = dart.as(exports.mapTypeToInterceptor, core.List); 95 let map = dart.as(exports.mapTypeToInterceptor, core.List);
96 for (let i = 0; i + 1 < map.length; i = 3) { 96 for (let i = 0; dart.notNull(i) + 1 < dart.notNull(map.length); i = 3) {
97 if (dart.equals(type, map.get(i))) { 97 if (dart.equals(type, map.get(i))) {
98 return i; 98 return i;
99 } 99 }
100 } 100 }
101 return dart.as(null, core.int); 101 return null;
102 } 102 }
103 // Function findInterceptorConstructorForType: (Type) → dynamic 103 // Function findInterceptorConstructorForType: (Type) → dynamic
104 function findInterceptorConstructorForType(type) { 104 function findInterceptorConstructorForType(type) {
105 let index = findIndexForNativeSubclassType(type); 105 let index = findIndexForNativeSubclassType(type);
106 if (index === null) 106 if (index === null)
107 return null; 107 return null;
108 let map = dart.as(exports.mapTypeToInterceptor, core.List); 108 let map = dart.as(exports.mapTypeToInterceptor, core.List);
109 return map.get(index + 1); 109 return map.get(dart.notNull(index) + 1);
110 } 110 }
111 // Function findConstructorForNativeSubclassType: (Type, String) → dynamic 111 // Function findConstructorForNativeSubclassType: (Type, String) → dynamic
112 function findConstructorForNativeSubclassType(type, name) { 112 function findConstructorForNativeSubclassType(type, name) {
113 let index = findIndexForNativeSubclassType(type); 113 let index = findIndexForNativeSubclassType(type);
114 if (index === null) 114 if (index === null)
115 return null; 115 return null;
116 let map = dart.as(exports.mapTypeToInterceptor, core.List); 116 let map = dart.as(exports.mapTypeToInterceptor, core.List);
117 let constructorMap = map.get(index + 2); 117 let constructorMap = map.get(dart.notNull(index) + 2);
118 let constructorFn = constructorMap[name]; 118 let constructorFn = constructorMap[name];
119 return constructorFn; 119 return constructorFn;
120 } 120 }
121 // Function findInterceptorForType: (Type) → dynamic 121 // Function findInterceptorForType: (Type) → dynamic
122 function findInterceptorForType(type) { 122 function findInterceptorForType(type) {
123 let constructor = findInterceptorConstructorForType(type); 123 let constructor = findInterceptorConstructorForType(type);
124 if (constructor === null) 124 if (constructor === null)
125 return null; 125 return null;
126 return constructor.prototype; 126 return constructor.prototype;
127 } 127 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 toString() { 207 toString() {
208 return String(this); 208 return String(this);
209 } 209 }
210 } 210 }
211 let JSArray$ = dart.generic(function(E) { 211 let JSArray$ = dart.generic(function(E) {
212 class JSArray extends Interceptor { 212 class JSArray extends Interceptor {
213 JSArray() { 213 JSArray() {
214 super.Interceptor(); 214 super.Interceptor();
215 } 215 }
216 JSArray$fixed(length) { 216 JSArray$fixed(length) {
217 if (dart.notNull(!(typeof length == number)) || dart.notNull(length < 0) ) { 217 if (dart.notNull(!(typeof length == number)) || dart.notNull(length) < 0 ) {
218 throw new core.ArgumentError(`Length must be a non-negative integer: $ {length}`); 218 throw new core.ArgumentError(`Length must be a non-negative integer: $ {length}`);
219 } 219 }
220 return new JSArray.markFixed(new Array(length)); 220 return new JSArray.markFixed(new Array(length));
221 } 221 }
222 JSArray$emptyGrowable() { 222 JSArray$emptyGrowable() {
223 return new JSArray.markGrowable([]); 223 return new JSArray.markGrowable([]);
224 } 224 }
225 JSArray$growable(length) { 225 JSArray$growable(length) {
226 if (dart.notNull(!(typeof length == number)) || dart.notNull(length < 0) ) { 226 if (dart.notNull(!(typeof length == number)) || dart.notNull(length) < 0 ) {
227 throw new core.ArgumentError(`Length must be a non-negative integer: $ {length}`); 227 throw new core.ArgumentError(`Length must be a non-negative integer: $ {length}`);
228 } 228 }
229 return new JSArray.markGrowable(new Array(length)); 229 return new JSArray.markGrowable(new Array(length));
230 } 230 }
231 JSArray$typed(allocation) { 231 JSArray$typed(allocation) {
232 return dart.as(allocation, JSArray$(E)); 232 return dart.as(allocation, JSArray$(E));
233 } 233 }
234 JSArray$markFixed(allocation) { 234 JSArray$markFixed(allocation) {
235 return dart.as(markFixedList(new JSArray.typed(allocation)), JSArray$(E) ); 235 return dart.as(markFixedList(new JSArray.typed(allocation)), JSArray$(E) );
236 } 236 }
(...skipping 14 matching lines...) Expand all
251 throw new core.UnsupportedError(dart.as(reason, core.String)); 251 throw new core.UnsupportedError(dart.as(reason, core.String));
252 } 252 }
253 } 253 }
254 add(value) { 254 add(value) {
255 this.checkGrowable('add'); 255 this.checkGrowable('add');
256 this.push(value); 256 this.push(value);
257 } 257 }
258 removeAt(index) { 258 removeAt(index) {
259 if (!(typeof index == number)) 259 if (!(typeof index == number))
260 throw new core.ArgumentError(index); 260 throw new core.ArgumentError(index);
261 if (dart.notNull(index < 0) || dart.notNull(index >= this.length)) { 261 if (dart.notNull(index) < 0 || dart.notNull(index) >= dart.notNull(this. length)) {
262 throw new core.RangeError.value(index); 262 throw new core.RangeError.value(index);
263 } 263 }
264 this.checkGrowable('removeAt'); 264 this.checkGrowable('removeAt');
265 return dart.as(this.splice(index, 1)[0], E); 265 return dart.as(this.splice(index, 1)[0], E);
266 } 266 }
267 insert(index, value) { 267 insert(index, value) {
268 if (!(typeof index == number)) 268 if (!(typeof index == number))
269 throw new core.ArgumentError(index); 269 throw new core.ArgumentError(index);
270 if (dart.notNull(index < 0) || dart.notNull(index > this.length)) { 270 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this.l ength)) {
271 throw new core.RangeError.value(index); 271 throw new core.RangeError.value(index);
272 } 272 }
273 this.checkGrowable('insert'); 273 this.checkGrowable('insert');
274 this.splice(index, 0, value); 274 this.splice(index, 0, value);
275 } 275 }
276 insertAll(index, iterable) { 276 insertAll(index, iterable) {
277 this.checkGrowable('insertAll'); 277 this.checkGrowable('insertAll');
278 _internal.IterableMixinWorkaround.insertAllList(this, index, iterable); 278 _internal.IterableMixinWorkaround.insertAllList(this, index, iterable);
279 } 279 }
280 setAll(index, iterable) { 280 setAll(index, iterable) {
281 this.checkMutable('setAll'); 281 this.checkMutable('setAll');
282 _internal.IterableMixinWorkaround.setAllList(this, index, iterable); 282 _internal.IterableMixinWorkaround.setAllList(this, index, iterable);
283 } 283 }
284 removeLast() { 284 removeLast() {
285 this.checkGrowable('removeLast'); 285 this.checkGrowable('removeLast');
286 if (this.length === 0) 286 if (this.length === 0)
287 throw new core.RangeError.value(-1); 287 throw new core.RangeError.value(-1);
288 return dart.as(this.pop(), E); 288 return dart.as(this.pop(), E);
289 } 289 }
290 remove(element) { 290 remove(element) {
291 this.checkGrowable('remove'); 291 this.checkGrowable('remove');
292 for (let i = 0; i < this.length; i++) { 292 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); dart.notNul l(i)++) {
293 if (dart.equals(this.get(i), element)) { 293 if (dart.equals(this.get(i), element)) {
294 this.splice(i, 1); 294 this.splice(i, 1);
295 return true; 295 return true;
296 } 296 }
297 } 297 }
298 return false; 298 return false;
299 } 299 }
300 removeWhere(test) { 300 removeWhere(test) {
301 _internal.IterableMixinWorkaround.removeWhereList(this, dart.as(test, da rt.throw_("Unimplemented type (dynamic) → bool"))); 301 _internal.IterableMixinWorkaround.removeWhereList(this, dart.as(test, da rt.throw_("Unimplemented type (dynamic) → bool")));
302 } 302 }
303 retainWhere(test) { 303 retainWhere(test) {
304 _internal.IterableMixinWorkaround.removeWhereList(this, dart.as((element ) => !dart.notNull(test(element)), dart.throw_("Unimplemented type (dynamic) → b ool"))); 304 _internal.IterableMixinWorkaround.removeWhereList(this, dart.as((element ) => !dart.notNull(test(element)), dart.throw_("Unimplemented type (dynamic) → b ool")));
305 } 305 }
306 where(f) { 306 where(f) {
307 return new _internal.IterableMixinWorkaround().where(this, dart.as(f, da rt.throw_("Unimplemented type (dynamic) → bool"))); 307 return new _internal.IterableMixinWorkaround().where(this, dart.as(f, da rt.throw_("Unimplemented type (dynamic) → bool")));
308 } 308 }
309 expand(f) { 309 expand(f) {
310 return _internal.IterableMixinWorkaround.expand(this, dart.as(f, dart.th row_("Unimplemented type (dynamic) → Iterable<dynamic>"))); 310 return _internal.IterableMixinWorkaround.expand(this, dart.as(f, dart.th row_("Unimplemented type (dynamic) → Iterable<dynamic>")));
311 } 311 }
312 addAll(collection) { 312 addAll(collection) {
313 for (let e of collection) { 313 for (let e of collection) {
314 this.add(e); 314 this.add(e);
315 } 315 }
316 } 316 }
317 clear() { 317 clear() {
318 this.length = 0; 318 this.length = 0;
319 } 319 }
320 forEach(f) { 320 forEach(f) {
321 let length = this.length; 321 let length = this.length;
322 for (let i = 0; i < length; i++) { 322 for (let i = 0; dart.notNull(i) < dart.notNull(length); dart.notNull(i)+ +) {
323 f(dart.as(this[i], E)); 323 f(dart.as(this[i], E));
324 if (length !== this.length) { 324 if (length !== this.length) {
325 throw new core.ConcurrentModificationError(this); 325 throw new core.ConcurrentModificationError(this);
326 } 326 }
327 } 327 }
328 } 328 }
329 map(f) { 329 map(f) {
330 return _internal.IterableMixinWorkaround.mapList(this, dart.as(f, dart.t hrow_("Unimplemented type (dynamic) → dynamic"))); 330 return _internal.IterableMixinWorkaround.mapList(this, dart.as(f, dart.t hrow_("Unimplemented type (dynamic) → dynamic")));
331 } 331 }
332 join(separator) { 332 join(separator) {
333 if (separator === void 0) 333 if (separator === void 0)
334 separator = ""; 334 separator = "";
335 let list = new core.List(this.length); 335 let list = new core.List(this.length);
336 for (let i = 0; i < this.length; i++) { 336 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); dart.notNul l(i)++) {
337 list.set(i, `${this.get(i)}`); 337 list.set(i, `${this.get(i)}`);
338 } 338 }
339 return list.join(separator); 339 return list.join(separator);
340 } 340 }
341 take(n) { 341 take(n) {
342 return new _internal.IterableMixinWorkaround().takeList(this, n); 342 return new _internal.IterableMixinWorkaround().takeList(this, n);
343 } 343 }
344 takeWhile(test) { 344 takeWhile(test) {
345 return new _internal.IterableMixinWorkaround().takeWhile(this, dart.as(t est, dart.throw_("Unimplemented type (dynamic) → bool"))); 345 return new _internal.IterableMixinWorkaround().takeWhile(this, dart.as(t est, dart.throw_("Unimplemented type (dynamic) → bool")));
346 } 346 }
(...skipping 22 matching lines...) Expand all
369 } 369 }
370 elementAt(index) { 370 elementAt(index) {
371 return this.get(index); 371 return this.get(index);
372 } 372 }
373 sublist(start, end) { 373 sublist(start, end) {
374 if (end === void 0) 374 if (end === void 0)
375 end = null; 375 end = null;
376 _js_helper.checkNull(start); 376 _js_helper.checkNull(start);
377 if (!(typeof start == number)) 377 if (!(typeof start == number))
378 throw new core.ArgumentError(start); 378 throw new core.ArgumentError(start);
379 if (dart.notNull(start < 0) || dart.notNull(start > this.length)) { 379 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this.l ength)) {
380 throw new core.RangeError.range(start, 0, this.length); 380 throw new core.RangeError.range(start, 0, this.length);
381 } 381 }
382 if (end === null) { 382 if (end === null) {
383 end = this.length; 383 end = this.length;
384 } else { 384 } else {
385 if (!(typeof end == number)) 385 if (!(typeof end == number))
386 throw new core.ArgumentError(end); 386 throw new core.ArgumentError(end);
387 if (dart.notNull(end < start) || dart.notNull(end > this.length)) { 387 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dar t.notNull(this.length)) {
388 throw new core.RangeError.range(end, start, this.length); 388 throw new core.RangeError.range(end, start, this.length);
389 } 389 }
390 } 390 }
391 if (start === end) 391 if (start === end)
392 return new List.from([]); 392 return new List.from([]);
393 return new JSArray.markGrowable(this.slice(start, end)); 393 return new JSArray.markGrowable(this.slice(start, end));
394 } 394 }
395 getRange(start, end) { 395 getRange(start, end) {
396 return new _internal.IterableMixinWorkaround().getRangeList(this, start, end); 396 return new _internal.IterableMixinWorkaround().getRangeList(this, start, end);
397 } 397 }
398 get first() { 398 get first() {
399 if (this.length > 0) 399 if (dart.notNull(this.length) > 0)
400 return this.get(0); 400 return this.get(0);
401 throw new core.StateError("No elements"); 401 throw new core.StateError("No elements");
402 } 402 }
403 get last() { 403 get last() {
404 if (this.length > 0) 404 if (dart.notNull(this.length) > 0)
405 return this.get(this.length - 1); 405 return this.get(dart.notNull(this.length) - 1);
406 throw new core.StateError("No elements"); 406 throw new core.StateError("No elements");
407 } 407 }
408 get single() { 408 get single() {
409 if (this.length === 1) 409 if (this.length === 1)
410 return this.get(0); 410 return this.get(0);
411 if (this.length === 0) 411 if (this.length === 0)
412 throw new core.StateError("No elements"); 412 throw new core.StateError("No elements");
413 throw new core.StateError("More than one element"); 413 throw new core.StateError("More than one element");
414 } 414 }
415 removeRange(start, end) { 415 removeRange(start, end) {
416 this.checkGrowable('removeRange'); 416 this.checkGrowable('removeRange');
417 let receiverLength = this.length; 417 let receiverLength = this.length;
418 if (dart.notNull(start < 0) || dart.notNull(start > receiverLength)) { 418 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(receiv erLength)) {
419 throw new core.RangeError.range(start, 0, receiverLength); 419 throw new core.RangeError.range(start, 0, receiverLength);
420 } 420 }
421 if (dart.notNull(end < start) || dart.notNull(end > receiverLength)) { 421 if (dart.notNull(end) < dart.notNull(start) || dart.notNull(end) > dart. notNull(receiverLength)) {
422 throw new core.RangeError.range(end, start, receiverLength); 422 throw new core.RangeError.range(end, start, receiverLength);
423 } 423 }
424 _internal.Lists.copy(this, end, this, start, receiverLength - end); 424 _internal.Lists.copy(this, end, this, start, dart.notNull(receiverLength ) - dart.notNull(end));
425 this.length = receiverLength - (end - start); 425 this.length = dart.notNull(receiverLength) - (dart.notNull(end) - dart.n otNull(start));
426 } 426 }
427 setRange(start, end, iterable, skipCount) { 427 setRange(start, end, iterable, skipCount) {
428 if (skipCount === void 0) 428 if (skipCount === void 0)
429 skipCount = 0; 429 skipCount = 0;
430 this.checkMutable('set range'); 430 this.checkMutable('set range');
431 _internal.IterableMixinWorkaround.setRangeList(this, start, end, iterabl e, skipCount); 431 _internal.IterableMixinWorkaround.setRangeList(this, start, end, iterabl e, skipCount);
432 } 432 }
433 fillRange(start, end, fillValue) { 433 fillRange(start, end, fillValue) {
434 if (fillValue === void 0) 434 if (fillValue === void 0)
435 fillValue = null; 435 fillValue = null;
(...skipping 28 matching lines...) Expand all
464 if (start === void 0) 464 if (start === void 0)
465 start = 0; 465 start = 0;
466 return _internal.IterableMixinWorkaround.indexOfList(this, element, star t); 466 return _internal.IterableMixinWorkaround.indexOfList(this, element, star t);
467 } 467 }
468 lastIndexOf(element, start) { 468 lastIndexOf(element, start) {
469 if (start === void 0) 469 if (start === void 0)
470 start = null; 470 start = null;
471 return _internal.IterableMixinWorkaround.lastIndexOfList(this, element, start); 471 return _internal.IterableMixinWorkaround.lastIndexOfList(this, element, start);
472 } 472 }
473 contains(other) { 473 contains(other) {
474 for (let i = 0; i < this.length; i++) { 474 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); dart.notNul l(i)++) {
475 if (dart.equals(this.get(i), other)) 475 if (dart.equals(this.get(i), other))
476 return true; 476 return true;
477 } 477 }
478 return false; 478 return false;
479 } 479 }
480 get isEmpty() { 480 get isEmpty() {
481 return this.length === 0; 481 return this.length === 0;
482 } 482 }
483 get isNotEmpty() { 483 get isNotEmpty() {
484 return !dart.notNull(this.isEmpty); 484 return !dart.notNull(this.isEmpty);
(...skipping 17 matching lines...) Expand all
502 } 502 }
503 get hashCode() { 503 get hashCode() {
504 return _js_helper.Primitives.objectHashCode(this); 504 return _js_helper.Primitives.objectHashCode(this);
505 } 505 }
506 get length() { 506 get length() {
507 return dart.as(this.length, core.int); 507 return dart.as(this.length, core.int);
508 } 508 }
509 set length(newLength) { 509 set length(newLength) {
510 if (!(typeof newLength == number)) 510 if (!(typeof newLength == number))
511 throw new core.ArgumentError(newLength); 511 throw new core.ArgumentError(newLength);
512 if (newLength < 0) 512 if (dart.notNull(newLength) < 0)
513 throw new core.RangeError.value(newLength); 513 throw new core.RangeError.value(newLength);
514 this.checkGrowable('set length'); 514 this.checkGrowable('set length');
515 this.length = newLength; 515 this.length = newLength;
516 } 516 }
517 get(index) { 517 get(index) {
518 if (!(typeof index == number)) 518 if (!(typeof index == number))
519 throw new core.ArgumentError(index); 519 throw new core.ArgumentError(index);
520 if (dart.notNull(index >= this.length) || dart.notNull(index < 0)) 520 if (dart.notNull(index) >= dart.notNull(this.length) || dart.notNull(ind ex) < 0)
521 throw new core.RangeError.value(index); 521 throw new core.RangeError.value(index);
522 return dart.as(this[index], E); 522 return dart.as(this[index], E);
523 } 523 }
524 set(index, value) { 524 set(index, value) {
525 this.checkMutable('indexed set'); 525 this.checkMutable('indexed set');
526 if (!(typeof index == number)) 526 if (!(typeof index == number))
527 throw new core.ArgumentError(index); 527 throw new core.ArgumentError(index);
528 if (dart.notNull(index >= this.length) || dart.notNull(index < 0)) 528 if (dart.notNull(index) >= dart.notNull(this.length) || dart.notNull(ind ex) < 0)
529 throw new core.RangeError.value(index); 529 throw new core.RangeError.value(index);
530 this[index] = value; 530 this[index] = value;
531 } 531 }
532 asMap() { 532 asMap() {
533 return new _internal.IterableMixinWorkaround().asMapList(this); 533 return new _internal.IterableMixinWorkaround().asMapList(this);
534 } 534 }
535 } 535 }
536 dart.defineNamedConstructor(JSArray, 'fixed'); 536 dart.defineNamedConstructor(JSArray, 'fixed');
537 dart.defineNamedConstructor(JSArray, 'emptyGrowable'); 537 dart.defineNamedConstructor(JSArray, 'emptyGrowable');
538 dart.defineNamedConstructor(JSArray, 'growable'); 538 dart.defineNamedConstructor(JSArray, 'growable');
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 return -1; 598 return -1;
599 } 599 }
600 } 600 }
601 get isNegative() { 601 get isNegative() {
602 return dart.equals(this, 0) ? 1['/'](this) < 0 : this['<'](0); 602 return dart.equals(this, 0) ? 1['/'](this) < 0 : this['<'](0);
603 } 603 }
604 get isNaN() { 604 get isNaN() {
605 return isNaN(this); 605 return isNaN(this);
606 } 606 }
607 get isInfinite() { 607 get isInfinite() {
608 return dart.notNull(this == Infinity) || dart.notNull(this == -Infinity); 608 return this == Infinity || this == -Infinity;
609 } 609 }
610 get isFinite() { 610 get isFinite() {
611 return isFinite(this); 611 return isFinite(this);
612 } 612 }
613 remainder(b) { 613 remainder(b) {
614 _js_helper.checkNull(b); 614 _js_helper.checkNull(b);
615 if (!dart.is(b, core.num)) 615 if (!dart.is(b, core.num))
616 throw new core.ArgumentError(b); 616 throw new core.ArgumentError(b);
617 return this % b; 617 return this % b;
618 } 618 }
(...skipping 18 matching lines...) Expand all
637 ceil() { 637 ceil() {
638 return this.ceilToDouble().toInt(); 638 return this.ceilToDouble().toInt();
639 } 639 }
640 floor() { 640 floor() {
641 return this.floorToDouble().toInt(); 641 return this.floorToDouble().toInt();
642 } 642 }
643 round() { 643 round() {
644 return this.roundToDouble().toInt(); 644 return this.roundToDouble().toInt();
645 } 645 }
646 ceilToDouble() { 646 ceilToDouble() {
647 return dart.notNull(Math.ceil(this)); 647 return Math.ceil(this);
648 } 648 }
649 floorToDouble() { 649 floorToDouble() {
650 return dart.notNull(Math.floor(this)); 650 return Math.floor(this);
651 } 651 }
652 roundToDouble() { 652 roundToDouble() {
653 if (this['<'](0)) { 653 if (this['<'](0)) {
654 return dart.notNull(-Math.round(-this)); 654 return -Math.round(-this);
655 } else { 655 } else {
656 return dart.notNull(Math.round(this)); 656 return Math.round(this);
657 } 657 }
658 } 658 }
659 truncateToDouble() { 659 truncateToDouble() {
660 return this['<'](0) ? this.ceilToDouble() : this.floorToDouble(); 660 return this['<'](0) ? this.ceilToDouble() : this.floorToDouble();
661 } 661 }
662 clamp(lowerLimit, upperLimit) { 662 clamp(lowerLimit, upperLimit) {
663 if (!dart.is(lowerLimit, core.num)) 663 if (!dart.is(lowerLimit, core.num))
664 throw new core.ArgumentError(lowerLimit); 664 throw new core.ArgumentError(lowerLimit);
665 if (!dart.is(upperLimit, core.num)) 665 if (!dart.is(upperLimit, core.num))
666 throw new core.ArgumentError(upperLimit); 666 throw new core.ArgumentError(upperLimit);
667 if (dart.dbinary(dart.dinvoke(lowerLimit, 'compareTo', upperLimit), '>', 0 )) { 667 if (dart.dbinary(dart.dinvoke(lowerLimit, 'compareTo', upperLimit), '>', 0 )) {
668 throw new core.ArgumentError(lowerLimit); 668 throw new core.ArgumentError(lowerLimit);
669 } 669 }
670 if (this.compareTo(dart.as(lowerLimit, core.num)) < 0) 670 if (dart.notNull(this.compareTo(dart.as(lowerLimit, core.num))) < 0)
671 return dart.as(lowerLimit, core.num); 671 return dart.as(lowerLimit, core.num);
672 if (this.compareTo(dart.as(upperLimit, core.num)) > 0) 672 if (dart.notNull(this.compareTo(dart.as(upperLimit, core.num))) > 0)
673 return dart.as(upperLimit, core.num); 673 return dart.as(upperLimit, core.num);
674 return this; 674 return this;
675 } 675 }
676 toDouble() { 676 toDouble() {
677 return this; 677 return this;
678 } 678 }
679 toStringAsFixed(fractionDigits) { 679 toStringAsFixed(fractionDigits) {
680 _js_helper.checkInt(fractionDigits); 680 _js_helper.checkInt(fractionDigits);
681 if (dart.notNull(fractionDigits < 0) || dart.notNull(fractionDigits > 20)) { 681 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 20) {
682 throw new core.RangeError(fractionDigits); 682 throw new core.RangeError(fractionDigits);
683 } 683 }
684 let result = this.toFixed(fractionDigits); 684 let result = this.toFixed(fractionDigits);
685 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative)) 685 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative))
686 return `-${result}`; 686 return `-${result}`;
687 return result; 687 return result;
688 } 688 }
689 toStringAsExponential(fractionDigits) { 689 toStringAsExponential(fractionDigits) {
690 if (fractionDigits === void 0) 690 if (fractionDigits === void 0)
691 fractionDigits = null; 691 fractionDigits = null;
692 let result = null; 692 let result = null;
693 if (fractionDigits !== null) { 693 if (fractionDigits !== null) {
694 _js_helper.checkInt(fractionDigits); 694 _js_helper.checkInt(fractionDigits);
695 if (dart.notNull(fractionDigits < 0) || dart.notNull(fractionDigits > 20 )) { 695 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 2 0) {
696 throw new core.RangeError(fractionDigits); 696 throw new core.RangeError(fractionDigits);
697 } 697 }
698 result = this.toExponential(fractionDigits); 698 result = this.toExponential(fractionDigits);
699 } else { 699 } else {
700 result = this.toExponential(); 700 result = this.toExponential();
701 } 701 }
702 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative)) 702 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative))
703 return `-${result}`; 703 return `-${result}`;
704 return result; 704 return result;
705 } 705 }
706 toStringAsPrecision(precision) { 706 toStringAsPrecision(precision) {
707 _js_helper.checkInt(precision); 707 _js_helper.checkInt(precision);
708 if (dart.notNull(precision < 1) || dart.notNull(precision > 21)) { 708 if (dart.notNull(precision) < 1 || dart.notNull(precision) > 21) {
709 throw new core.RangeError(precision); 709 throw new core.RangeError(precision);
710 } 710 }
711 let result = this.toPrecision(precision); 711 let result = this.toPrecision(precision);
712 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative)) 712 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this.isNegative))
713 return `-${result}`; 713 return `-${result}`;
714 return result; 714 return result;
715 } 715 }
716 toRadixString(radix) { 716 toRadixString(radix) {
717 _js_helper.checkInt(radix); 717 _js_helper.checkInt(radix);
718 if (dart.notNull(radix < 2) || dart.notNull(radix > 36)) 718 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36)
719 throw new core.RangeError(radix); 719 throw new core.RangeError(radix);
720 let result = this.toString(radix); 720 let result = this.toString(radix);
721 let rightParenCode = 41; 721 let rightParenCode = 41;
722 if (result.codeUnitAt(result.length - 1) !== rightParenCode) { 722 if (result.codeUnitAt(dart.notNull(result.length) - 1) !== rightParenCode) {
723 return result; 723 return result;
724 } 724 }
725 return _handleIEtoString(result); 725 return _handleIEtoString(result);
726 } 726 }
727 static [_handleIEtoString](result) { 727 static [_handleIEtoString](result) {
728 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result); 728 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result);
729 if (match === null) { 729 if (match === null) {
730 throw new core.UnsupportedError(`Unexpected toString result: ${result}`) ; 730 throw new core.UnsupportedError(`Unexpected toString result: ${result}`) ;
731 } 731 }
732 let result = dart.dindex(match, 1); 732 let result = dart.dindex(match, 1);
733 let exponent = +dart.dindex(match, 3); 733 let exponent = +dart.dindex(match, 3);
734 if (dart.dindex(match, 2) !== null) { 734 if (dart.dindex(match, 2) !== null) {
735 result = result + dart.dindex(match, 2); 735 result = result + dart.dindex(match, 2);
736 exponent = dart.dindex(match, 2).length; 736 exponent = dart.dindex(match, 2).length;
737 } 737 }
738 return core.String['+'](result, core.String['*']("0", exponent)); 738 return core.String['+'](result, core.String['*']("0", exponent));
739 } 739 }
740 toString() { 740 toString() {
741 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(1 / this < 0)) { 741 if (dart.notNull(dart.equals(this, 0)) && 1 / this < 0) {
742 return '-0.0'; 742 return '-0.0';
743 } else { 743 } else {
744 return "" + this; 744 return "" + this;
745 } 745 }
746 } 746 }
747 get hashCode() { 747 get hashCode() {
748 return this & 0x1FFFFFFF; 748 return this & 0x1FFFFFFF;
749 } 749 }
750 ['-']() { 750 ['-']() {
751 return -this; 751 return -this;
(...skipping 19 matching lines...) Expand all
771 return this * other; 771 return this * other;
772 } 772 }
773 ['%'](other) { 773 ['%'](other) {
774 if (!dart.is(other, core.num)) 774 if (!dart.is(other, core.num))
775 throw new core.ArgumentError(other); 775 throw new core.ArgumentError(other);
776 let result = this % other; 776 let result = this % other;
777 if (result === 0) 777 if (result === 0)
778 return 0; 778 return 0;
779 if (dart.notNull(result) > 0) 779 if (dart.notNull(result) > 0)
780 return result; 780 return result;
781 if (dart.notNull(other) < 0) { 781 if (other < 0) {
782 return dart.notNull(result) - dart.notNull(other); 782 return dart.notNull(result) - other;
783 } else { 783 } else {
784 return dart.notNull(result) + dart.notNull(other); 784 return dart.notNull(result) + other;
785 } 785 }
786 } 786 }
787 [_isInt32](value) { 787 [_isInt32](value) {
788 return (value | 0) === value; 788 return (value | 0) === value;
789 } 789 }
790 ['~/'](other) { 790 ['~/'](other) {
791 if (false) 791 if (false)
792 this[_tdivFast](other); 792 this[_tdivFast](other);
793 if (dart.notNull(dart.notNull(dart.notNull(this[_isInt32](this)) && dart.n otNull(this[_isInt32](other))) && dart.notNull(0 !== other)) && dart.notNull(-1 !== other)) { 793 if (dart.notNull(this[_isInt32](this)) && dart.notNull(this[_isInt32](othe r)) && 0 !== other && -1 !== other) {
794 return this / other | 0; 794 return this / other | 0;
795 } else { 795 } else {
796 return this[_tdivSlow](other); 796 return this[_tdivSlow](other);
797 } 797 }
798 } 798 }
799 [_tdivFast](other) { 799 [_tdivFast](other) {
800 return this[_isInt32](this) ? this / other | 0 : (this / other).toInt(); 800 return this[_isInt32](this) ? this / other | 0 : (this / other).toInt();
801 } 801 }
802 [_tdivSlow](other) { 802 [_tdivSlow](other) {
803 if (!dart.is(other, core.num)) 803 if (!dart.is(other, core.num))
804 throw new core.ArgumentError(other); 804 throw new core.ArgumentError(other);
805 return (this / other).toInt(); 805 return (this / other).toInt();
806 } 806 }
807 ['<<'](other) { 807 ['<<'](other) {
808 if (!dart.is(other, core.num)) 808 if (!dart.is(other, core.num))
809 throw new core.ArgumentError(other); 809 throw new core.ArgumentError(other);
810 if (dart.notNull(other) < 0) 810 if (other < 0)
811 throw new core.ArgumentError(other); 811 throw new core.ArgumentError(other);
812 return this[_shlPositive](other); 812 return this[_shlPositive](other);
813 } 813 }
814 [_shlPositive](other) { 814 [_shlPositive](other) {
815 return dart.as(other > 31 ? 0 : this << other >>> 0, core.num); 815 return dart.as(other > 31 ? 0 : this << other >>> 0, core.num);
816 } 816 }
817 ['>>'](other) { 817 ['>>'](other) {
818 if (false) 818 if (false)
819 this[_shrReceiverPositive](other); 819 this[_shrReceiverPositive](other);
820 if (!dart.is(other, core.num)) 820 if (!dart.is(other, core.num))
821 throw new core.ArgumentError(other); 821 throw new core.ArgumentError(other);
822 if (dart.notNull(other) < 0) 822 if (other < 0)
823 throw new core.ArgumentError(other); 823 throw new core.ArgumentError(other);
824 return this[_shrOtherPositive](other); 824 return this[_shrOtherPositive](other);
825 } 825 }
826 [_shrOtherPositive](other) { 826 [_shrOtherPositive](other) {
827 return dart.as(dart.notNull(this) > 0 ? this[_shrBothPositive](other) : th is >> (dart.notNull(other) > 31 ? 31 : other) >>> 0, core.num); 827 return dart.as(this > 0 ? this[_shrBothPositive](other) : this >> (dart.no tNull(other) > 31 ? 31 : other) >>> 0, core.num);
828 } 828 }
829 [_shrReceiverPositive](other) { 829 [_shrReceiverPositive](other) {
830 if (dart.notNull(other) < 0) 830 if (other < 0)
831 throw new core.ArgumentError(other); 831 throw new core.ArgumentError(other);
832 return this[_shrBothPositive](other); 832 return this[_shrBothPositive](other);
833 } 833 }
834 [_shrBothPositive](other) { 834 [_shrBothPositive](other) {
835 return dart.as(other > 31 ? 0 : this >>> other, core.num); 835 return dart.as(other > 31 ? 0 : this >>> other, core.num);
836 } 836 }
837 ['&'](other) { 837 ['&'](other) {
838 if (!dart.is(other, core.num)) 838 if (!dart.is(other, core.num))
839 throw new core.ArgumentError(other); 839 throw new core.ArgumentError(other);
840 return dart.as((this & other) >>> 0, core.num); 840 return dart.as((this & other) >>> 0, core.num);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 JSInt() { 884 JSInt() {
885 super.JSNumber(); 885 super.JSNumber();
886 } 886 }
887 get isEven() { 887 get isEven() {
888 return this['&'](1) === 0; 888 return this['&'](1) === 0;
889 } 889 }
890 get isOdd() { 890 get isOdd() {
891 return this['&'](1) === 1; 891 return this['&'](1) === 1;
892 } 892 }
893 toUnsigned(width) { 893 toUnsigned(width) {
894 return dart.notNull(this['&']((1 << width) - 1)); 894 return this['&']((1 << dart.notNull(width)) - 1);
895 } 895 }
896 toSigned(width) { 896 toSigned(width) {
897 let signMask = 1 << width - 1; 897 let signMask = 1 << dart.notNull(width) - 1;
898 return dart.notNull(dart.notNull(this['&'](signMask - 1)) - dart.notNull(t his['&'](signMask))); 898 return dart.notNull(this['&'](dart.notNull(signMask) - 1)) - dart.notNull( this['&'](signMask));
899 } 899 }
900 get bitLength() { 900 get bitLength() {
901 let nonneg = dart.notNull(this['<'](0) ? dart.notNull(dart.throw_("Unimple mented PrefixExpression: -this")) - 1 : this); 901 let nonneg = this['<'](0) ? dart.notNull(dart.throw_("Unimplemented Prefix Expression: -this")) - 1 : this;
902 if (nonneg >= 4294967296) { 902 if (dart.notNull(nonneg) >= 4294967296) {
903 nonneg = (nonneg / 4294967296).truncate(); 903 nonneg = (dart.notNull(nonneg) / 4294967296).truncate();
904 return _bitCount(_spread(nonneg)) + 32; 904 return dart.notNull(_bitCount(_spread(nonneg))) + 32;
905 } 905 }
906 return _bitCount(_spread(nonneg)); 906 return _bitCount(_spread(nonneg));
907 } 907 }
908 static [_bitCount](i) { 908 static [_bitCount](i) {
909 i = dart.as(dart.dbinary(_shru(i, 0), '-', dart.dbinary(_shru(i, 1), '&', 1431655765)), core.int); 909 i = dart.as(dart.dbinary(_shru(i, 0), '-', dart.dbinary(_shru(i, 1), '&', 1431655765)), core.int);
910 i = dart.notNull((i & 858993459)['+'](dart.dbinary(_shru(i, 2), '&', 85899 3459))); 910 i = (dart.notNull(i) & 858993459)['+'](dart.dbinary(_shru(i, 2), '&', 8589 93459));
911 i = 252645135 & dart.notNull(i['+'](_shru(i, 4))); 911 i = 252645135 & i['+'](_shru(i, 4));
912 i = dart.as(_shru(i, 8), core.int); 912 i = dart.as(_shru(i, 8), core.int);
913 i = dart.as(_shru(i, 16), core.int); 913 i = dart.as(_shru(i, 16), core.int);
914 return i & 63; 914 return dart.notNull(i) & 63;
915 } 915 }
916 static [_shru](value, shift) { 916 static [_shru](value, shift) {
917 return value >>> shift; 917 return value >>> shift;
918 } 918 }
919 static [_shrs](value, shift) { 919 static [_shrs](value, shift) {
920 return value >> shift; 920 return value >> shift;
921 } 921 }
922 static [_ors](a, b) { 922 static [_ors](a, b) {
923 return a | b; 923 return a | b;
924 } 924 }
(...skipping 30 matching lines...) Expand all
955 let _isWhitespace = Symbol('_isWhitespace'); 955 let _isWhitespace = Symbol('_isWhitespace');
956 let _skipLeadingWhitespace = Symbol('_skipLeadingWhitespace'); 956 let _skipLeadingWhitespace = Symbol('_skipLeadingWhitespace');
957 let _skipTrailingWhitespace = Symbol('_skipTrailingWhitespace'); 957 let _skipTrailingWhitespace = Symbol('_skipTrailingWhitespace');
958 class JSString extends Interceptor { 958 class JSString extends Interceptor {
959 JSString() { 959 JSString() {
960 super.Interceptor(); 960 super.Interceptor();
961 } 961 }
962 codeUnitAt(index) { 962 codeUnitAt(index) {
963 if (!(typeof index == number)) 963 if (!(typeof index == number))
964 throw new core.ArgumentError(index); 964 throw new core.ArgumentError(index);
965 if (index < 0) 965 if (dart.notNull(index) < 0)
966 throw new core.RangeError.value(index); 966 throw new core.RangeError.value(index);
967 if (index >= this.length) 967 if (dart.notNull(index) >= dart.notNull(this.length))
968 throw new core.RangeError.value(index); 968 throw new core.RangeError.value(index);
969 return dart.as(this.charCodeAt(index), core.int); 969 return dart.as(this.charCodeAt(index), core.int);
970 } 970 }
971 allMatches(string, start) { 971 allMatches(string, start) {
972 if (start === void 0) 972 if (start === void 0)
973 start = 0; 973 start = 0;
974 _js_helper.checkString(string); 974 _js_helper.checkString(string);
975 _js_helper.checkInt(start); 975 _js_helper.checkInt(start);
976 if (dart.notNull(0 > start) || dart.notNull(start > string.length)) { 976 if (0 > dart.notNull(start) || dart.notNull(start) > dart.notNull(string.l ength)) {
977 throw new core.RangeError.range(start, 0, string.length); 977 throw new core.RangeError.range(start, 0, string.length);
978 } 978 }
979 return _js_helper.allMatchesInStringUnchecked(this, string, start); 979 return _js_helper.allMatchesInStringUnchecked(this, string, start);
980 } 980 }
981 matchAsPrefix(string, start) { 981 matchAsPrefix(string, start) {
982 if (start === void 0) 982 if (start === void 0)
983 start = 0; 983 start = 0;
984 if (dart.notNull(start < 0) || dart.notNull(start > string.length)) { 984 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(string.l ength)) {
985 throw new core.RangeError.range(start, 0, string.length); 985 throw new core.RangeError.range(start, 0, string.length);
986 } 986 }
987 if (start + this.length > string.length) 987 if (dart.notNull(start) + dart.notNull(this.length) > dart.notNull(string. length))
988 return null; 988 return null;
989 for (let i = 0; i < this.length; i++) { 989 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); dart.notNull( i)++) {
990 if (string.codeUnitAt(start + i) !== this.codeUnitAt(i)) { 990 if (string.codeUnitAt(dart.notNull(start) + dart.notNull(i)) !== this.co deUnitAt(i)) {
991 return null; 991 return null;
992 } 992 }
993 } 993 }
994 return new _js_helper.StringMatch(start, string, this); 994 return new _js_helper.StringMatch(start, string, this);
995 } 995 }
996 ['+'](other) { 996 ['+'](other) {
997 if (!(typeof other == string)) 997 if (!(typeof other == string))
998 throw new core.ArgumentError(other); 998 throw new core.ArgumentError(other);
999 return this + other; 999 return this + other;
1000 } 1000 }
1001 endsWith(other) { 1001 endsWith(other) {
1002 _js_helper.checkString(other); 1002 _js_helper.checkString(other);
1003 let otherLength = other.length; 1003 let otherLength = other.length;
1004 if (otherLength > this.length) 1004 if (dart.notNull(otherLength) > dart.notNull(this.length))
1005 return false; 1005 return false;
1006 return dart.equals(other, this.substring(this.length - otherLength)); 1006 return dart.equals(other, this.substring(dart.notNull(this.length) - dart. notNull(otherLength)));
1007 } 1007 }
1008 replaceAll(from, to) { 1008 replaceAll(from, to) {
1009 _js_helper.checkString(to); 1009 _js_helper.checkString(to);
1010 return dart.as(_js_helper.stringReplaceAllUnchecked(this, from, to), core. String); 1010 return dart.as(_js_helper.stringReplaceAllUnchecked(this, from, to), core. String);
1011 } 1011 }
1012 replaceAllMapped(from, convert) { 1012 replaceAllMapped(from, convert) {
1013 return this.splitMapJoin(from, {onMatch: convert}); 1013 return this.splitMapJoin(from, {onMatch: convert});
1014 } 1014 }
1015 splitMapJoin(from, opt$) { 1015 splitMapJoin(from, opt$) {
1016 let onMatch = opt$.onMatch === void 0 ? null : opt$.onMatch; 1016 let onMatch = opt$.onMatch === void 0 ? null : opt$.onMatch;
1017 let onNonMatch = opt$.onNonMatch === void 0 ? null : opt$.onNonMatch; 1017 let onNonMatch = opt$.onNonMatch === void 0 ? null : opt$.onNonMatch;
1018 return dart.as(_js_helper.stringReplaceAllFuncUnchecked(this, from, onMatc h, onNonMatch), core.String); 1018 return dart.as(_js_helper.stringReplaceAllFuncUnchecked(this, from, onMatc h, onNonMatch), core.String);
1019 } 1019 }
1020 replaceFirst(from, to, startIndex) { 1020 replaceFirst(from, to, startIndex) {
1021 if (startIndex === void 0) 1021 if (startIndex === void 0)
1022 startIndex = 0; 1022 startIndex = 0;
1023 _js_helper.checkString(to); 1023 _js_helper.checkString(to);
1024 _js_helper.checkInt(startIndex); 1024 _js_helper.checkInt(startIndex);
1025 if (dart.notNull(startIndex < 0) || dart.notNull(startIndex > this.length) ) { 1025 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul l(this.length)) {
1026 throw new core.RangeError.range(startIndex, 0, this.length); 1026 throw new core.RangeError.range(startIndex, 0, this.length);
1027 } 1027 }
1028 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star tIndex), core.String); 1028 return dart.as(_js_helper.stringReplaceFirstUnchecked(this, from, to, star tIndex), core.String);
1029 } 1029 }
1030 split(pattern) { 1030 split(pattern) {
1031 _js_helper.checkNull(pattern); 1031 _js_helper.checkNull(pattern);
1032 if (typeof pattern == string) { 1032 if (typeof pattern == string) {
1033 return dart.as(this.split(pattern), core.List$(core.String)); 1033 return dart.as(this.split(pattern), core.List$(core.String));
1034 } else if (dart.notNull(dart.is(pattern, _js_helper.JSSyntaxRegExp)) && da rt.notNull(_js_helper.regExpCaptureCount(pattern) === 0)) { 1034 } else if (dart.notNull(dart.is(pattern, _js_helper.JSSyntaxRegExp)) && _j s_helper.regExpCaptureCount(pattern) === 0) {
1035 let re = _js_helper.regExpGetNative(pattern); 1035 let re = _js_helper.regExpGetNative(pattern);
1036 return dart.as(this.split(re), core.List$(core.String)); 1036 return dart.as(this.split(re), core.List$(core.String));
1037 } else { 1037 } else {
1038 return this[_defaultSplit](pattern); 1038 return this[_defaultSplit](pattern);
1039 } 1039 }
1040 } 1040 }
1041 [_defaultSplit](pattern) { 1041 [_defaultSplit](pattern) {
1042 let result = new List.from([]); 1042 let result = new List.from([]);
1043 let start = 0; 1043 let start = 0;
1044 let length = 1; 1044 let length = 1;
1045 for (let match of pattern.allMatches(this)) { 1045 for (let match of pattern.allMatches(this)) {
1046 let matchStart = dart.as(dart.dload(match, 'start'), core.int); 1046 let matchStart = dart.as(dart.dload(match, 'start'), core.int);
1047 let matchEnd = dart.as(dart.dload(match, 'end'), core.int); 1047 let matchEnd = dart.as(dart.dload(match, 'end'), core.int);
1048 length = matchEnd - matchStart; 1048 length = dart.notNull(matchEnd) - dart.notNull(matchStart);
1049 if (dart.notNull(length === 0) && dart.notNull(start === matchStart)) { 1049 if (length === 0 && start === matchStart) {
1050 continue; 1050 continue;
1051 } 1051 }
1052 let end = matchStart; 1052 let end = matchStart;
1053 result.add(this.substring(start, end)); 1053 result.add(this.substring(start, end));
1054 start = matchEnd; 1054 start = matchEnd;
1055 } 1055 }
1056 if (dart.notNull(start < this.length) || dart.notNull(length > 0)) { 1056 if (dart.notNull(start) < dart.notNull(this.length) || dart.notNull(length ) > 0) {
1057 result.add(this.substring(start)); 1057 result.add(this.substring(start));
1058 } 1058 }
1059 return result; 1059 return result;
1060 } 1060 }
1061 startsWith(pattern, index) { 1061 startsWith(pattern, index) {
1062 if (index === void 0) 1062 if (index === void 0)
1063 index = 0; 1063 index = 0;
1064 _js_helper.checkInt(index); 1064 _js_helper.checkInt(index);
1065 if (dart.notNull(index < 0) || dart.notNull(index > this.length)) { 1065 if (dart.notNull(index) < 0 || dart.notNull(index) > dart.notNull(this.len gth)) {
1066 throw new core.RangeError.range(index, 0, this.length); 1066 throw new core.RangeError.range(index, 0, this.length);
1067 } 1067 }
1068 if (typeof pattern == string) { 1068 if (typeof pattern == string) {
1069 let other = pattern; 1069 let other = pattern;
1070 let otherLength = other.length; 1070 let otherLength = other.length;
1071 let endIndex = index + otherLength; 1071 let endIndex = dart.notNull(index) + dart.notNull(otherLength);
1072 if (endIndex > this.length) 1072 if (dart.notNull(endIndex) > dart.notNull(this.length))
1073 return false; 1073 return false;
1074 return dart.equals(other, this.substring(index, endIndex)); 1074 return dart.equals(other, this.substring(index, endIndex));
1075 } 1075 }
1076 return pattern.matchAsPrefix(this, index) !== null; 1076 return pattern.matchAsPrefix(this, index) !== null;
1077 } 1077 }
1078 substring(startIndex, endIndex) { 1078 substring(startIndex, endIndex) {
1079 if (endIndex === void 0) 1079 if (endIndex === void 0)
1080 endIndex = null; 1080 endIndex = null;
1081 _js_helper.checkInt(startIndex); 1081 _js_helper.checkInt(startIndex);
1082 if (endIndex === null) 1082 if (endIndex === null)
1083 endIndex = this.length; 1083 endIndex = this.length;
1084 _js_helper.checkInt(endIndex); 1084 _js_helper.checkInt(endIndex);
1085 if (startIndex < 0) 1085 if (dart.notNull(startIndex) < 0)
1086 throw new core.RangeError.value(startIndex); 1086 throw new core.RangeError.value(startIndex);
1087 if (startIndex > endIndex) 1087 if (dart.notNull(startIndex) > dart.notNull(endIndex))
1088 throw new core.RangeError.value(startIndex); 1088 throw new core.RangeError.value(startIndex);
1089 if (endIndex > this.length) 1089 if (dart.notNull(endIndex) > dart.notNull(this.length))
1090 throw new core.RangeError.value(endIndex); 1090 throw new core.RangeError.value(endIndex);
1091 return this.substring(startIndex, endIndex); 1091 return this.substring(startIndex, endIndex);
1092 } 1092 }
1093 toLowerCase() { 1093 toLowerCase() {
1094 return this.toLowerCase(); 1094 return this.toLowerCase();
1095 } 1095 }
1096 toUpperCase() { 1096 toUpperCase() {
1097 return this.toUpperCase(); 1097 return this.toUpperCase();
1098 } 1098 }
1099 static [_isWhitespace](codeUnit) { 1099 static [_isWhitespace](codeUnit) {
1100 if (codeUnit < 256) { 1100 if (dart.notNull(codeUnit) < 256) {
1101 switch (codeUnit) { 1101 switch (codeUnit) {
1102 case 9: 1102 case 9:
1103 case 10: 1103 case 10:
1104 case 11: 1104 case 11:
1105 case 12: 1105 case 12:
1106 case 13: 1106 case 13:
1107 case 32: 1107 case 32:
1108 case 133: 1108 case 133:
1109 case 160: 1109 case 160:
1110 return true; 1110 return true;
(...skipping 22 matching lines...) Expand all
1133 case 12288: 1133 case 12288:
1134 case 65279: 1134 case 65279:
1135 return true; 1135 return true;
1136 default: 1136 default:
1137 return false; 1137 return false;
1138 } 1138 }
1139 } 1139 }
1140 static [_skipLeadingWhitespace](string, index) { 1140 static [_skipLeadingWhitespace](string, index) {
1141 let SPACE = 32; 1141 let SPACE = 32;
1142 let CARRIAGE_RETURN = 13; 1142 let CARRIAGE_RETURN = 13;
1143 while (index < string.length) { 1143 while (dart.notNull(index) < dart.notNull(string.length)) {
1144 let codeUnit = string.codeUnitAt(index); 1144 let codeUnit = string.codeUnitAt(index);
1145 if (dart.notNull(dart.notNull(codeUnit !== SPACE) && dart.notNull(codeUn it !== CARRIAGE_RETURN)) && dart.notNull(!dart.notNull(_isWhitespace(codeUnit))) ) { 1145 if (codeUnit !== SPACE && codeUnit !== CARRIAGE_RETURN && !dart.notNull( _isWhitespace(codeUnit))) {
1146 break; 1146 break;
1147 } 1147 }
1148 index++; 1148 dart.notNull(index)++;
1149 } 1149 }
1150 return index; 1150 return index;
1151 } 1151 }
1152 static [_skipTrailingWhitespace](string, index) { 1152 static [_skipTrailingWhitespace](string, index) {
1153 let SPACE = 32; 1153 let SPACE = 32;
1154 let CARRIAGE_RETURN = 13; 1154 let CARRIAGE_RETURN = 13;
1155 while (index > 0) { 1155 while (dart.notNull(index) > 0) {
1156 let codeUnit = string.codeUnitAt(index - 1); 1156 let codeUnit = string.codeUnitAt(dart.notNull(index) - 1);
1157 if (dart.notNull(dart.notNull(codeUnit !== SPACE) && dart.notNull(codeUn it !== CARRIAGE_RETURN)) && dart.notNull(!dart.notNull(_isWhitespace(codeUnit))) ) { 1157 if (codeUnit !== SPACE && codeUnit !== CARRIAGE_RETURN && !dart.notNull( _isWhitespace(codeUnit))) {
1158 break; 1158 break;
1159 } 1159 }
1160 index--; 1160 dart.notNull(index)--;
1161 } 1161 }
1162 return index; 1162 return index;
1163 } 1163 }
1164 trim() { 1164 trim() {
1165 let NEL = 133; 1165 let NEL = 133;
1166 let result = this.trim(); 1166 let result = this.trim();
1167 if (result.length === 0) 1167 if (result.length === 0)
1168 return result; 1168 return result;
1169 let firstCode = result.codeUnitAt(0); 1169 let firstCode = result.codeUnitAt(0);
1170 let startIndex = 0; 1170 let startIndex = 0;
1171 if (firstCode === NEL) { 1171 if (firstCode === NEL) {
1172 startIndex = _skipLeadingWhitespace(result, 1); 1172 startIndex = _skipLeadingWhitespace(result, 1);
1173 if (startIndex === result.length) 1173 if (startIndex === result.length)
1174 return ""; 1174 return "";
1175 } 1175 }
1176 let endIndex = result.length; 1176 let endIndex = result.length;
1177 let lastCode = result.codeUnitAt(endIndex - 1); 1177 let lastCode = result.codeUnitAt(dart.notNull(endIndex) - 1);
1178 if (lastCode === NEL) { 1178 if (lastCode === NEL) {
1179 endIndex = _skipTrailingWhitespace(result, endIndex - 1); 1179 endIndex = _skipTrailingWhitespace(result, dart.notNull(endIndex) - 1);
1180 } 1180 }
1181 if (dart.notNull(startIndex === 0) && dart.notNull(endIndex === result.len gth)) 1181 if (startIndex === 0 && endIndex === result.length)
1182 return result; 1182 return result;
1183 return result.substring(startIndex, endIndex); 1183 return result.substring(startIndex, endIndex);
1184 } 1184 }
1185 trimLeft() { 1185 trimLeft() {
1186 let NEL = 133; 1186 let NEL = 133;
1187 let result = null; 1187 let result = null;
1188 let startIndex = 0; 1188 let startIndex = 0;
1189 if (typeof this.trimLeft != "undefined") { 1189 if (typeof this.trimLeft != "undefined") {
1190 result = this.trimLeft(); 1190 result = this.trimLeft();
1191 if (result.length === 0) 1191 if (result.length === 0)
(...skipping 14 matching lines...) Expand all
1206 } 1206 }
1207 trimRight() { 1207 trimRight() {
1208 let NEL = 133; 1208 let NEL = 133;
1209 let result = null; 1209 let result = null;
1210 let endIndex = null; 1210 let endIndex = null;
1211 if (typeof this.trimRight != "undefined") { 1211 if (typeof this.trimRight != "undefined") {
1212 result = this.trimRight(); 1212 result = this.trimRight();
1213 endIndex = result.length; 1213 endIndex = result.length;
1214 if (endIndex === 0) 1214 if (endIndex === 0)
1215 return result; 1215 return result;
1216 let lastCode = result.codeUnitAt(endIndex - 1); 1216 let lastCode = result.codeUnitAt(dart.notNull(endIndex) - 1);
1217 if (lastCode === NEL) { 1217 if (lastCode === NEL) {
1218 endIndex = _skipTrailingWhitespace(result, endIndex - 1); 1218 endIndex = _skipTrailingWhitespace(result, dart.notNull(endIndex) - 1) ;
1219 } 1219 }
1220 } else { 1220 } else {
1221 result = this; 1221 result = this;
1222 endIndex = _skipTrailingWhitespace(this, this.length); 1222 endIndex = _skipTrailingWhitespace(this, this.length);
1223 } 1223 }
1224 if (endIndex === result.length) 1224 if (endIndex === result.length)
1225 return result; 1225 return result;
1226 if (endIndex === 0) 1226 if (endIndex === 0)
1227 return ""; 1227 return "";
1228 return result.substring(0, endIndex); 1228 return result.substring(0, endIndex);
1229 } 1229 }
1230 ['*'](times) { 1230 ['*'](times) {
1231 if (0 >= times) 1231 if (0 >= dart.notNull(times))
1232 return ''; 1232 return '';
1233 if (dart.notNull(times === 1) || dart.notNull(this.length === 0)) 1233 if (times === 1 || this.length === 0)
1234 return this; 1234 return this;
1235 if (times !== times >>> 0) { 1235 if (times !== times >>> 0) {
1236 throw new core.OutOfMemoryError(); 1236 throw new core.OutOfMemoryError();
1237 } 1237 }
1238 let result = ''; 1238 let result = '';
1239 let s = this; 1239 let s = this;
1240 while (true) { 1240 while (true) {
1241 if ((times & 1) === 1) 1241 if ((dart.notNull(times) & 1) === 1)
1242 result = s['+'](result); 1242 result = s['+'](result);
1243 times = dart.as(times >>> 1, core.int); 1243 times = dart.as(times >>> 1, core.int);
1244 if (times === 0) 1244 if (times === 0)
1245 break; 1245 break;
1246 s = s; 1246 s = s;
1247 } 1247 }
1248 return result; 1248 return result;
1249 } 1249 }
1250 padLeft(width, padding) { 1250 padLeft(width, padding) {
1251 if (padding === void 0) 1251 if (padding === void 0)
1252 padding = ' '; 1252 padding = ' ';
1253 let delta = width - this.length; 1253 let delta = dart.notNull(width) - dart.notNull(this.length);
1254 if (delta <= 0) 1254 if (dart.notNull(delta) <= 0)
1255 return this; 1255 return this;
1256 return core.String['+'](core.String['*'](padding, delta), this); 1256 return core.String['+'](core.String['*'](padding, delta), this);
1257 } 1257 }
1258 padRight(width, padding) { 1258 padRight(width, padding) {
1259 if (padding === void 0) 1259 if (padding === void 0)
1260 padding = ' '; 1260 padding = ' ';
1261 let delta = width - this.length; 1261 let delta = dart.notNull(width) - dart.notNull(this.length);
1262 if (delta <= 0) 1262 if (dart.notNull(delta) <= 0)
1263 return this; 1263 return this;
1264 return this['+'](core.String['*'](padding, delta)); 1264 return this['+'](core.String['*'](padding, delta));
1265 } 1265 }
1266 get codeUnits() { 1266 get codeUnits() {
1267 return new _CodeUnits(this); 1267 return new _CodeUnits(this);
1268 } 1268 }
1269 get runes() { 1269 get runes() {
1270 return new core.Runes(this); 1270 return new core.Runes(this);
1271 } 1271 }
1272 indexOf(pattern, start) { 1272 indexOf(pattern, start) {
1273 if (start === void 0) 1273 if (start === void 0)
1274 start = 0; 1274 start = 0;
1275 _js_helper.checkNull(pattern); 1275 _js_helper.checkNull(pattern);
1276 if (!(typeof start == number)) 1276 if (!(typeof start == number))
1277 throw new core.ArgumentError(start); 1277 throw new core.ArgumentError(start);
1278 if (dart.notNull(start < 0) || dart.notNull(start > this.length)) { 1278 if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(this.len gth)) {
1279 throw new core.RangeError.range(start, 0, this.length); 1279 throw new core.RangeError.range(start, 0, this.length);
1280 } 1280 }
1281 if (typeof pattern == string) { 1281 if (typeof pattern == string) {
1282 return this.indexOf(pattern, start); 1282 return this.indexOf(pattern, start);
1283 } 1283 }
1284 if (dart.is(pattern, _js_helper.JSSyntaxRegExp)) { 1284 if (dart.is(pattern, _js_helper.JSSyntaxRegExp)) {
1285 let re = pattern; 1285 let re = pattern;
1286 let match = _js_helper.firstMatchAfter(re, this, start); 1286 let match = _js_helper.firstMatchAfter(re, this, start);
1287 return match === null ? -1 : match.start; 1287 return match === null ? -1 : match.start;
1288 } 1288 }
1289 for (let i = start; i <= this.length; i++) { 1289 for (let i = start; dart.notNull(i) <= dart.notNull(this.length); dart.not Null(i)++) {
1290 if (pattern.matchAsPrefix(this, i) !== null) 1290 if (pattern.matchAsPrefix(this, i) !== null)
1291 return i; 1291 return i;
1292 } 1292 }
1293 return -1; 1293 return -1;
1294 } 1294 }
1295 lastIndexOf(pattern, start) { 1295 lastIndexOf(pattern, start) {
1296 if (start === void 0) 1296 if (start === void 0)
1297 start = null; 1297 start = null;
1298 _js_helper.checkNull(pattern); 1298 _js_helper.checkNull(pattern);
1299 if (start === null) { 1299 if (start === null) {
1300 start = this.length; 1300 start = this.length;
1301 } else if (!(typeof start == number)) { 1301 } else if (!(typeof start == number)) {
1302 throw new core.ArgumentError(start); 1302 throw new core.ArgumentError(start);
1303 } else if (dart.notNull(start < 0) || dart.notNull(start > this.length)) { 1303 } else if (dart.notNull(start) < 0 || dart.notNull(start) > dart.notNull(t his.length)) {
1304 throw new core.RangeError.range(start, 0, this.length); 1304 throw new core.RangeError.range(start, 0, this.length);
1305 } 1305 }
1306 if (typeof pattern == string) { 1306 if (typeof pattern == string) {
1307 let other = pattern; 1307 let other = pattern;
1308 if (start + other.length > this.length) { 1308 if (dart.notNull(start) + dart.notNull(other.length) > dart.notNull(this .length)) {
1309 start = this.length - other.length; 1309 start = dart.notNull(this.length) - dart.notNull(other.length);
1310 } 1310 }
1311 return dart.as(_js_helper.stringLastIndexOfUnchecked(this, other, start) , core.int); 1311 return dart.as(_js_helper.stringLastIndexOfUnchecked(this, other, start) , core.int);
1312 } 1312 }
1313 for (let i = start; i >= 0; i--) { 1313 for (let i = start; dart.notNull(i) >= 0; dart.notNull(i)--) {
1314 if (pattern.matchAsPrefix(this, i) !== null) 1314 if (pattern.matchAsPrefix(this, i) !== null)
1315 return i; 1315 return i;
1316 } 1316 }
1317 return -1; 1317 return -1;
1318 } 1318 }
1319 contains(other, startIndex) { 1319 contains(other, startIndex) {
1320 if (startIndex === void 0) 1320 if (startIndex === void 0)
1321 startIndex = 0; 1321 startIndex = 0;
1322 _js_helper.checkNull(other); 1322 _js_helper.checkNull(other);
1323 if (dart.notNull(startIndex < 0) || dart.notNull(startIndex > this.length) ) { 1323 if (dart.notNull(startIndex) < 0 || dart.notNull(startIndex) > dart.notNul l(this.length)) {
1324 throw new core.RangeError.range(startIndex, 0, this.length); 1324 throw new core.RangeError.range(startIndex, 0, this.length);
1325 } 1325 }
1326 return dart.as(_js_helper.stringContainsUnchecked(this, other, startIndex) , core.bool); 1326 return dart.as(_js_helper.stringContainsUnchecked(this, other, startIndex) , core.bool);
1327 } 1327 }
1328 get isEmpty() { 1328 get isEmpty() {
1329 return this.length === 0; 1329 return this.length === 0;
1330 } 1330 }
1331 get isNotEmpty() { 1331 get isNotEmpty() {
1332 return !dart.notNull(this.isEmpty); 1332 return !dart.notNull(this.isEmpty);
1333 } 1333 }
1334 compareTo(other) { 1334 compareTo(other) {
1335 if (!(typeof other == string)) 1335 if (!(typeof other == string))
1336 throw new core.ArgumentError(other); 1336 throw new core.ArgumentError(other);
1337 return dart.equals(this, other) ? 0 : this < other ? -1 : 1; 1337 return dart.equals(this, other) ? 0 : this < other ? -1 : 1;
1338 } 1338 }
1339 toString() { 1339 toString() {
1340 return this; 1340 return this;
1341 } 1341 }
1342 get hashCode() { 1342 get hashCode() {
1343 let hash = 0; 1343 let hash = 0;
1344 for (let i = 0; i < this.length; i++) { 1344 for (let i = 0; dart.notNull(i) < dart.notNull(this.length); dart.notNull( i)++) {
1345 hash = 536870911 & hash + this.charCodeAt(i); 1345 hash = 536870911 & dart.notNull(hash) + this.charCodeAt(i);
1346 hash = 536870911 & hash + ((524287 & hash) << 10); 1346 hash = 536870911 & dart.notNull(hash) + ((524287 & dart.notNull(hash)) < < 10);
1347 hash = hash ^ hash >> 6; 1347 hash = hash ^ hash >> 6;
1348 } 1348 }
1349 hash = 536870911 & hash + ((67108863 & hash) << 3); 1349 hash = 536870911 & dart.notNull(hash) + ((67108863 & dart.notNull(hash)) < < 3);
1350 hash = hash ^ hash >> 11; 1350 hash = hash ^ hash >> 11;
1351 return 536870911 & hash + ((16383 & hash) << 15); 1351 return 536870911 & dart.notNull(hash) + ((16383 & dart.notNull(hash)) << 1 5);
1352 } 1352 }
1353 get runtimeType() { 1353 get runtimeType() {
1354 return core.String; 1354 return core.String;
1355 } 1355 }
1356 get length() { 1356 get length() {
1357 return this.length; 1357 return this.length;
1358 } 1358 }
1359 get(index) { 1359 get(index) {
1360 if (!(typeof index == number)) 1360 if (!(typeof index == number))
1361 throw new core.ArgumentError(index); 1361 throw new core.ArgumentError(index);
1362 if (dart.notNull(index >= this.length) || dart.notNull(index < 0)) 1362 if (dart.notNull(index) >= dart.notNull(this.length) || dart.notNull(index ) < 0)
1363 throw new core.RangeError.value(index); 1363 throw new core.RangeError.value(index);
1364 return this[index]; 1364 return this[index];
1365 } 1365 }
1366 } 1366 }
1367 let _string = Symbol('_string'); 1367 let _string = Symbol('_string');
1368 class _CodeUnits extends _internal.UnmodifiableListBase$(core.int) { 1368 class _CodeUnits extends _internal.UnmodifiableListBase$(core.int) {
1369 _CodeUnits($_string) { 1369 _CodeUnits($_string) {
1370 this[_string] = $_string; 1370 this[_string] = $_string;
1371 super.UnmodifiableListBase(); 1371 super.UnmodifiableListBase();
1372 } 1372 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 exports.JSExtendableArray = JSExtendableArray; 1410 exports.JSExtendableArray = JSExtendableArray;
1411 exports.JSExtendableArray$ = JSExtendableArray$; 1411 exports.JSExtendableArray$ = JSExtendableArray$;
1412 exports.JSNumber = JSNumber; 1412 exports.JSNumber = JSNumber;
1413 exports.JSInt = JSInt; 1413 exports.JSInt = JSInt;
1414 exports.JSDouble = JSDouble; 1414 exports.JSDouble = JSDouble;
1415 exports.JSPositiveInt = JSPositiveInt; 1415 exports.JSPositiveInt = JSPositiveInt;
1416 exports.JSUInt32 = JSUInt32; 1416 exports.JSUInt32 = JSUInt32;
1417 exports.JSUInt31 = JSUInt31; 1417 exports.JSUInt31 = JSUInt31;
1418 exports.JSString = JSString; 1418 exports.JSString = JSString;
1419 })(_interceptors || (_interceptors = {})); 1419 })(_interceptors || (_interceptors = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698