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:
@ -113,7 +113,7 @@ export class NgFormModel extends ControlContainer implements Form {
|
||||
var c: any = this.form.find(dir.path);
|
||||
setUpControl(c, dir);
|
||||
c.updateValidity();
|
||||
ListWrapper.push(this.directives, dir);
|
||||
this.directives.push(dir);
|
||||
}
|
||||
|
||||
getControl(dir: NgControl): Control { return <Control>this.form.find(dir.path); }
|
||||
|
@ -10,7 +10,7 @@ import {Renderer, ElementRef} from 'angular2/angular2';
|
||||
|
||||
export function controlPath(name, parent: ControlContainer) {
|
||||
var p = ListWrapper.clone(parent.path);
|
||||
ListWrapper.push(p, name);
|
||||
p.push(name);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ export class ControlArray extends AbstractControl {
|
||||
at(index: number): AbstractControl { return this.controls[index]; }
|
||||
|
||||
push(control: AbstractControl): void {
|
||||
ListWrapper.push(this.controls, control);
|
||||
this.controls.push(control);
|
||||
control.setParent(this);
|
||||
this.updateValueAndValidity();
|
||||
}
|
||||
|
@ -51,12 +51,13 @@ export class Validators {
|
||||
return StringMapWrapper.isEmpty(res) ? null : res;
|
||||
}
|
||||
|
||||
static _mergeErrors(control: modelModule.AbstractControl, res: StringMap<string, any>): void {
|
||||
static _mergeErrors(control: modelModule.AbstractControl, res: StringMap<string, any[]>): void {
|
||||
StringMapWrapper.forEach(control.errors, (value, error) => {
|
||||
if (!StringMapWrapper.contains(res, error)) {
|
||||
res[error] = [];
|
||||
}
|
||||
ListWrapper.push(res[error], control);
|
||||
var current: any[] = res[error];
|
||||
current.push(control);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user