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:
@ -1,4 +1,4 @@
|
||||
/// <reference path="../../typings/jasmine/jasmine"/>
|
||||
/// <reference path="../../typings/jasmine/jasmine.d.ts"/>
|
||||
|
||||
import {BaseException, global} from 'angular2/src/facade/lang';
|
||||
import {ListWrapper} from 'angular2/src/facade/collection';
|
||||
@ -95,7 +95,7 @@ export function flushMicrotasks(): void {
|
||||
function _setTimeout(fn: Function, delay: number, ... args): number {
|
||||
var cb = _fnAndFlush(fn);
|
||||
var id = _scheduler.scheduleFunction(cb, delay, args);
|
||||
ListWrapper.push(_pendingTimers, id);
|
||||
_pendingTimers.push(id);
|
||||
_scheduler.scheduleFunction(_dequeueTimer(id), delay);
|
||||
return id;
|
||||
}
|
||||
@ -124,7 +124,7 @@ function _fnAndFlush(fn: Function): Function {
|
||||
}
|
||||
|
||||
function _scheduleMicrotask(microtask: Function): void {
|
||||
ListWrapper.push(_microtasks, microtask);
|
||||
_microtasks.push(microtask);
|
||||
}
|
||||
|
||||
function _dequeueTimer(id: number): Function {
|
||||
|
@ -8,12 +8,10 @@ export class Log {
|
||||
|
||||
constructor() { this._result = []; }
|
||||
|
||||
add(value): void { ListWrapper.push(this._result, value); }
|
||||
add(value): void { this._result.push(value); }
|
||||
|
||||
fn(value) {
|
||||
return (a1 = null, a2 = null, a3 = null, a4 = null, a5 = null) => {
|
||||
ListWrapper.push(this._result, value);
|
||||
}
|
||||
return (a1 = null, a2 = null, a3 = null, a4 = null, a5 = null) => { this._result.push(value); }
|
||||
}
|
||||
|
||||
result(): string { return ListWrapper.join(this._result, "; "); }
|
||||
@ -72,8 +70,8 @@ export function stringifyElement(el): string {
|
||||
|
||||
// Attributes in an ordered way
|
||||
var attributeMap = DOM.attributeMap(el);
|
||||
var keys = ListWrapper.create();
|
||||
MapWrapper.forEach(attributeMap, (v, k) => { ListWrapper.push(keys, k); });
|
||||
var keys = [];
|
||||
MapWrapper.forEach(attributeMap, (v, k) => { keys.push(k); });
|
||||
ListWrapper.sort(keys);
|
||||
for (let i = 0; i < keys.length; i++) {
|
||||
var key = keys[i];
|
||||
|
Reference in New Issue
Block a user