chore: kill ListWrapper.create() and .push().

These wrappers are not natively understood by
ts2dart. Removing them will improve Dart2JS
compilation due to fewer megamorphic calls to List
functions.

It also makes Angular code more succinct and
improves type safety in Angular due to better type
inference of the Array component type.

This change exposed several bugs in Angular.
This commit is contained in:
Martin Probst
2015-06-17 11:17:21 -07:00
parent 6af41a4543
commit c7e48350d3
88 changed files with 360 additions and 387 deletions

View File

@ -101,7 +101,6 @@ class StringMapWrapper {
class ListWrapper {
static List clone(Iterable l) => new List.from(l);
static List create() => new List();
static List createFixedSize(int size) => new List(size);
static get(List m, int k) => m[k];
static void set(List m, int k, v) {
@ -126,9 +125,6 @@ class ListWrapper {
static first(List list) => list.isEmpty ? null : list.first;
static last(List list) => list.isEmpty ? null : list.last;
static List reversed(List list) => list.reversed.toList();
static void push(List l, e) {
l.add(e);
}
static List concat(List a, List b) {
return new List()
..length = a.length + b.length

View File

@ -145,7 +145,6 @@ export class StringMapWrapper {
}
export class ListWrapper {
static create(): List<any> { return new List(); }
static createFixedSize(size): List<any> { return new List(size); }
static get(m, k) { return m[k]; }
static set(m, k, v) { m[k] = v; }
@ -156,7 +155,6 @@ export class ListWrapper {
fn(array[i]);
}
}
static push(array, el) { array.push(el); }
static first(array) {
if (!array) return null;
return array[0];