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
@@ -22,7 +22,7 @@ import {
normalizeBool
} from 'angular2/src/core/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
import {ListWrapper, MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
import {MapWrapper, StringMapWrapper} from 'angular2/src/core/facade/collection';
import {
ChangeDispatcher,
@@ -67,7 +67,7 @@ const _DEFAULT_CONTEXT = CONST_EXPR(new Object());
* can be found in the generated/change_detector_classes library.
*/
export function main() {
ListWrapper.forEach(['dynamic', 'JIT', 'Pregen'], (cdType) => {
['dynamic', 'JIT', 'Pregen'].forEach(cdType => {
if (cdType == "JIT" && IS_DART) return;
if (cdType == "Pregen" && !IS_DART) return;
@@ -13,7 +13,6 @@ import {
} from 'angular2/test_lib';
import {ObservableWrapper, EventEmitter, PromiseWrapper} from 'angular2/src/core/facade/async';
import {ListWrapper} from 'angular2/src/core/facade/collection';
export function main() {
describe('EventEmitter', () => {
@@ -88,7 +87,7 @@ export function main() {
one.resolve('one');
}));
ListWrapper.forEach([null, true, false, 10, 'thing', {}, []], (abruptCompletion) => {
[null, true, false, 10, 'thing', {}, []].forEach(abruptCompletion => {
it(`should treat "${abruptCompletion}" as an "abrupt completion"`,
inject([AsyncTestCompleter], (async) => {
var one = PromiseWrapper.completer();
@@ -1,5 +1,4 @@
import {EventEmitter} from 'angular2/src/core/facade/async';
import {ListWrapper} from 'angular2/src/core/facade/collection';
export class MockEventEmitter extends EventEmitter {
private _nextFns: Function[] = [];
@@ -11,9 +10,7 @@ export class MockEventEmitter extends EventEmitter {
return new MockDisposable();
}
next(value: any) {
ListWrapper.forEach(this._nextFns, (fn) => { fn(value); });
}
next(value: any) { this._nextFns.forEach(fn => fn(value)); }
}
class MockDisposable {