OLD | NEW |
1 var _interceptors = dart.defineLibrary(_interceptors, {}); | 1 var _interceptors = dart.defineLibrary(_interceptors, {}); |
2 var core = dart.import(core); | 2 var core = dart.import(core); |
3 var _internal = dart.import(_internal); | 3 var _internal = dart.import(_internal); |
4 var _js_helper = dart.lazyImport(_js_helper); | 4 var _js_helper = dart.lazyImport(_js_helper); |
5 var collection = dart.import(collection); | 5 var collection = dart.import(collection); |
6 var math = dart.import(math); | 6 var math = dart.import(math); |
7 (function(exports, core, _internal, _js_helper, collection, math) { | 7 (function(exports, core, _internal, _js_helper, collection, math) { |
8 'use strict'; | 8 'use strict'; |
9 let JSArray$ = dart.generic(function(E) { | 9 let JSArray$ = dart.generic(function(E) { |
10 class JSArray extends core.Object { | 10 class JSArray extends core.Object { |
(...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 let _shrReceiverPositive = Symbol('_shrReceiverPositive'); | 427 let _shrReceiverPositive = Symbol('_shrReceiverPositive'); |
428 let _shrOtherPositive = Symbol('_shrOtherPositive'); | 428 let _shrOtherPositive = Symbol('_shrOtherPositive'); |
429 let _shrBothPositive = Symbol('_shrBothPositive'); | 429 let _shrBothPositive = Symbol('_shrBothPositive'); |
430 class JSNumber extends Interceptor { | 430 class JSNumber extends Interceptor { |
431 JSNumber() { | 431 JSNumber() { |
432 super.Interceptor(); | 432 super.Interceptor(); |
433 } | 433 } |
434 compareTo(b) { | 434 compareTo(b) { |
435 if (!dart.is(b, core.num)) | 435 if (!dart.is(b, core.num)) |
436 throw new core.ArgumentError(b); | 436 throw new core.ArgumentError(b); |
437 if (this[dartx['<']](b)) { | 437 if (dart.notNull(this[dartx['<']](b))) { |
438 return -1; | 438 return -1; |
439 } else if (this[dartx['>']](b)) { | 439 } else if (dart.notNull(this[dartx['>']](b))) { |
440 return 1; | 440 return 1; |
441 } else if (dart.equals(this, b)) { | 441 } else if (dart.equals(this, b)) { |
442 if (dart.equals(this, 0)) { | 442 if (dart.equals(this, 0)) { |
443 let bIsNegative = b[dartx.isNegative]; | 443 let bIsNegative = b[dartx.isNegative]; |
444 if (this[dartx.isNegative] == bIsNegative) | 444 if (this[dartx.isNegative] == bIsNegative) |
445 return 0; | 445 return 0; |
446 if (this[dartx.isNegative]) | 446 if (dart.notNull(this[dartx.isNegative])) |
447 return -1; | 447 return -1; |
448 return 1; | 448 return 1; |
449 } | 449 } |
450 return 0; | 450 return 0; |
451 } else if (this[dartx.isNaN]) { | 451 } else if (dart.notNull(this[dartx.isNaN])) { |
452 if (b[dartx.isNaN]) { | 452 if (dart.notNull(b[dartx.isNaN])) { |
453 return 0; | 453 return 0; |
454 } | 454 } |
455 return 1; | 455 return 1; |
456 } else { | 456 } else { |
457 return -1; | 457 return -1; |
458 } | 458 } |
459 } | 459 } |
460 get isNegative() { | 460 get isNegative() { |
461 return dart.equals(this, 0) ? (1)[dartx['/']](this) < 0 : this[dartx['<']]
(0); | 461 return dart.equals(this, 0) ? (1)[dartx['/']](this) < 0 : this[dartx['<']]
(0); |
462 } | 462 } |
463 get isNaN() { | 463 get isNaN() { |
464 return isNaN(this); | 464 return isNaN(this); |
465 } | 465 } |
466 get isInfinite() { | 466 get isInfinite() { |
467 return this == Infinity || this == -Infinity; | 467 return this == Infinity || this == -Infinity; |
468 } | 468 } |
469 get isFinite() { | 469 get isFinite() { |
470 return isFinite(this); | 470 return isFinite(this); |
471 } | 471 } |
472 remainder(b) { | 472 remainder(b) { |
473 _js_helper.checkNull(b); | 473 _js_helper.checkNull(b); |
474 if (!dart.is(b, core.num)) | 474 if (!dart.is(b, core.num)) |
475 throw new core.ArgumentError(b); | 475 throw new core.ArgumentError(b); |
476 return this % b; | 476 return this % b; |
477 } | 477 } |
478 abs() { | 478 abs() { |
479 return Math.abs(this); | 479 return Math.abs(this); |
480 } | 480 } |
481 get sign() { | 481 get sign() { |
482 return this[dartx['>']](0) ? 1 : this[dartx['<']](0) ? -1 : this; | 482 return dart.notNull(this[dartx['>']](0)) ? 1 : dart.notNull(this[dartx['<'
]](0)) ? -1 : this; |
483 } | 483 } |
484 toInt() { | 484 toInt() { |
485 if (dart.notNull(this[dartx['>=']](JSNumber._MIN_INT32)) && dart.notNull(t
his[dartx['<=']](JSNumber._MAX_INT32))) { | 485 if (dart.notNull(this[dartx['>=']](JSNumber._MIN_INT32)) && dart.notNull(t
his[dartx['<=']](JSNumber._MAX_INT32))) { |
486 return this | 0; | 486 return this | 0; |
487 } | 487 } |
488 if (isFinite(this)) { | 488 if (isFinite(this)) { |
489 return this[dartx.truncateToDouble]() + 0; | 489 return this[dartx.truncateToDouble]() + 0; |
490 } | 490 } |
491 throw new core.UnsupportedError('' + this); | 491 throw new core.UnsupportedError('' + this); |
492 } | 492 } |
493 truncate() { | 493 truncate() { |
494 return this[dartx.toInt](); | 494 return this[dartx.toInt](); |
495 } | 495 } |
496 ceil() { | 496 ceil() { |
497 return this[dartx.ceilToDouble]()[dartx.toInt](); | 497 return this[dartx.ceilToDouble]()[dartx.toInt](); |
498 } | 498 } |
499 floor() { | 499 floor() { |
500 return this[dartx.floorToDouble]()[dartx.toInt](); | 500 return this[dartx.floorToDouble]()[dartx.toInt](); |
501 } | 501 } |
502 round() { | 502 round() { |
503 return this[dartx.roundToDouble]()[dartx.toInt](); | 503 return this[dartx.roundToDouble]()[dartx.toInt](); |
504 } | 504 } |
505 ceilToDouble() { | 505 ceilToDouble() { |
506 return Math.ceil(this); | 506 return Math.ceil(this); |
507 } | 507 } |
508 floorToDouble() { | 508 floorToDouble() { |
509 return Math.floor(this); | 509 return Math.floor(this); |
510 } | 510 } |
511 roundToDouble() { | 511 roundToDouble() { |
512 if (this[dartx['<']](0)) { | 512 if (dart.notNull(this[dartx['<']](0))) { |
513 return -Math.round(-this); | 513 return -Math.round(-this); |
514 } else { | 514 } else { |
515 return Math.round(this); | 515 return Math.round(this); |
516 } | 516 } |
517 } | 517 } |
518 truncateToDouble() { | 518 truncateToDouble() { |
519 return this[dartx['<']](0) ? this[dartx.ceilToDouble]() : this[dartx.floor
ToDouble](); | 519 return dart.notNull(this[dartx['<']](0)) ? this[dartx.ceilToDouble]() : th
is[dartx.floorToDouble](); |
520 } | 520 } |
521 clamp(lowerLimit, upperLimit) { | 521 clamp(lowerLimit, upperLimit) { |
522 if (!dart.is(lowerLimit, core.num)) | 522 if (!dart.is(lowerLimit, core.num)) |
523 throw new core.ArgumentError(lowerLimit); | 523 throw new core.ArgumentError(lowerLimit); |
524 if (!dart.is(upperLimit, core.num)) | 524 if (!dart.is(upperLimit, core.num)) |
525 throw new core.ArgumentError(upperLimit); | 525 throw new core.ArgumentError(upperLimit); |
526 if (dart.notNull(lowerLimit[dartx.compareTo](upperLimit)) > 0) { | 526 if (dart.notNull(lowerLimit[dartx.compareTo](upperLimit)) > 0) { |
527 throw new core.ArgumentError(lowerLimit); | 527 throw new core.ArgumentError(lowerLimit); |
528 } | 528 } |
529 if (dart.notNull(this[dartx.compareTo](lowerLimit)) < 0) | 529 if (dart.notNull(this[dartx.compareTo](lowerLimit)) < 0) |
530 return lowerLimit; | 530 return lowerLimit; |
531 if (dart.notNull(this[dartx.compareTo](upperLimit)) > 0) | 531 if (dart.notNull(this[dartx.compareTo](upperLimit)) > 0) |
532 return upperLimit; | 532 return upperLimit; |
533 return this; | 533 return this; |
534 } | 534 } |
535 toDouble() { | 535 toDouble() { |
536 return this; | 536 return this; |
537 } | 537 } |
538 toStringAsFixed(fractionDigits) { | 538 toStringAsFixed(fractionDigits) { |
539 _js_helper.checkInt(fractionDigits); | 539 _js_helper.checkInt(fractionDigits); |
540 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 20)
{ | 540 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 20)
{ |
541 throw new core.RangeError(fractionDigits); | 541 throw new core.RangeError(fractionDigits); |
542 } | 542 } |
543 let result = this.toFixed(fractionDigits); | 543 let result = this.toFixed(fractionDigits); |
544 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this[dartx.isNegati
ve])) | 544 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) |
545 return `-${result}`; | 545 return `-${result}`; |
546 return result; | 546 return result; |
547 } | 547 } |
548 toStringAsExponential(fractionDigits) { | 548 toStringAsExponential(fractionDigits) { |
549 if (fractionDigits === void 0) | 549 if (fractionDigits === void 0) |
550 fractionDigits = null; | 550 fractionDigits = null; |
551 let result = null; | 551 let result = null; |
552 if (fractionDigits != null) { | 552 if (fractionDigits != null) { |
553 _js_helper.checkInt(fractionDigits); | 553 _js_helper.checkInt(fractionDigits); |
554 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 2
0) { | 554 if (dart.notNull(fractionDigits) < 0 || dart.notNull(fractionDigits) > 2
0) { |
555 throw new core.RangeError(fractionDigits); | 555 throw new core.RangeError(fractionDigits); |
556 } | 556 } |
557 result = this.toExponential(fractionDigits); | 557 result = this.toExponential(fractionDigits); |
558 } else { | 558 } else { |
559 result = this.toExponential(); | 559 result = this.toExponential(); |
560 } | 560 } |
561 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this[dartx.isNegati
ve])) | 561 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) |
562 return `-${result}`; | 562 return `-${result}`; |
563 return result; | 563 return result; |
564 } | 564 } |
565 toStringAsPrecision(precision) { | 565 toStringAsPrecision(precision) { |
566 _js_helper.checkInt(precision); | 566 _js_helper.checkInt(precision); |
567 if (dart.notNull(precision) < 1 || dart.notNull(precision) > 21) { | 567 if (dart.notNull(precision) < 1 || dart.notNull(precision) > 21) { |
568 throw new core.RangeError(precision); | 568 throw new core.RangeError(precision); |
569 } | 569 } |
570 let result = this.toPrecision(precision); | 570 let result = this.toPrecision(precision); |
571 if (dart.notNull(dart.equals(this, 0)) && dart.notNull(this[dartx.isNegati
ve])) | 571 if (dart.equals(this, 0) && dart.notNull(this[dartx.isNegative])) |
572 return `-${result}`; | 572 return `-${result}`; |
573 return result; | 573 return result; |
574 } | 574 } |
575 toRadixString(radix) { | 575 toRadixString(radix) { |
576 _js_helper.checkInt(radix); | 576 _js_helper.checkInt(radix); |
577 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) | 577 if (dart.notNull(radix) < 2 || dart.notNull(radix) > 36) |
578 throw new core.RangeError(radix); | 578 throw new core.RangeError(radix); |
579 let result = this.toString(radix); | 579 let result = this.toString(radix); |
580 let rightParenCode = 41; | 580 let rightParenCode = 41; |
581 if (result[dartx.codeUnitAt](dart.notNull(result.length) - 1) != rightPare
nCode) { | 581 if (result[dartx.codeUnitAt](dart.notNull(result.length) - 1) != rightPare
nCode) { |
582 return result; | 582 return result; |
583 } | 583 } |
584 return JSNumber._handleIEtoString(result); | 584 return JSNumber._handleIEtoString(result); |
585 } | 585 } |
586 static _handleIEtoString(result) { | 586 static _handleIEtoString(result) { |
587 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result); | 587 let match = /^([\da-z]+)(?:\.([\da-z]+))?\(e\+(\d+)\)$/.exec(result); |
588 if (match == null) { | 588 if (match == null) { |
589 throw new core.UnsupportedError(`Unexpected toString result: ${result}`)
; | 589 throw new core.UnsupportedError(`Unexpected toString result: ${result}`)
; |
590 } | 590 } |
591 result = dart.dindex(match, 1); | 591 result = dart.dindex(match, 1); |
592 let exponent = +dart.dindex(match, 3); | 592 let exponent = +dart.dindex(match, 3); |
593 if (dart.dindex(match, 2) != null) { | 593 if (dart.dindex(match, 2) != null) { |
594 result = result + dart.dindex(match, 2); | 594 result = result + dart.dindex(match, 2); |
595 exponent = dart.notNull(exponent) - dart.dindex(match, 2).length; | 595 exponent = dart.notNull(exponent) - dart.dindex(match, 2).length; |
596 } | 596 } |
597 return dart.notNull(result) + "0"[dartx['*']](exponent); | 597 return dart.notNull(result) + "0"[dartx['*']](exponent); |
598 } | 598 } |
599 toString() { | 599 toString() { |
600 if (dart.notNull(dart.equals(this, 0)) && 1 / this < 0) { | 600 if (dart.equals(this, 0) && 1 / this < 0) { |
601 return '-0.0'; | 601 return '-0.0'; |
602 } else { | 602 } else { |
603 return "" + this; | 603 return "" + this; |
604 } | 604 } |
605 } | 605 } |
606 get hashCode() { | 606 get hashCode() { |
607 return this & 0x1FFFFFFF; | 607 return this & 0x1FFFFFFF; |
608 } | 608 } |
609 ['unary-']() { | 609 ['unary-']() { |
610 return -this; | 610 return -this; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
649 ['~/'](other) { | 649 ['~/'](other) { |
650 if (false) | 650 if (false) |
651 this[_tdivFast](other); | 651 this[_tdivFast](other); |
652 if (dart.notNull(this[_isInt32](this)) && dart.notNull(this[_isInt32](othe
r)) && 0 != other && -1 != other) { | 652 if (dart.notNull(this[_isInt32](this)) && dart.notNull(this[_isInt32](othe
r)) && 0 != other && -1 != other) { |
653 return this / other | 0; | 653 return this / other | 0; |
654 } else { | 654 } else { |
655 return this[_tdivSlow](other); | 655 return this[_tdivSlow](other); |
656 } | 656 } |
657 } | 657 } |
658 [_tdivFast](other) { | 658 [_tdivFast](other) { |
659 return this[_isInt32](this) ? this / other | 0 : (this / other)[dartx.toIn
t](); | 659 return dart.notNull(this[_isInt32](this)) ? this / other | 0 : (this / oth
er)[dartx.toInt](); |
660 } | 660 } |
661 [_tdivSlow](other) { | 661 [_tdivSlow](other) { |
662 if (!dart.is(other, core.num)) | 662 if (!dart.is(other, core.num)) |
663 throw new core.ArgumentError(other); | 663 throw new core.ArgumentError(other); |
664 return (this / other)[dartx.toInt](); | 664 return (this / other)[dartx.toInt](); |
665 } | 665 } |
666 ['<<'](other) { | 666 ['<<'](other) { |
667 if (!dart.is(other, core.num)) | 667 if (!dart.is(other, core.num)) |
668 throw new core.ArgumentError(other); | 668 throw new core.ArgumentError(other); |
669 if (other < 0) | 669 if (other < 0) |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 return this[dartx['&']](1) == 1; | 794 return this[dartx['&']](1) == 1; |
795 } | 795 } |
796 toUnsigned(width) { | 796 toUnsigned(width) { |
797 return this[dartx['&']]((1 << dart.notNull(width)) - 1); | 797 return this[dartx['&']]((1 << dart.notNull(width)) - 1); |
798 } | 798 } |
799 toSigned(width) { | 799 toSigned(width) { |
800 let signMask = 1 << dart.notNull(width) - 1; | 800 let signMask = 1 << dart.notNull(width) - 1; |
801 return dart.notNull(this[dartx['&']](dart.notNull(signMask) - 1)) - dart.n
otNull(this[dartx['&']](signMask)); | 801 return dart.notNull(this[dartx['&']](dart.notNull(signMask) - 1)) - dart.n
otNull(this[dartx['&']](signMask)); |
802 } | 802 } |
803 get bitLength() { | 803 get bitLength() { |
804 let nonneg = this[dartx['<']](0) ? dart.notNull(this[dartx['unary-']]()) -
1 : this; | 804 let nonneg = dart.notNull(this[dartx['<']](0)) ? dart.notNull(this[dartx['
unary-']]()) - 1 : this; |
805 if (dart.notNull(nonneg) >= 4294967296) { | 805 if (dart.notNull(nonneg) >= 4294967296) { |
806 nonneg = (dart.notNull(nonneg) / 4294967296).truncate(); | 806 nonneg = (dart.notNull(nonneg) / 4294967296).truncate(); |
807 return dart.notNull(JSInt._bitCount(JSInt._spread(nonneg))) + 32; | 807 return dart.notNull(JSInt._bitCount(JSInt._spread(nonneg))) + 32; |
808 } | 808 } |
809 return JSInt._bitCount(JSInt._spread(nonneg)); | 809 return JSInt._bitCount(JSInt._spread(nonneg)); |
810 } | 810 } |
811 static _bitCount(i) { | 811 static _bitCount(i) { |
812 i = dart.notNull(JSInt._shru(i, 0)) - (dart.notNull(JSInt._shru(i, 1)) & 1
431655765); | 812 i = dart.notNull(JSInt._shru(i, 0)) - (dart.notNull(JSInt._shru(i, 1)) & 1
431655765); |
813 i = (dart.notNull(i) & 858993459) + (dart.notNull(JSInt._shru(i, 2)) & 858
993459); | 813 i = (dart.notNull(i) & 858993459) + (dart.notNull(JSInt._shru(i, 2)) & 858
993459); |
814 i = 252645135 & dart.notNull(i) + dart.notNull(JSInt._shru(i, 4)); | 814 i = 252645135 & dart.notNull(i) + dart.notNull(JSInt._shru(i, 4)); |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1429 exports.JSString = JSString; | 1429 exports.JSString = JSString; |
1430 exports.getInterceptor = getInterceptor; | 1430 exports.getInterceptor = getInterceptor; |
1431 exports.JSBool = JSBool; | 1431 exports.JSBool = JSBool; |
1432 exports.JSIndexable = JSIndexable; | 1432 exports.JSIndexable = JSIndexable; |
1433 exports.JSMutableIndexable = JSMutableIndexable; | 1433 exports.JSMutableIndexable = JSMutableIndexable; |
1434 exports.JSObject = JSObject; | 1434 exports.JSObject = JSObject; |
1435 exports.JavaScriptObject = JavaScriptObject; | 1435 exports.JavaScriptObject = JavaScriptObject; |
1436 exports.PlainJavaScriptObject = PlainJavaScriptObject; | 1436 exports.PlainJavaScriptObject = PlainJavaScriptObject; |
1437 exports.UnknownJavaScriptObject = UnknownJavaScriptObject; | 1437 exports.UnknownJavaScriptObject = UnknownJavaScriptObject; |
1438 })(_interceptors, core, _internal, _js_helper, collection, math); | 1438 })(_interceptors, core, _internal, _js_helper, collection, math); |
OLD | NEW |