refactor(ListWrapper): drop forEach and removeLast

Closes #4584
This commit is contained in:
Victor Berchet
2015-10-07 09:09:43 -07:00
parent 4ed642f921
commit aee176115b
35 changed files with 71 additions and 104 deletions

View File

@ -8,7 +8,7 @@ import {
ObservableWrapper,
EventEmitter
} from "angular2/src/core/facade/async";
import {ListWrapper, StringMapWrapper, MapWrapper} from "angular2/src/core/facade/collection";
import {StringMapWrapper, MapWrapper} from "angular2/src/core/facade/collection";
import {Serializer} from "angular2/src/web_workers/shared/serializer";
import {Injectable} from "angular2/src/core/di";
import {Type, StringWrapper} from "angular2/src/core/facade/lang";
@ -58,7 +58,7 @@ export class ClientMessageBroker {
runOnService(args: UiArguments, returnType: Type): Promise<any> {
var fnArgs = [];
if (isPresent(args.args)) {
ListWrapper.forEach(args.args, (argument) => {
args.args.forEach(argument => {
if (argument.type != null) {
fnArgs.push(this._serializer.serialize(argument.value, argument.type));
} else {

View File

@ -41,7 +41,7 @@ export class RenderViewWithFragmentsStore {
this._lookupByView.set(view.viewRef, startIndex);
startIndex++;
ListWrapper.forEach(view.fragmentRefs, (ref) => {
view.fragmentRefs.forEach(ref => {
this._lookupByIndex.set(startIndex, ref);
this._lookupByView.set(ref, startIndex);
startIndex++;

View File

@ -7,7 +7,7 @@ import {
} from "angular2/src/core/facade/lang";
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
import {ListWrapper, Map, StringMapWrapper, MapWrapper} from "angular2/src/core/facade/collection";
import {Map, StringMapWrapper, MapWrapper} from "angular2/src/core/facade/collection";
import {
RenderProtoViewRef,
RenderViewRef,
@ -52,9 +52,7 @@ export class Serializer {
return null;
}
if (isArray(obj)) {
var serializedObj = [];
ListWrapper.forEach(obj, (val) => { serializedObj.push(this.serialize(val, type)); });
return serializedObj;
return (<any[]>obj).map(v => this.serialize(v, type));
}
if (type == PRIMITIVE) {
return obj;
@ -80,7 +78,7 @@ export class Serializer {
}
if (isArray(map)) {
var obj: any[] = [];
ListWrapper.forEach(map, (val) => { obj.push(this.deserialize(val, type, data)); });
(<any[]>map).forEach(val => obj.push(this.deserialize(val, type, data)));
return obj;
}
if (type == PRIMITIVE) {