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

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

Issue 1069493002: implement opassign, fix bugs in pre/postfix, introduce a let* helper (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/runtime/dart/_interceptors.js ('k') | lib/runtime/dart/_isolate_helper.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var _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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 291 }
292 [core.$toList](opts) { 292 [core.$toList](opts) {
293 let growable = opts && 'growable' in opts ? opts.growable : true; 293 let growable = opts && 'growable' in opts ? opts.growable : true;
294 let start = this[_start]; 294 let start = this[_start];
295 let end = this[_iterable][core.$length]; 295 let end = this[_iterable][core.$length];
296 if (this[_endOrLength] != null && dart.notNull(this[_endOrLength]) < dar t.notNull(end)) 296 if (this[_endOrLength] != null && dart.notNull(this[_endOrLength]) < dar t.notNull(end))
297 end = this[_endOrLength]; 297 end = this[_endOrLength];
298 let length = dart.notNull(end) - dart.notNull(start); 298 let length = dart.notNull(end) - dart.notNull(start);
299 if (dart.notNull(length) < 0) 299 if (dart.notNull(length) < 0)
300 length = 0; 300 length = 0;
301 let result = growable ? ((_) => { 301 let result = growable ? (() => {
302 let _ = new (core.List$(E))();
302 _[core.$length] = length; 303 _[core.$length] = length;
303 return _; 304 return _;
304 })(new (core.List$(E))()) : new (core.List$(E))(length); 305 })() : new (core.List$(E))(length);
305 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) { 306 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull (i) + 1) {
306 result[core.$set](i, this[_iterable][core.$elementAt](dart.notNull(sta rt) + dart.notNull(i))); 307 result[core.$set](i, this[_iterable][core.$elementAt](dart.notNull(sta rt) + dart.notNull(i)));
307 if (dart.notNull(this[_iterable][core.$length]) < dart.notNull(end)) 308 if (dart.notNull(this[_iterable][core.$length]) < dart.notNull(end))
308 throw new core.ConcurrentModificationError(this); 309 throw new core.ConcurrentModificationError(this);
309 } 310 }
310 return dart.as(result, core.List$(E)); 311 return dart.as(result, core.List$(E));
311 } 312 }
312 } 313 }
313 return SubListIterable; 314 return SubListIterable;
314 }); 315 });
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 if (compare == null) 1090 if (compare == null)
1090 compare = core.Comparable.compare; 1091 compare = core.Comparable.compare;
1091 Sort.sort(list, compare); 1092 Sort.sort(list, compare);
1092 } 1093 }
1093 static shuffleList(list, random) { 1094 static shuffleList(list, random) {
1094 if (random == null) 1095 if (random == null)
1095 random = new math.Random(); 1096 random = new math.Random();
1096 let length = list[core.$length]; 1097 let length = list[core.$length];
1097 while (dart.notNull(length) > 1) { 1098 while (dart.notNull(length) > 1) {
1098 let pos = random.nextInt(length); 1099 let pos = random.nextInt(length);
1099 length = 1; 1100 length = dart.notNull(length) - 1;
1100 let tmp = list[core.$get](length); 1101 let tmp = list[core.$get](length);
1101 list[core.$set](length, list[core.$get](pos)); 1102 list[core.$set](length, list[core.$get](pos));
1102 list[core.$set](pos, tmp); 1103 list[core.$set](pos, tmp);
1103 } 1104 }
1104 } 1105 }
1105 static indexOfList(list, element, start) { 1106 static indexOfList(list, element, start) {
1106 return Lists.indexOf(list, element, start, list[core.$length]); 1107 return Lists.indexOf(list, element, start, list[core.$length]);
1107 } 1108 }
1108 static lastIndexOfList(list, element, start) { 1109 static lastIndexOfList(list, element, start) {
1109 if (start == null) 1110 if (start == null)
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
1168 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) { 1169 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNul l(i) + 1) {
1169 list[core.$set](i, fillValue); 1170 list[core.$set](i, fillValue);
1170 } 1171 }
1171 } 1172 }
1172 static insertAllList(list, index, iterable) { 1173 static insertAllList(list, index, iterable) {
1173 core.RangeError.checkValueInInterval(index, 0, list[core.$length], "inde x"); 1174 core.RangeError.checkValueInInterval(index, 0, list[core.$length], "inde x");
1174 if (!dart.is(iterable, EfficientLength)) { 1175 if (!dart.is(iterable, EfficientLength)) {
1175 iterable = iterable[core.$toList]({growable: false}); 1176 iterable = iterable[core.$toList]({growable: false});
1176 } 1177 }
1177 let insertionLength = iterable[core.$length]; 1178 let insertionLength = iterable[core.$length];
1178 list[core.$length] = insertionLength; 1179 list[core.$length] = dart.notNull(list[core.$length]) + dart.notNull(ins ertionLength);
1179 list[core.$setRange](dart.notNull(index) + dart.notNull(insertionLength) , list[core.$length], list, index); 1180 list[core.$setRange](dart.notNull(index) + dart.notNull(insertionLength) , list[core.$length], list, index);
1180 for (let element of iterable) { 1181 for (let element of iterable) {
1181 list[core.$set](((x) => index = dart.notNull(x) + 1, x)(index), elemen t); 1182 list[core.$set]((() => {
1183 let x = index;
1184 index = dart.notNull(x) + 1;
1185 return x;
1186 })(), element);
1182 } 1187 }
1183 } 1188 }
1184 static setAllList(list, index, iterable) { 1189 static setAllList(list, index, iterable) {
1185 core.RangeError.checkValueInInterval(index, 0, list[core.$length], "inde x"); 1190 core.RangeError.checkValueInInterval(index, 0, list[core.$length], "inde x");
1186 for (let element of iterable) { 1191 for (let element of iterable) {
1187 list[core.$set](((x) => index = dart.notNull(x) + 1, x)(index), elemen t); 1192 list[core.$set]((() => {
1193 let x = index;
1194 index = dart.notNull(x) + 1;
1195 return x;
1196 })(), element);
1188 } 1197 }
1189 } 1198 }
1190 asMapList(l) { 1199 asMapList(l) {
1191 return new (ListMapView$(T))(dart.as(l, core.List$(T))); 1200 return new (ListMapView$(T))(dart.as(l, core.List$(T)));
1192 } 1201 }
1193 static setContainsAll(set, other) { 1202 static setContainsAll(set, other) {
1194 for (let element of other) { 1203 for (let element of other) {
1195 if (!dart.notNull(set[core.$contains](element))) 1204 if (!dart.notNull(set[core.$contains](element)))
1196 return false; 1205 return false;
1197 } 1206 }
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
1676 } 1685 }
1677 less = dart.notNull(less) + 1; 1686 less = dart.notNull(less) + 1;
1678 } else { 1687 } else {
1679 while (true) { 1688 while (true) {
1680 comp = dart.dinvokef(compare, a[core.$get](great), pivot); 1689 comp = dart.dinvokef(compare, a[core.$get](great), pivot);
1681 if (dart.notNull(comp) > 0) { 1690 if (dart.notNull(comp) > 0) {
1682 great = dart.notNull(great) - 1; 1691 great = dart.notNull(great) - 1;
1683 continue; 1692 continue;
1684 } else if (dart.notNull(comp) < 0) { 1693 } else if (dart.notNull(comp) < 0) {
1685 a[core.$set](k, a[core.$get](less)); 1694 a[core.$set](k, a[core.$get](less));
1686 a[core.$set](((x) => less = dart.notNull(x) + 1, x)(less), a[cor e.$get](great)); 1695 a[core.$set]((() => {
1687 a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak) ; 1696 let x = less;
1697 less = dart.notNull(x) + 1;
1698 return x;
1699 })(), a[core.$get](great));
1700 a[core.$set]((() => {
1701 let x = great;
1702 great = dart.notNull(x) - 1;
1703 return x;
1704 })(), ak);
1688 break; 1705 break;
1689 } else { 1706 } else {
1690 a[core.$set](k, a[core.$get](great)); 1707 a[core.$set](k, a[core.$get](great));
1691 a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak) ; 1708 a[core.$set]((() => {
1709 let x = great;
1710 great = dart.notNull(x) - 1;
1711 return x;
1712 })(), ak);
1692 break; 1713 break;
1693 } 1714 }
1694 } 1715 }
1695 } 1716 }
1696 } 1717 }
1697 } else { 1718 } else {
1698 for (let k = less; dart.notNull(k) <= dart.notNull(great); k = dart.notN ull(k) + 1) { 1719 for (let k = less; dart.notNull(k) <= dart.notNull(great); k = dart.notN ull(k) + 1) {
1699 let ak = a[core.$get](k); 1720 let ak = a[core.$get](k);
1700 let comp_pivot1 = dart.dinvokef(compare, ak, pivot1); 1721 let comp_pivot1 = dart.dinvokef(compare, ak, pivot1);
1701 if (dart.notNull(comp_pivot1) < 0) { 1722 if (dart.notNull(comp_pivot1) < 0) {
1702 if (k != less) { 1723 if (k != less) {
1703 a[core.$set](k, a[core.$get](less)); 1724 a[core.$set](k, a[core.$get](less));
1704 a[core.$set](less, ak); 1725 a[core.$set](less, ak);
1705 } 1726 }
1706 less = dart.notNull(less) + 1; 1727 less = dart.notNull(less) + 1;
1707 } else { 1728 } else {
1708 let comp_pivot2 = dart.dinvokef(compare, ak, pivot2); 1729 let comp_pivot2 = dart.dinvokef(compare, ak, pivot2);
1709 if (dart.notNull(comp_pivot2) > 0) { 1730 if (dart.notNull(comp_pivot2) > 0) {
1710 while (true) { 1731 while (true) {
1711 let comp = dart.dinvokef(compare, a[core.$get](great), pivot2); 1732 let comp = dart.dinvokef(compare, a[core.$get](great), pivot2);
1712 if (dart.notNull(comp) > 0) { 1733 if (dart.notNull(comp) > 0) {
1713 great = dart.notNull(great) - 1; 1734 great = dart.notNull(great) - 1;
1714 if (dart.notNull(great) < dart.notNull(k)) 1735 if (dart.notNull(great) < dart.notNull(k))
1715 break; 1736 break;
1716 continue; 1737 continue;
1717 } else { 1738 } else {
1718 comp = dart.dinvokef(compare, a[core.$get](great), pivot1); 1739 comp = dart.dinvokef(compare, a[core.$get](great), pivot1);
1719 if (dart.notNull(comp) < 0) { 1740 if (dart.notNull(comp) < 0) {
1720 a[core.$set](k, a[core.$get](less)); 1741 a[core.$set](k, a[core.$get](less));
1721 a[core.$set](((x) => less = dart.notNull(x) + 1, x)(less), a [core.$get](great)); 1742 a[core.$set]((() => {
1722 a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak); 1743 let x = less;
1744 less = dart.notNull(x) + 1;
1745 return x;
1746 })(), a[core.$get](great));
1747 a[core.$set]((() => {
1748 let x = great;
1749 great = dart.notNull(x) - 1;
1750 return x;
1751 })(), ak);
1723 } else { 1752 } else {
1724 a[core.$set](k, a[core.$get](great)); 1753 a[core.$set](k, a[core.$get](great));
1725 a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak); 1754 a[core.$set]((() => {
1755 let x = great;
1756 great = dart.notNull(x) - 1;
1757 return x;
1758 })(), ak);
1726 } 1759 }
1727 break; 1760 break;
1728 } 1761 }
1729 } 1762 }
1730 } 1763 }
1731 } 1764 }
1732 } 1765 }
1733 } 1766 }
1734 a[core.$set](left, a[core.$get](dart.notNull(less) - 1)); 1767 a[core.$set](left, a[core.$get](dart.notNull(less) - 1));
1735 a[core.$set](dart.notNull(less) - 1, pivot1); 1768 a[core.$set](dart.notNull(less) - 1, pivot1);
(...skipping 27 matching lines...) Expand all
1763 let comp = dart.dinvokef(compare, a[core.$get](great), pivot2); 1796 let comp = dart.dinvokef(compare, a[core.$get](great), pivot2);
1764 if (comp == 0) { 1797 if (comp == 0) {
1765 great = dart.notNull(great) - 1; 1798 great = dart.notNull(great) - 1;
1766 if (dart.notNull(great) < dart.notNull(k)) 1799 if (dart.notNull(great) < dart.notNull(k))
1767 break; 1800 break;
1768 continue; 1801 continue;
1769 } else { 1802 } else {
1770 comp = dart.dinvokef(compare, a[core.$get](great), pivot1); 1803 comp = dart.dinvokef(compare, a[core.$get](great), pivot1);
1771 if (dart.notNull(comp) < 0) { 1804 if (dart.notNull(comp) < 0) {
1772 a[core.$set](k, a[core.$get](less)); 1805 a[core.$set](k, a[core.$get](less));
1773 a[core.$set](((x) => less = dart.notNull(x) + 1, x)(less), a [core.$get](great)); 1806 a[core.$set]((() => {
1774 a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak); 1807 let x = less;
1808 less = dart.notNull(x) + 1;
1809 return x;
1810 })(), a[core.$get](great));
1811 a[core.$set]((() => {
1812 let x = great;
1813 great = dart.notNull(x) - 1;
1814 return x;
1815 })(), ak);
1775 } else { 1816 } else {
1776 a[core.$set](k, a[core.$get](great)); 1817 a[core.$set](k, a[core.$get](great));
1777 a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak); 1818 a[core.$set]((() => {
1819 let x = great;
1820 great = dart.notNull(x) - 1;
1821 return x;
1822 })(), ak);
1778 } 1823 }
1779 break; 1824 break;
1780 } 1825 }
1781 } 1826 }
1782 } 1827 }
1783 } 1828 }
1784 } 1829 }
1785 Sort[_doSort](a, less, great, compare); 1830 Sort[_doSort](a, less, great, compare);
1786 } else { 1831 } else {
1787 Sort[_doSort](a, less, great, compare); 1832 Sort[_doSort](a, less, great, compare);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1908 exports.ReversedListIterable = ReversedListIterable; 1953 exports.ReversedListIterable = ReversedListIterable;
1909 exports.UnmodifiableListError = UnmodifiableListError; 1954 exports.UnmodifiableListError = UnmodifiableListError;
1910 exports.NonGrowableListError = NonGrowableListError; 1955 exports.NonGrowableListError = NonGrowableListError;
1911 exports.makeListFixedLength = makeListFixedLength; 1956 exports.makeListFixedLength = makeListFixedLength;
1912 exports.Lists = Lists; 1957 exports.Lists = Lists;
1913 exports.printToConsole = printToConsole; 1958 exports.printToConsole = printToConsole;
1914 exports.Sort = Sort; 1959 exports.Sort = Sort;
1915 exports.Symbol = Symbol; 1960 exports.Symbol = Symbol;
1916 exports.POWERS_OF_TEN = POWERS_OF_TEN; 1961 exports.POWERS_OF_TEN = POWERS_OF_TEN;
1917 })(_internal || (_internal = {})); 1962 })(_internal || (_internal = {}));
OLDNEW
« no previous file with comments | « lib/runtime/dart/_interceptors.js ('k') | lib/runtime/dart/_isolate_helper.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698