OLD | NEW |
1 var _internal; | 1 var _internal; |
2 (function(exports) { | 2 (function(exports) { |
3 'use strict'; | 3 'use strict'; |
4 class EfficientLength extends core.Object {} | 4 class EfficientLength extends core.Object {} |
5 let ListIterable$ = dart.generic(function(E) { | 5 let ListIterable$ = dart.generic(function(E) { |
6 class ListIterable extends collection.IterableBase$(E) { | 6 class ListIterable extends collection.IterableBase$(E) { |
7 ListIterable() { | 7 ListIterable() { |
8 super.IterableBase(); | 8 super.IterableBase(); |
9 } | 9 } |
10 get [core.$iterator]() { | 10 get [core.$iterator]() { |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 let _ = dart.JsSymbol('_'); | 354 let _ = dart.JsSymbol('_'); |
355 let _f = dart.JsSymbol('_f'); | 355 let _f = dart.JsSymbol('_f'); |
356 let MappedIterable$ = dart.generic(function(S, T) { | 356 let MappedIterable$ = dart.generic(function(S, T) { |
357 class MappedIterable extends collection.IterableBase$(T) { | 357 class MappedIterable extends collection.IterableBase$(T) { |
358 MappedIterable(iterable, func) { | 358 MappedIterable(iterable, func) { |
359 if (dart.is(iterable, EfficientLength)) { | 359 if (dart.is(iterable, EfficientLength)) { |
360 return new (EfficientLengthMappedIterable$(S, T))(iterable, func); | 360 return new (EfficientLengthMappedIterable$(S, T))(iterable, func); |
361 } | 361 } |
362 return new MappedIterable$(S, T)[_](dart.as(iterable, core.Iterable$(S))
, func); | 362 return new MappedIterable$(S, T)[_](dart.as(iterable, core.Iterable$(S))
, func); |
363 } | 363 } |
364 [_](iterable, f) { | 364 _(iterable, f) { |
365 this[_iterable] = iterable; | 365 this[_iterable] = iterable; |
366 this[_f] = f; | 366 this[_f] = f; |
367 super.IterableBase(); | 367 super.IterableBase(); |
368 } | 368 } |
369 get [core.$iterator]() { | 369 get [core.$iterator]() { |
370 return new (MappedIterator$(S, T))(this[_iterable][core.$iterator], this
[_f]); | 370 return new (MappedIterator$(S, T))(this[_iterable][core.$iterator], this
[_f]); |
371 } | 371 } |
372 get [core.$length]() { | 372 get [core.$length]() { |
373 return this[_iterable][core.$length]; | 373 return this[_iterable][core.$length]; |
374 } | 374 } |
375 get [core.$isEmpty]() { | 375 get [core.$isEmpty]() { |
376 return this[_iterable][core.$isEmpty]; | 376 return this[_iterable][core.$isEmpty]; |
377 } | 377 } |
378 get [core.$first]() { | 378 get [core.$first]() { |
379 return this[_f](this[_iterable][core.$first]); | 379 return this[_f](this[_iterable][core.$first]); |
380 } | 380 } |
381 get [core.$last]() { | 381 get [core.$last]() { |
382 return this[_f](this[_iterable][core.$last]); | 382 return this[_f](this[_iterable][core.$last]); |
383 } | 383 } |
384 get [core.$single]() { | 384 get [core.$single]() { |
385 return this[_f](this[_iterable][core.$single]); | 385 return this[_f](this[_iterable][core.$single]); |
386 } | 386 } |
387 [core.$elementAt](index) { | 387 [core.$elementAt](index) { |
388 return this[_f](this[_iterable][core.$elementAt](index)); | 388 return this[_f](this[_iterable][core.$elementAt](index)); |
389 } | 389 } |
390 } | 390 } |
391 dart.defineNamedConstructor(MappedIterable, _); | 391 dart.defineNamedConstructor(MappedIterable, '_'); |
392 return MappedIterable; | 392 return MappedIterable; |
393 }); | 393 }); |
394 let MappedIterable = MappedIterable$(); | 394 let MappedIterable = MappedIterable$(); |
395 let EfficientLengthMappedIterable$ = dart.generic(function(S, T) { | 395 let EfficientLengthMappedIterable$ = dart.generic(function(S, T) { |
396 class EfficientLengthMappedIterable extends MappedIterable$(S, T) { | 396 class EfficientLengthMappedIterable extends MappedIterable$(S, T) { |
397 EfficientLengthMappedIterable(iterable, func) { | 397 EfficientLengthMappedIterable(iterable, func) { |
398 super[_](dart.as(iterable, core.Iterable$(S)), func); | 398 super._(dart.as(iterable, core.Iterable$(S)), func); |
399 } | 399 } |
400 } | 400 } |
401 EfficientLengthMappedIterable[dart.implements] = () => [EfficientLength]; | 401 EfficientLengthMappedIterable[dart.implements] = () => [EfficientLength]; |
402 return EfficientLengthMappedIterable; | 402 return EfficientLengthMappedIterable; |
403 }); | 403 }); |
404 let EfficientLengthMappedIterable = EfficientLengthMappedIterable$(); | 404 let EfficientLengthMappedIterable = EfficientLengthMappedIterable$(); |
405 let _iterator = dart.JsSymbol('_iterator'); | 405 let _iterator = dart.JsSymbol('_iterator'); |
406 let MappedIterator$ = dart.generic(function(S, T) { | 406 let MappedIterator$ = dart.generic(function(S, T) { |
407 class MappedIterator extends core.Iterator$(T) { | 407 class MappedIterator extends core.Iterator$(T) { |
408 MappedIterator(iterator, f) { | 408 MappedIterator(iterator, f) { |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 class TakeIterable extends collection.IterableBase$(E) { | 542 class TakeIterable extends collection.IterableBase$(E) { |
543 TakeIterable(iterable, takeCount) { | 543 TakeIterable(iterable, takeCount) { |
544 if (!(typeof takeCount == 'number') || dart.notNull(takeCount) < 0) { | 544 if (!(typeof takeCount == 'number') || dart.notNull(takeCount) < 0) { |
545 throw new core.ArgumentError(takeCount); | 545 throw new core.ArgumentError(takeCount); |
546 } | 546 } |
547 if (dart.is(iterable, EfficientLength)) { | 547 if (dart.is(iterable, EfficientLength)) { |
548 return new (EfficientLengthTakeIterable$(E))(iterable, takeCount); | 548 return new (EfficientLengthTakeIterable$(E))(iterable, takeCount); |
549 } | 549 } |
550 return new TakeIterable$(E)[_](iterable, takeCount); | 550 return new TakeIterable$(E)[_](iterable, takeCount); |
551 } | 551 } |
552 [_](iterable, takeCount) { | 552 _(iterable, takeCount) { |
553 this[_iterable] = iterable; | 553 this[_iterable] = iterable; |
554 this[_takeCount] = takeCount; | 554 this[_takeCount] = takeCount; |
555 super.IterableBase(); | 555 super.IterableBase(); |
556 } | 556 } |
557 get [core.$iterator]() { | 557 get [core.$iterator]() { |
558 return new (TakeIterator$(E))(this[_iterable][core.$iterator], this[_tak
eCount]); | 558 return new (TakeIterator$(E))(this[_iterable][core.$iterator], this[_tak
eCount]); |
559 } | 559 } |
560 } | 560 } |
561 dart.defineNamedConstructor(TakeIterable, _); | 561 dart.defineNamedConstructor(TakeIterable, '_'); |
562 return TakeIterable; | 562 return TakeIterable; |
563 }); | 563 }); |
564 let TakeIterable = TakeIterable$(); | 564 let TakeIterable = TakeIterable$(); |
565 let EfficientLengthTakeIterable$ = dart.generic(function(E) { | 565 let EfficientLengthTakeIterable$ = dart.generic(function(E) { |
566 class EfficientLengthTakeIterable extends TakeIterable$(E) { | 566 class EfficientLengthTakeIterable extends TakeIterable$(E) { |
567 EfficientLengthTakeIterable(iterable, takeCount) { | 567 EfficientLengthTakeIterable(iterable, takeCount) { |
568 super[_](iterable, takeCount); | 568 super._(iterable, takeCount); |
569 } | 569 } |
570 get [core.$length]() { | 570 get [core.$length]() { |
571 let iterableLength = this[_iterable][core.$length]; | 571 let iterableLength = this[_iterable][core.$length]; |
572 if (dart.notNull(iterableLength) > dart.notNull(this[_takeCount])) | 572 if (dart.notNull(iterableLength) > dart.notNull(this[_takeCount])) |
573 return this[_takeCount]; | 573 return this[_takeCount]; |
574 return iterableLength; | 574 return iterableLength; |
575 } | 575 } |
576 } | 576 } |
577 EfficientLengthTakeIterable[dart.implements] = () => [EfficientLength]; | 577 EfficientLengthTakeIterable[dart.implements] = () => [EfficientLength]; |
578 return EfficientLengthTakeIterable; | 578 return EfficientLengthTakeIterable; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 let TakeWhileIterator = TakeWhileIterator$(); | 645 let TakeWhileIterator = TakeWhileIterator$(); |
646 let _skipCount = dart.JsSymbol('_skipCount'); | 646 let _skipCount = dart.JsSymbol('_skipCount'); |
647 let SkipIterable$ = dart.generic(function(E) { | 647 let SkipIterable$ = dart.generic(function(E) { |
648 class SkipIterable extends collection.IterableBase$(E) { | 648 class SkipIterable extends collection.IterableBase$(E) { |
649 SkipIterable(iterable, count) { | 649 SkipIterable(iterable, count) { |
650 if (dart.is(iterable, EfficientLength)) { | 650 if (dart.is(iterable, EfficientLength)) { |
651 return new (EfficientLengthSkipIterable$(E))(iterable, count); | 651 return new (EfficientLengthSkipIterable$(E))(iterable, count); |
652 } | 652 } |
653 return new SkipIterable$(E)[_](iterable, count); | 653 return new SkipIterable$(E)[_](iterable, count); |
654 } | 654 } |
655 [_](iterable, skipCount) { | 655 _(iterable, skipCount) { |
656 this[_iterable] = iterable; | 656 this[_iterable] = iterable; |
657 this[_skipCount] = skipCount; | 657 this[_skipCount] = skipCount; |
658 super.IterableBase(); | 658 super.IterableBase(); |
659 if (!(typeof this[_skipCount] == 'number')) { | 659 if (!(typeof this[_skipCount] == 'number')) { |
660 throw new core.ArgumentError.value(this[_skipCount], "count is not an
integer"); | 660 throw new core.ArgumentError.value(this[_skipCount], "count is not an
integer"); |
661 } | 661 } |
662 core.RangeError.checkNotNegative(this[_skipCount], "count"); | 662 core.RangeError.checkNotNegative(this[_skipCount], "count"); |
663 } | 663 } |
664 [core.$skip](count) { | 664 [core.$skip](count) { |
665 if (!(typeof this[_skipCount] == 'number')) { | 665 if (!(typeof this[_skipCount] == 'number')) { |
666 throw new core.ArgumentError.value(this[_skipCount], "count is not an
integer"); | 666 throw new core.ArgumentError.value(this[_skipCount], "count is not an
integer"); |
667 } | 667 } |
668 core.RangeError.checkNotNegative(this[_skipCount], "count"); | 668 core.RangeError.checkNotNegative(this[_skipCount], "count"); |
669 return new SkipIterable$(E)[_](this[_iterable], dart.notNull(this[_skipC
ount]) + dart.notNull(count)); | 669 return new SkipIterable$(E)[_](this[_iterable], dart.notNull(this[_skipC
ount]) + dart.notNull(count)); |
670 } | 670 } |
671 get [core.$iterator]() { | 671 get [core.$iterator]() { |
672 return new (SkipIterator$(E))(this[_iterable][core.$iterator], this[_ski
pCount]); | 672 return new (SkipIterator$(E))(this[_iterable][core.$iterator], this[_ski
pCount]); |
673 } | 673 } |
674 } | 674 } |
675 dart.defineNamedConstructor(SkipIterable, _); | 675 dart.defineNamedConstructor(SkipIterable, '_'); |
676 return SkipIterable; | 676 return SkipIterable; |
677 }); | 677 }); |
678 let SkipIterable = SkipIterable$(); | 678 let SkipIterable = SkipIterable$(); |
679 let EfficientLengthSkipIterable$ = dart.generic(function(E) { | 679 let EfficientLengthSkipIterable$ = dart.generic(function(E) { |
680 class EfficientLengthSkipIterable extends SkipIterable$(E) { | 680 class EfficientLengthSkipIterable extends SkipIterable$(E) { |
681 EfficientLengthSkipIterable(iterable, skipCount) { | 681 EfficientLengthSkipIterable(iterable, skipCount) { |
682 super[_](iterable, skipCount); | 682 super._(iterable, skipCount); |
683 } | 683 } |
684 get [core.$length]() { | 684 get [core.$length]() { |
685 let length = dart.notNull(this[_iterable][core.$length]) - dart.notNull(
this[_skipCount]); | 685 let length = dart.notNull(this[_iterable][core.$length]) - dart.notNull(
this[_skipCount]); |
686 if (dart.notNull(length) >= 0) | 686 if (dart.notNull(length) >= 0) |
687 return length; | 687 return length; |
688 return 0; | 688 return 0; |
689 } | 689 } |
690 } | 690 } |
691 EfficientLengthSkipIterable[dart.implements] = () => [EfficientLength]; | 691 EfficientLengthSkipIterable[dart.implements] = () => [EfficientLength]; |
692 return EfficientLengthSkipIterable; | 692 return EfficientLengthSkipIterable; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 EmptyIterator[dart.implements] = () => [core.Iterator$(E)]; | 862 EmptyIterator[dart.implements] = () => [core.Iterator$(E)]; |
863 return EmptyIterator; | 863 return EmptyIterator; |
864 }); | 864 }); |
865 let EmptyIterator = EmptyIterator$(); | 865 let EmptyIterator = EmptyIterator$(); |
866 let BidirectionalIterator$ = dart.generic(function(T) { | 866 let BidirectionalIterator$ = dart.generic(function(T) { |
867 class BidirectionalIterator extends core.Object {} | 867 class BidirectionalIterator extends core.Object {} |
868 BidirectionalIterator[dart.implements] = () => [core.Iterator$(T)]; | 868 BidirectionalIterator[dart.implements] = () => [core.Iterator$(T)]; |
869 return BidirectionalIterator; | 869 return BidirectionalIterator; |
870 }); | 870 }); |
871 let BidirectionalIterator = BidirectionalIterator$(); | 871 let BidirectionalIterator = BidirectionalIterator$(); |
872 let _rangeCheck = dart.JsSymbol('_rangeCheck'); | |
873 let IterableMixinWorkaround$ = dart.generic(function(T) { | 872 let IterableMixinWorkaround$ = dart.generic(function(T) { |
874 class IterableMixinWorkaround extends core.Object { | 873 class IterableMixinWorkaround extends core.Object { |
875 static contains(iterable, element) { | 874 static contains(iterable, element) { |
876 for (let e of iterable) { | 875 for (let e of iterable) { |
877 if (dart.equals(e, element)) | 876 if (dart.equals(e, element)) |
878 return true; | 877 return true; |
879 } | 878 } |
880 return false; | 879 return false; |
881 } | 880 } |
882 static forEach(iterable, f) { | 881 static forEach(iterable, f) { |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 } | 1097 } |
1099 } | 1098 } |
1100 static indexOfList(list, element, start) { | 1099 static indexOfList(list, element, start) { |
1101 return Lists.indexOf(list, element, start, list[core.$length]); | 1100 return Lists.indexOf(list, element, start, list[core.$length]); |
1102 } | 1101 } |
1103 static lastIndexOfList(list, element, start) { | 1102 static lastIndexOfList(list, element, start) { |
1104 if (start == null) | 1103 if (start == null) |
1105 start = dart.notNull(list[core.$length]) - 1; | 1104 start = dart.notNull(list[core.$length]) - 1; |
1106 return Lists.lastIndexOf(list, element, start); | 1105 return Lists.lastIndexOf(list, element, start); |
1107 } | 1106 } |
1108 static [_rangeCheck](list, start, end) { | 1107 static _rangeCheck(list, start, end) { |
1109 core.RangeError.checkValidRange(start, end, list[core.$length]); | 1108 core.RangeError.checkValidRange(start, end, list[core.$length]); |
1110 } | 1109 } |
1111 getRangeList(list, start, end) { | 1110 getRangeList(list, start, end) { |
1112 IterableMixinWorkaround[_rangeCheck](list, start, end); | 1111 IterableMixinWorkaround._rangeCheck(list, start, end); |
1113 return new (SubListIterable$(T))(dart.as(list, core.Iterable$(T)), start
, end); | 1112 return new (SubListIterable$(T))(dart.as(list, core.Iterable$(T)), start
, end); |
1114 } | 1113 } |
1115 static setRangeList(list, start, end, from, skipCount) { | 1114 static setRangeList(list, start, end, from, skipCount) { |
1116 IterableMixinWorkaround[_rangeCheck](list, start, end); | 1115 IterableMixinWorkaround._rangeCheck(list, start, end); |
1117 let length = dart.notNull(end) - dart.notNull(start); | 1116 let length = dart.notNull(end) - dart.notNull(start); |
1118 if (length == 0) | 1117 if (length == 0) |
1119 return; | 1118 return; |
1120 if (dart.notNull(skipCount) < 0) | 1119 if (dart.notNull(skipCount) < 0) |
1121 throw new core.ArgumentError(skipCount); | 1120 throw new core.ArgumentError(skipCount); |
1122 let otherList = null; | 1121 let otherList = null; |
1123 let otherStart = null; | 1122 let otherStart = null; |
1124 if (dart.is(from, core.List)) { | 1123 if (dart.is(from, core.List)) { |
1125 otherList = from; | 1124 otherList = from; |
1126 otherStart = skipCount; | 1125 otherStart = skipCount; |
1127 } else { | 1126 } else { |
1128 otherList = from[core.$skip](skipCount)[core.$toList]({growable: false
}); | 1127 otherList = from[core.$skip](skipCount)[core.$toList]({growable: false
}); |
1129 otherStart = 0; | 1128 otherStart = 0; |
1130 } | 1129 } |
1131 if (dart.notNull(otherStart) + dart.notNull(length) > dart.notNull(other
List[core.$length])) { | 1130 if (dart.notNull(otherStart) + dart.notNull(length) > dart.notNull(other
List[core.$length])) { |
1132 throw IterableElementError.tooFew(); | 1131 throw IterableElementError.tooFew(); |
1133 } | 1132 } |
1134 Lists.copy(otherList, otherStart, list, start, length); | 1133 Lists.copy(otherList, otherStart, list, start, length); |
1135 } | 1134 } |
1136 static replaceRangeList(list, start, end, iterable) { | 1135 static replaceRangeList(list, start, end, iterable) { |
1137 IterableMixinWorkaround[_rangeCheck](list, start, end); | 1136 IterableMixinWorkaround._rangeCheck(list, start, end); |
1138 if (!dart.is(iterable, EfficientLength)) { | 1137 if (!dart.is(iterable, EfficientLength)) { |
1139 iterable = iterable[core.$toList](); | 1138 iterable = iterable[core.$toList](); |
1140 } | 1139 } |
1141 let removeLength = dart.notNull(end) - dart.notNull(start); | 1140 let removeLength = dart.notNull(end) - dart.notNull(start); |
1142 let insertLength = iterable[core.$length]; | 1141 let insertLength = iterable[core.$length]; |
1143 if (dart.notNull(removeLength) >= dart.notNull(insertLength)) { | 1142 if (dart.notNull(removeLength) >= dart.notNull(insertLength)) { |
1144 let delta = dart.notNull(removeLength) - dart.notNull(insertLength); | 1143 let delta = dart.notNull(removeLength) - dart.notNull(insertLength); |
1145 let insertEnd = dart.notNull(start) + dart.notNull(insertLength); | 1144 let insertEnd = dart.notNull(start) + dart.notNull(insertLength); |
1146 let newEnd = dart.notNull(list[core.$length]) - dart.notNull(delta); | 1145 let newEnd = dart.notNull(list[core.$length]) - dart.notNull(delta); |
1147 list[core.$setRange](start, insertEnd, iterable); | 1146 list[core.$setRange](start, insertEnd, iterable); |
1148 if (delta != 0) { | 1147 if (delta != 0) { |
1149 list[core.$setRange](insertEnd, newEnd, list, end); | 1148 list[core.$setRange](insertEnd, newEnd, list, end); |
1150 list[core.$length] = newEnd; | 1149 list[core.$length] = newEnd; |
1151 } | 1150 } |
1152 } else { | 1151 } else { |
1153 let delta = dart.notNull(insertLength) - dart.notNull(removeLength); | 1152 let delta = dart.notNull(insertLength) - dart.notNull(removeLength); |
1154 let newLength = dart.notNull(list[core.$length]) + dart.notNull(delta)
; | 1153 let newLength = dart.notNull(list[core.$length]) + dart.notNull(delta)
; |
1155 let insertEnd = dart.notNull(start) + dart.notNull(insertLength); | 1154 let insertEnd = dart.notNull(start) + dart.notNull(insertLength); |
1156 list[core.$length] = newLength; | 1155 list[core.$length] = newLength; |
1157 list[core.$setRange](insertEnd, newLength, list, end); | 1156 list[core.$setRange](insertEnd, newLength, list, end); |
1158 list[core.$setRange](start, insertEnd, iterable); | 1157 list[core.$setRange](start, insertEnd, iterable); |
1159 } | 1158 } |
1160 } | 1159 } |
1161 static fillRangeList(list, start, end, fillValue) { | 1160 static fillRangeList(list, start, end, fillValue) { |
1162 IterableMixinWorkaround[_rangeCheck](list, start, end); | 1161 IterableMixinWorkaround._rangeCheck(list, start, end); |
1163 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { | 1162 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul
l(i) + 1) { |
1164 list[core.$set](i, fillValue); | 1163 list[core.$set](i, fillValue); |
1165 } | 1164 } |
1166 } | 1165 } |
1167 static insertAllList(list, index, iterable) { | 1166 static insertAllList(list, index, iterable) { |
1168 core.RangeError.checkValueInInterval(index, 0, list[core.$length], "inde
x"); | 1167 core.RangeError.checkValueInInterval(index, 0, list[core.$length], "inde
x"); |
1169 if (!dart.is(iterable, EfficientLength)) { | 1168 if (!dart.is(iterable, EfficientLength)) { |
1170 iterable = iterable[core.$toList]({growable: false}); | 1169 iterable = iterable[core.$toList]({growable: false}); |
1171 } | 1170 } |
1172 let insertionLength = iterable[core.$length]; | 1171 let insertionLength = iterable[core.$length]; |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1578 let message = `${start} + ${length} must be in the range [0..${a[core.$l
ength]}]`; | 1577 let message = `${start} + ${length} must be in the range [0..${a[core.$l
ength]}]`; |
1579 throw new core.RangeError.range(length, 0, dart.notNull(a[core.$length])
- dart.notNull(start), "length", message); | 1578 throw new core.RangeError.range(length, 0, dart.notNull(a[core.$length])
- dart.notNull(start), "length", message); |
1580 } | 1579 } |
1581 } | 1580 } |
1582 } | 1581 } |
1583 exports.printToZone = null; | 1582 exports.printToZone = null; |
1584 // Function printToConsole: (String) → void | 1583 // Function printToConsole: (String) → void |
1585 function printToConsole(line) { | 1584 function printToConsole(line) { |
1586 _js_primitives.printString(`${line}`); | 1585 _js_primitives.printString(`${line}`); |
1587 } | 1586 } |
1588 let _doSort = dart.JsSymbol('_doSort'); | |
1589 let _INSERTION_SORT_THRESHOLD = dart.JsSymbol('_INSERTION_SORT_THRESHOLD'); | |
1590 let _insertionSort = dart.JsSymbol('_insertionSort'); | |
1591 let _dualPivotQuicksort = dart.JsSymbol('_dualPivotQuicksort'); | |
1592 class Sort extends core.Object { | 1587 class Sort extends core.Object { |
1593 static sort(a, compare) { | 1588 static sort(a, compare) { |
1594 Sort[_doSort](a, 0, dart.notNull(a[core.$length]) - 1, compare); | 1589 Sort._doSort(a, 0, dart.notNull(a[core.$length]) - 1, compare); |
1595 } | 1590 } |
1596 static sortRange(a, from, to, compare) { | 1591 static sortRange(a, from, to, compare) { |
1597 if (dart.notNull(from) < 0 || dart.notNull(to) > dart.notNull(a[core.$leng
th]) || dart.notNull(to) < dart.notNull(from)) { | 1592 if (dart.notNull(from) < 0 || dart.notNull(to) > dart.notNull(a[core.$leng
th]) || dart.notNull(to) < dart.notNull(from)) { |
1598 throw "OutOfRange"; | 1593 throw "OutOfRange"; |
1599 } | 1594 } |
1600 Sort[_doSort](a, from, dart.notNull(to) - 1, compare); | 1595 Sort._doSort(a, from, dart.notNull(to) - 1, compare); |
1601 } | 1596 } |
1602 static [_doSort](a, left, right, compare) { | 1597 static _doSort(a, left, right, compare) { |
1603 if (dart.notNull(right) - dart.notNull(left) <= dart.notNull(Sort[_INSERTI
ON_SORT_THRESHOLD])) { | 1598 if (dart.notNull(right) - dart.notNull(left) <= dart.notNull(Sort._INSERTI
ON_SORT_THRESHOLD)) { |
1604 Sort[_insertionSort](a, left, right, compare); | 1599 Sort._insertionSort(a, left, right, compare); |
1605 } else { | 1600 } else { |
1606 Sort[_dualPivotQuicksort](a, left, right, compare); | 1601 Sort._dualPivotQuicksort(a, left, right, compare); |
1607 } | 1602 } |
1608 } | 1603 } |
1609 static [_insertionSort](a, left, right, compare) { | 1604 static _insertionSort(a, left, right, compare) { |
1610 for (let i = dart.notNull(left) + 1; dart.notNull(i) <= dart.notNull(right
); i = dart.notNull(i) + 1) { | 1605 for (let i = dart.notNull(left) + 1; dart.notNull(i) <= dart.notNull(right
); i = dart.notNull(i) + 1) { |
1611 let el = a[core.$get](i); | 1606 let el = a[core.$get](i); |
1612 let j = i; | 1607 let j = i; |
1613 while (dart.notNull(j) > dart.notNull(left) && dart.notNull(dart.dcall(c
ompare, a[core.$get](dart.notNull(j) - 1), el)) > 0) { | 1608 while (dart.notNull(j) > dart.notNull(left) && dart.notNull(dart.dcall(c
ompare, a[core.$get](dart.notNull(j) - 1), el)) > 0) { |
1614 a[core.$set](j, a[core.$get](dart.notNull(j) - 1)); | 1609 a[core.$set](j, a[core.$get](dart.notNull(j) - 1)); |
1615 j = dart.notNull(j) - 1; | 1610 j = dart.notNull(j) - 1; |
1616 } | 1611 } |
1617 a[core.$set](j, el); | 1612 a[core.$set](j, el); |
1618 } | 1613 } |
1619 } | 1614 } |
1620 static [_dualPivotQuicksort](a, left, right, compare) { | 1615 static _dualPivotQuicksort(a, left, right, compare) { |
1621 dart.assert(dart.notNull(right) - dart.notNull(left) > dart.notNull(Sort[_
INSERTION_SORT_THRESHOLD])); | 1616 dart.assert(dart.notNull(right) - dart.notNull(left) > dart.notNull(Sort._
INSERTION_SORT_THRESHOLD)); |
1622 let sixth = ((dart.notNull(right) - dart.notNull(left) + 1) / 6).truncate(
); | 1617 let sixth = ((dart.notNull(right) - dart.notNull(left) + 1) / 6).truncate(
); |
1623 let index1 = dart.notNull(left) + dart.notNull(sixth); | 1618 let index1 = dart.notNull(left) + dart.notNull(sixth); |
1624 let index5 = dart.notNull(right) - dart.notNull(sixth); | 1619 let index5 = dart.notNull(right) - dart.notNull(sixth); |
1625 let index3 = ((dart.notNull(left) + dart.notNull(right)) / 2).truncate(); | 1620 let index3 = ((dart.notNull(left) + dart.notNull(right)) / 2).truncate(); |
1626 let index2 = dart.notNull(index3) - dart.notNull(sixth); | 1621 let index2 = dart.notNull(index3) - dart.notNull(sixth); |
1627 let index4 = dart.notNull(index3) + dart.notNull(sixth); | 1622 let index4 = dart.notNull(index3) + dart.notNull(sixth); |
1628 let el1 = a[core.$get](index1); | 1623 let el1 = a[core.$get](index1); |
1629 let el2 = a[core.$get](index2); | 1624 let el2 = a[core.$get](index2); |
1630 let el3 = a[core.$get](index3); | 1625 let el3 = a[core.$get](index3); |
1631 let el4 = a[core.$get](index4); | 1626 let el4 = a[core.$get](index4); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1775 } | 1770 } |
1776 } | 1771 } |
1777 } | 1772 } |
1778 } | 1773 } |
1779 } | 1774 } |
1780 } | 1775 } |
1781 a[core.$set](left, a[core.$get](dart.notNull(less) - 1)); | 1776 a[core.$set](left, a[core.$get](dart.notNull(less) - 1)); |
1782 a[core.$set](dart.notNull(less) - 1, pivot1); | 1777 a[core.$set](dart.notNull(less) - 1, pivot1); |
1783 a[core.$set](right, a[core.$get](dart.notNull(great) + 1)); | 1778 a[core.$set](right, a[core.$get](dart.notNull(great) + 1)); |
1784 a[core.$set](dart.notNull(great) + 1, pivot2); | 1779 a[core.$set](dart.notNull(great) + 1, pivot2); |
1785 Sort[_doSort](a, left, dart.notNull(less) - 2, compare); | 1780 Sort._doSort(a, left, dart.notNull(less) - 2, compare); |
1786 Sort[_doSort](a, dart.notNull(great) + 2, right, compare); | 1781 Sort._doSort(a, dart.notNull(great) + 2, right, compare); |
1787 if (pivots_are_equal) { | 1782 if (pivots_are_equal) { |
1788 return; | 1783 return; |
1789 } | 1784 } |
1790 if (dart.notNull(less) < dart.notNull(index1) && dart.notNull(great) > dar
t.notNull(index5)) { | 1785 if (dart.notNull(less) < dart.notNull(index1) && dart.notNull(great) > dar
t.notNull(index5)) { |
1791 while (dart.dcall(compare, a[core.$get](less), pivot1) == 0) { | 1786 while (dart.dcall(compare, a[core.$get](less), pivot1) == 0) { |
1792 less = dart.notNull(less) + 1; | 1787 less = dart.notNull(less) + 1; |
1793 } | 1788 } |
1794 while (dart.dcall(compare, a[core.$get](great), pivot2) == 0) { | 1789 while (dart.dcall(compare, a[core.$get](great), pivot2) == 0) { |
1795 great = dart.notNull(great) - 1; | 1790 great = dart.notNull(great) - 1; |
1796 } | 1791 } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1834 great = dart.notNull(x) - 1; | 1829 great = dart.notNull(x) - 1; |
1835 return x; | 1830 return x; |
1836 })(), ak); | 1831 })(), ak); |
1837 } | 1832 } |
1838 break; | 1833 break; |
1839 } | 1834 } |
1840 } | 1835 } |
1841 } | 1836 } |
1842 } | 1837 } |
1843 } | 1838 } |
1844 Sort[_doSort](a, less, great, compare); | 1839 Sort._doSort(a, less, great, compare); |
1845 } else { | 1840 } else { |
1846 Sort[_doSort](a, less, great, compare); | 1841 Sort._doSort(a, less, great, compare); |
1847 } | 1842 } |
1848 } | 1843 } |
1849 } | 1844 } |
1850 Sort._INSERTION_SORT_THRESHOLD = 32; | 1845 Sort._INSERTION_SORT_THRESHOLD = 32; |
1851 let _name = dart.JsSymbol('_name'); | 1846 let _name = dart.JsSymbol('_name'); |
1852 class Symbol extends core.Object { | 1847 class Symbol extends core.Object { |
1853 Symbol(name) { | 1848 Symbol(name) { |
1854 this[_name] = name; | 1849 this[_name] = name; |
1855 } | 1850 } |
1856 unvalidated(name) { | 1851 unvalidated(name) { |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1967 exports.ReversedListIterable = ReversedListIterable; | 1962 exports.ReversedListIterable = ReversedListIterable; |
1968 exports.UnmodifiableListError = UnmodifiableListError; | 1963 exports.UnmodifiableListError = UnmodifiableListError; |
1969 exports.NonGrowableListError = NonGrowableListError; | 1964 exports.NonGrowableListError = NonGrowableListError; |
1970 exports.makeListFixedLength = makeListFixedLength; | 1965 exports.makeListFixedLength = makeListFixedLength; |
1971 exports.Lists = Lists; | 1966 exports.Lists = Lists; |
1972 exports.printToConsole = printToConsole; | 1967 exports.printToConsole = printToConsole; |
1973 exports.Sort = Sort; | 1968 exports.Sort = Sort; |
1974 exports.Symbol = Symbol; | 1969 exports.Symbol = Symbol; |
1975 exports.POWERS_OF_TEN = POWERS_OF_TEN; | 1970 exports.POWERS_OF_TEN = POWERS_OF_TEN; |
1976 })(_internal || (_internal = {})); | 1971 })(_internal || (_internal = {})); |
OLD | NEW |