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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: lib/runtime/dart/_internal.js
diff --git a/lib/runtime/dart/_internal.js b/lib/runtime/dart/_internal.js
index 5744266645907a7ef4f560614480eaae8855ea17..2194600e0359385d37bd292823e0c12dff7bbe75 100644
--- a/lib/runtime/dart/_internal.js
+++ b/lib/runtime/dart/_internal.js
@@ -200,10 +200,8 @@ var _internal;
let growable = opts && 'growable' in opts ? opts.growable : true;
let result = null;
if (growable) {
- result = ((_) => {
- _[core.$length] = this.length;
- return _;
- }).bind(this)(new (core.List$(E))());
+ result = new (core.List$(E))();
+ result[core.$length] = this.length;
} else {
result = new (core.List$(E))(this.length);
}
@@ -300,10 +298,7 @@ var _internal;
let length = dart.notNull(end) - dart.notNull(start);
if (dart.notNull(length) < 0)
length = 0;
- let result = growable ? ((_) => {
- _[core.$length] = length;
- return _;
- })(new (core.List$(E))()) : new (core.List$(E))(length);
+ let result = growable ? ((_) => (_ = new (core.List$(E))(), _[core.$length] = length, _))() : new (core.List$(E))(length);
Jennifer Messerly 2015/04/07 22:00:28 hmm, we could just emit this into multiple lines a
for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNull(i) + 1) {
result[core.$set](i, this[_iterable][core.$elementAt](dart.notNull(start) + dart.notNull(i)));
if (dart.notNull(this[_iterable][core.$length]) < dart.notNull(end))
@@ -1098,7 +1093,7 @@ var _internal;
let length = list[core.$length];
while (dart.notNull(length) > 1) {
let pos = random.nextInt(length);
- length = 1;
+ length = dart.notNull(length) - 1;
let tmp = list[core.$get](length);
list[core.$set](length, list[core.$get](pos));
list[core.$set](pos, tmp);
@@ -1177,16 +1172,16 @@ var _internal;
iterable = iterable[core.$toList]({growable: false});
}
let insertionLength = iterable[core.$length];
- list[core.$length] = insertionLength;
+ list[core.$length] = dart.notNull(list[core.$length]) + dart.notNull(insertionLength);
list[core.$setRange](dart.notNull(index) + dart.notNull(insertionLength), list[core.$length], list, index);
for (let element of iterable) {
- list[core.$set](((x) => index = dart.notNull(x) + 1, x)(index), element);
+ list[core.$set](((x) => (x = index, index = dart.notNull(x) + 1, x))(), element);
}
}
static setAllList(list, index, iterable) {
core.RangeError.checkValueInInterval(index, 0, list[core.$length], "index");
for (let element of iterable) {
- list[core.$set](((x) => index = dart.notNull(x) + 1, x)(index), element);
+ list[core.$set](((x) => (x = index, index = dart.notNull(x) + 1, x))(), element);
}
}
asMapList(l) {
@@ -1685,12 +1680,12 @@ var _internal;
continue;
} else if (dart.notNull(comp) < 0) {
a[core.$set](k, a[core.$get](less));
- a[core.$set](((x) => less = dart.notNull(x) + 1, x)(less), a[core.$get](great));
- a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak);
+ a[core.$set](((x) => (x = less, less = dart.notNull(x) + 1, x))(), a[core.$get](great));
+ a[core.$set](((x) => (x = great, great = dart.notNull(x) - 1, x))(), ak);
break;
} else {
a[core.$set](k, a[core.$get](great));
- a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak);
+ a[core.$set](((x) => (x = great, great = dart.notNull(x) - 1, x))(), ak);
break;
}
}
@@ -1720,11 +1715,11 @@ var _internal;
comp = dart.dinvokef(compare, a[core.$get](great), pivot1);
if (dart.notNull(comp) < 0) {
a[core.$set](k, a[core.$get](less));
- a[core.$set](((x) => less = dart.notNull(x) + 1, x)(less), a[core.$get](great));
- a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak);
+ a[core.$set](((x) => (x = less, less = dart.notNull(x) + 1, x))(), a[core.$get](great));
+ a[core.$set](((x) => (x = great, great = dart.notNull(x) - 1, x))(), ak);
} else {
a[core.$set](k, a[core.$get](great));
- a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak);
+ a[core.$set](((x) => (x = great, great = dart.notNull(x) - 1, x))(), ak);
}
break;
}
@@ -1772,11 +1767,11 @@ var _internal;
comp = dart.dinvokef(compare, a[core.$get](great), pivot1);
if (dart.notNull(comp) < 0) {
a[core.$set](k, a[core.$get](less));
- a[core.$set](((x) => less = dart.notNull(x) + 1, x)(less), a[core.$get](great));
- a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak);
+ a[core.$set](((x) => (x = less, less = dart.notNull(x) + 1, x))(), a[core.$get](great));
+ a[core.$set](((x) => (x = great, great = dart.notNull(x) - 1, x))(), ak);
} else {
a[core.$set](k, a[core.$get](great));
- a[core.$set](((x) => great = dart.notNull(x) - 1, x)(great), ak);
+ a[core.$set](((x) => (x = great, great = dart.notNull(x) - 1, x))(), ak);
}
break;
}

Powered by Google App Engine
This is Rietveld 408576698