diff --git a/modules/angular2/src/change_detection/abstract_change_detector.ts b/modules/angular2/src/change_detection/abstract_change_detector.ts index 58b4a73828..479f83df86 100644 --- a/modules/angular2/src/change_detection/abstract_change_detector.ts +++ b/modules/angular2/src/change_detection/abstract_change_detector.ts @@ -17,14 +17,14 @@ export class AbstractChangeDetector extends ChangeDetector { } addChild(cd: ChangeDetector): void { - ListWrapper.push(this.lightDomChildren, cd); + this.lightDomChildren.push(cd); cd.parent = this; } removeChild(cd: ChangeDetector): void { ListWrapper.remove(this.lightDomChildren, cd); } addShadowDomChild(cd: ChangeDetector): void { - ListWrapper.push(this.shadowDomChildren, cd); + this.shadowDomChildren.push(cd); cd.parent = this; } diff --git a/modules/angular2/src/change_detection/coalesce.ts b/modules/angular2/src/change_detection/coalesce.ts index faf37caf73..041a3f64c0 100644 --- a/modules/angular2/src/change_detection/coalesce.ts +++ b/modules/angular2/src/change_detection/coalesce.ts @@ -13,7 +13,7 @@ import {RecordType, ProtoRecord} from './proto_record'; * replaced with very cheap SELF records. */ export function coalesce(records: List): List { - var res: List = ListWrapper.create(); + var res: List = []; var indexMap: Map = MapWrapper.create(); for (var i = 0; i < records.length; ++i) { @@ -22,14 +22,14 @@ export function coalesce(records: List): List { var matchingRecord = _findMatching(record, res); if (isPresent(matchingRecord) && record.lastInBinding) { - ListWrapper.push(res, _selfRecord(record, matchingRecord.selfIndex, res.length + 1)); + res.push(_selfRecord(record, matchingRecord.selfIndex, res.length + 1)); MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex); } else if (isPresent(matchingRecord) && !record.lastInBinding) { MapWrapper.set(indexMap, r.selfIndex, matchingRecord.selfIndex); } else { - ListWrapper.push(res, record); + res.push(record); MapWrapper.set(indexMap, r.selfIndex, record.selfIndex); } } diff --git a/modules/angular2/src/change_detection/parser/lexer.ts b/modules/angular2/src/change_detection/parser/lexer.ts index a0ee11ffc9..7162df61e5 100644 --- a/modules/angular2/src/change_detection/parser/lexer.ts +++ b/modules/angular2/src/change_detection/parser/lexer.ts @@ -23,7 +23,7 @@ enum TokenType { var tokens = []; var token = scanner.scanToken(); while (token != null) { - ListWrapper.push(tokens, token); + tokens.push(token); token = scanner.scanToken(); } return tokens; diff --git a/modules/angular2/src/change_detection/parser/parser.ts b/modules/angular2/src/change_detection/parser/parser.ts index a6446446ca..6399cba26a 100644 --- a/modules/angular2/src/change_detection/parser/parser.ts +++ b/modules/angular2/src/change_detection/parser/parser.ts @@ -99,11 +99,11 @@ export class Parser { var part = parts[i]; if (i % 2 === 0) { // fixed string - ListWrapper.push(strings, part); + strings.push(part); } else { var tokens = this._lexer.tokenize(part); var ast = new _ParseAST(input, location, tokens, this._reflector, false).parseChain(); - ListWrapper.push(expressions, ast); + expressions.push(ast); } } return new ASTWithSource(new Interpolation(strings, expressions), input, location); @@ -194,7 +194,7 @@ class _ParseAST { var exprs = []; while (this.index < this.tokens.length) { var expr = this.parsePipe(); - ListWrapper.push(exprs, expr); + exprs.push(expr); if (this.optionalCharacter($SEMICOLON)) { if (!this.parseAction) { @@ -222,7 +222,7 @@ class _ParseAST { var name = this.expectIdentifierOrKeyword(); var args = []; while (this.optionalCharacter($COLON)) { - ListWrapper.push(args, this.parsePipe()); + args.push(this.parsePipe()); } result = new Pipe(result, name, args, true); } while (this.optionalOperator("|")); @@ -456,7 +456,7 @@ class _ParseAST { var result = []; if (!this.next.isCharacter(terminator)) { do { - ListWrapper.push(result, this.parsePipe()); + result.push(this.parsePipe()); } while (this.optionalCharacter($COMMA)); } return result; @@ -469,9 +469,9 @@ class _ParseAST { if (!this.optionalCharacter($RBRACE)) { do { var key = this.expectIdentifierOrKeywordOrString(); - ListWrapper.push(keys, key); + keys.push(key); this.expectCharacter($COLON); - ListWrapper.push(values, this.parsePipe()); + values.push(this.parsePipe()); } while (this.optionalCharacter($COMMA)); this.expectCharacter($RBRACE); } @@ -500,7 +500,7 @@ class _ParseAST { if (this.next.isCharacter($RPAREN)) return []; var positionals = []; do { - ListWrapper.push(positionals, this.parsePipe()); + positionals.push(this.parsePipe()); } while (this.optionalCharacter($COMMA)); return positionals; } @@ -522,7 +522,7 @@ class _ParseAST { var exprs = []; while (this.index < this.tokens.length && !this.next.isCharacter($RBRACE)) { var expr = this.parseExpression(); - ListWrapper.push(exprs, expr); + exprs.push(expr); if (this.optionalCharacter($SEMICOLON)) { while (this.optionalCharacter($SEMICOLON)) { @@ -581,7 +581,7 @@ class _ParseAST { var source = this.input.substring(start, this.inputIndex); expression = new ASTWithSource(ast, source, this.location); } - ListWrapper.push(bindings, new TemplateBinding(key, keyIsVar, name, expression)); + bindings.push(new TemplateBinding(key, keyIsVar, name, expression)); if (!this.optionalCharacter($SEMICOLON)) { this.optionalCharacter($COMMA); } diff --git a/modules/angular2/src/change_detection/pipes/iterable_changes.ts b/modules/angular2/src/change_detection/pipes/iterable_changes.ts index a18db114e7..8df8aabb3c 100644 --- a/modules/angular2/src/change_detection/pipes/iterable_changes.ts +++ b/modules/angular2/src/change_detection/pipes/iterable_changes.ts @@ -448,26 +448,26 @@ export class IterableChanges extends Pipe { var list = []; for (record = this._itHead; record !== null; record = record._next) { - ListWrapper.push(list, record); + list.push(record); } var previous = []; for (record = this._previousItHead; record !== null; record = record._nextPrevious) { - ListWrapper.push(previous, record); + previous.push(record); } var additions = []; for (record = this._additionsHead; record !== null; record = record._nextAdded) { - ListWrapper.push(additions, record); + additions.push(record); } var moves = []; for (record = this._movesHead; record !== null; record = record._nextMoved) { - ListWrapper.push(moves, record); + moves.push(record); } var removals = []; for (record = this._removalsHead; record !== null; record = record._nextRemoved) { - ListWrapper.push(removals, record); + removals.push(record); } return "collection: " + list.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" + diff --git a/modules/angular2/src/change_detection/pipes/keyvalue_changes.ts b/modules/angular2/src/change_detection/pipes/keyvalue_changes.ts index ce98ef869d..cb6471379e 100644 --- a/modules/angular2/src/change_detection/pipes/keyvalue_changes.ts +++ b/modules/angular2/src/change_detection/pipes/keyvalue_changes.ts @@ -299,19 +299,19 @@ export class KeyValueChanges extends Pipe { var record: KVChangeRecord; for (record = this._mapHead; record !== null; record = record._next) { - ListWrapper.push(items, stringify(record)); + items.push(stringify(record)); } for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { - ListWrapper.push(previous, stringify(record)); + previous.push(stringify(record)); } for (record = this._changesHead; record !== null; record = record._nextChanged) { - ListWrapper.push(changes, stringify(record)); + changes.push(stringify(record)); } for (record = this._additionsHead; record !== null; record = record._nextAdded) { - ListWrapper.push(additions, stringify(record)); + additions.push(stringify(record)); } for (record = this._removalsHead; record !== null; record = record._nextRemoved) { - ListWrapper.push(removals, stringify(record)); + removals.push(stringify(record)); } return "map: " + items.join(', ') + "\n" + "previous: " + previous.join(', ') + "\n" + diff --git a/modules/angular2/src/change_detection/proto_change_detector.ts b/modules/angular2/src/change_detection/proto_change_detector.ts index 4ffc47bb05..3bae1b84cf 100644 --- a/modules/angular2/src/change_detection/proto_change_detector.ts +++ b/modules/angular2/src/change_detection/proto_change_detector.ts @@ -82,10 +82,9 @@ export class ProtoRecordBuilder { _appendRecords(b: BindingRecord, variableNames: List) { if (b.isDirectiveLifecycle()) { - ListWrapper.push( - this.records, - new ProtoRecord(RecordType.DIRECTIVE_LIFECYCLE, b.lifecycleEvent, null, [], [], -1, null, - this.records.length + 1, b, null, false, false)); + this.records.push(new ProtoRecord(RecordType.DIRECTIVE_LIFECYCLE, b.lifecycleEvent, null, [], + [], -1, null, this.records.length + 1, b, null, false, + false)); } else { _ConvertAstIntoProtoRecords.append(this.records, b, variableNames); } @@ -215,13 +214,13 @@ class _ConvertAstIntoProtoRecords implements AstVisitor { _addRecord(type, name, funcOrValue, args, fixedArgs, context) { var selfIndex = this._records.length + 1; if (context instanceof DirectiveIndex) { - ListWrapper.push(this._records, new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, - context, selfIndex, this._bindingRecord, - this._expressionAsString, false, false)); + this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, -1, context, + selfIndex, this._bindingRecord, this._expressionAsString, + false, false)); } else { - ListWrapper.push(this._records, new ProtoRecord(type, name, funcOrValue, args, fixedArgs, - context, null, selfIndex, this._bindingRecord, - this._expressionAsString, false, false)); + this._records.push(new ProtoRecord(type, name, funcOrValue, args, fixedArgs, context, null, + selfIndex, this._bindingRecord, this._expressionAsString, + false, false)); } return selfIndex; } diff --git a/modules/angular2/src/core/application.ts b/modules/angular2/src/core/application.ts index 9e81c1d19a..24bd004442 100644 --- a/modules/angular2/src/core/application.ts +++ b/modules/angular2/src/core/application.ts @@ -342,9 +342,9 @@ export class ApplicationRef { function _createAppInjector(appComponentType: Type, bindings: List>, zone: NgZone): Injector { if (isBlank(_rootInjector)) _rootInjector = Injector.resolveAndCreate(_rootBindings); - var mergedBindings = isPresent(bindings) ? - ListWrapper.concat(_injectorBindings(appComponentType), bindings) : - _injectorBindings(appComponentType); - ListWrapper.push(mergedBindings, bind(NgZone).toValue(zone)); + var mergedBindings: any[] = + isPresent(bindings) ? ListWrapper.concat(_injectorBindings(appComponentType), bindings) : + _injectorBindings(appComponentType); + mergedBindings.push(bind(NgZone).toValue(zone)); return _rootInjector.resolveAndCreateChild(mergedBindings); } diff --git a/modules/angular2/src/core/compiler/base_query_list.ts b/modules/angular2/src/core/compiler/base_query_list.ts index 07729f1385..9184370ee8 100644 --- a/modules/angular2/src/core/compiler/base_query_list.ts +++ b/modules/angular2/src/core/compiler/base_query_list.ts @@ -22,7 +22,7 @@ export class BaseQueryList { } add(obj) { - ListWrapper.push(this._results, obj); + this._results.push(obj); this._dirty = true; } @@ -33,7 +33,7 @@ export class BaseQueryList { } } - onChange(callback) { ListWrapper.push(this._callbacks, callback); } + onChange(callback) { this._callbacks.push(callback); } removeCallback(callback) { ListWrapper.remove(this._callbacks, callback); } diff --git a/modules/angular2/src/core/compiler/compiler.ts b/modules/angular2/src/core/compiler/compiler.ts index 23ff6ba2fa..19a3bf95c6 100644 --- a/modules/angular2/src/core/compiler/compiler.ts +++ b/modules/angular2/src/core/compiler/compiler.ts @@ -187,8 +187,7 @@ export class Compiler { (nestedPv: AppProtoView) => { elementBinder.nestedProtoView = nestedPv; }; var nestedCall = this._compile(nestedComponent); if (isPromise(nestedCall)) { - ListWrapper.push(nestedPVPromises, - (>nestedCall).then(elementBinderDone)); + nestedPVPromises.push((>nestedCall).then(elementBinderDone)); } else { elementBinderDone(nestedCall); } @@ -206,7 +205,7 @@ export class Compiler { ListWrapper.forEach(protoViews, (protoView) => { ListWrapper.forEach(protoView.elementBinders, (elementBinder) => { if (isPresent(elementBinder.componentDirective)) { - ListWrapper.push(componentElementBinders, elementBinder); + componentElementBinders.push(elementBinder); } }); }); @@ -254,7 +253,7 @@ export class Compiler { if (isArray(item)) { this._flattenList(item, out); } else { - ListWrapper.push(out, item); + out.push(item); } } } diff --git a/modules/angular2/src/core/compiler/element_injector.ts b/modules/angular2/src/core/compiler/element_injector.ts index 4e9f8642f8..3881fb8206 100644 --- a/modules/angular2/src/core/compiler/element_injector.ts +++ b/modules/angular2/src/core/compiler/element_injector.ts @@ -154,7 +154,7 @@ export class TreeNode> { var res = []; var child = this._head; while (child != null) { - ListWrapper.push(res, child); + res.push(child); child = child._next; } return res; @@ -285,7 +285,7 @@ export class DirectiveBinding extends ResolvedBinding { var readAttributes = []; ListWrapper.forEach(deps, (dep) => { if (isPresent(dep.attributeName)) { - ListWrapper.push(readAttributes, dep.attributeName); + readAttributes.push(dep.attributeName); } }); return readAttributes; @@ -357,10 +357,9 @@ export class BindingData { if (!(this.binding instanceof DirectiveBinding)) return []; var res = []; var db = this.binding; - MapWrapper.forEach( - db.hostActions, - (actionExpression, actionName) => {ListWrapper.push( - res, new HostActionAccessor(actionExpression, reflector.getter(actionName)))}); + MapWrapper.forEach(db.hostActions, (actionExpression, actionName) => { + res.push(new HostActionAccessor(actionExpression, reflector.getter(actionName))); + }); return res; } } @@ -409,8 +408,8 @@ export class ProtoElementInjector { bd: List, firstBindingIsComponent: boolean) { ListWrapper.forEach(dirBindings, dirBinding => { - ListWrapper.push(bd, ProtoElementInjector._createBindingData( - firstBindingIsComponent, dirBinding, dirBindings, dirBinding)); + bd.push(ProtoElementInjector._createBindingData(firstBindingIsComponent, dirBinding, + dirBindings, dirBinding)); }); } @@ -425,9 +424,9 @@ export class ProtoElementInjector { `Multiple directives defined the same host injectable: "${stringify(b.key.token)}"`); } MapWrapper.set(visitedIds, b.key.id, true); - ListWrapper.push(bd, ProtoElementInjector._createBindingData( - firstBindingIsComponent, dirBinding, dirBindings, - ProtoElementInjector._createBinding(b))); + bd.push(ProtoElementInjector._createBindingData(firstBindingIsComponent, dirBinding, + dirBindings, + ProtoElementInjector._createBinding(b))); }); }); } @@ -442,8 +441,7 @@ export class ProtoElementInjector { var db = bindings[0]; ListWrapper.forEach( db.resolvedViewInjectables, - b => ListWrapper.push(bd, - new BindingData(ProtoElementInjector._createBinding(b), SHADOW_DOM))); + b => bd.push(new BindingData(ProtoElementInjector._createBinding(b), SHADOW_DOM))); } private static _createBinding(b: ResolvedBinding) { @@ -963,15 +961,15 @@ export class ElementInjector extends TreeNode { var queriesToUpdate = []; if (isPresent(this.parent._query0)) { this._pruneQueryFromTree(this.parent._query0); - ListWrapper.push(queriesToUpdate, this.parent._query0); + queriesToUpdate.push(this.parent._query0); } if (isPresent(this.parent._query1)) { this._pruneQueryFromTree(this.parent._query1); - ListWrapper.push(queriesToUpdate, this.parent._query1); + queriesToUpdate.push(this.parent._query1); } if (isPresent(this.parent._query2)) { this._pruneQueryFromTree(this.parent._query2); - ListWrapper.push(queriesToUpdate, this.parent._query2); + queriesToUpdate.push(this.parent._query2); } this.remove(); @@ -1454,10 +1452,10 @@ class QueryRef { this.list.reset(aggregator); } - visit(inj: ElementInjector, aggregator): void { + visit(inj: ElementInjector, aggregator: any[]): void { if (isBlank(inj) || !inj._hasQuery(this)) return; if (inj.hasDirective(this.query.directive)) { - ListWrapper.push(aggregator, inj.get(this.query.directive)); + aggregator.push(inj.get(this.query.directive)); } var child = inj._head; while (isPresent(child)) { diff --git a/modules/angular2/src/core/compiler/proto_view_factory.ts b/modules/angular2/src/core/compiler/proto_view_factory.ts index cb53a7c15e..93de3ca605 100644 --- a/modules/angular2/src/core/compiler/proto_view_factory.ts +++ b/modules/angular2/src/core/compiler/proto_view_factory.ts @@ -47,10 +47,8 @@ class BindingRecordsCreator { for (var elementIndex = 0; elementIndex < elementBinders.length; ++elementIndex) { var dirs = elementBinders[elementIndex].directives; for (var dirIndex = 0; dirIndex < dirs.length; ++dirIndex) { - ListWrapper.push( - directiveRecords, - this._getDirectiveRecord(elementIndex, dirIndex, - allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); + directiveRecords.push(this._getDirectiveRecord( + elementIndex, dirIndex, allDirectiveMetadatas[dirs[dirIndex].directiveIndex])); } } @@ -62,15 +60,15 @@ class BindingRecordsCreator { if (isBlank(renderElementBinder.textBindings)) return; ListWrapper.forEach(renderElementBinder.textBindings, (b) => { - ListWrapper.push(bindings, BindingRecord.createForTextNode(b, this._textNodeIndex++)); + bindings.push(BindingRecord.createForTextNode(b, this._textNodeIndex++)); }); } _createElementPropertyRecords(bindings: List, boundElementIndex: number, renderElementBinder: renderApi.ElementBinder) { MapWrapper.forEach(renderElementBinder.propertyBindings, (astWithSource, propertyName) => { - ListWrapper.push( - bindings, BindingRecord.createForElement(astWithSource, boundElementIndex, propertyName)); + + bindings.push(BindingRecord.createForElement(astWithSource, boundElementIndex, propertyName)); }); } @@ -87,18 +85,18 @@ class BindingRecordsCreator { // TODO: these setters should eventually be created by change detection, to make // it monomorphic! var setter = reflector.setter(propertyName); - ListWrapper.push(bindings, BindingRecord.createForDirective(astWithSource, propertyName, - setter, directiveRecord)); + bindings.push( + BindingRecord.createForDirective(astWithSource, propertyName, setter, directiveRecord)); }); if (directiveRecord.callOnChange) { - ListWrapper.push(bindings, BindingRecord.createDirectiveOnChange(directiveRecord)); + bindings.push(BindingRecord.createDirectiveOnChange(directiveRecord)); } if (directiveRecord.callOnInit) { - ListWrapper.push(bindings, BindingRecord.createDirectiveOnInit(directiveRecord)); + bindings.push(BindingRecord.createDirectiveOnInit(directiveRecord)); } if (directiveRecord.callOnCheck) { - ListWrapper.push(bindings, BindingRecord.createDirectiveOnCheck(directiveRecord)); + bindings.push(BindingRecord.createDirectiveOnCheck(directiveRecord)); } } @@ -107,8 +105,8 @@ class BindingRecordsCreator { // host properties MapWrapper.forEach(directiveBinder.hostPropertyBindings, (astWithSource, propertyName) => { var dirIndex = new DirectiveIndex(boundElementIndex, i); - ListWrapper.push( - bindings, BindingRecord.createForHostProperty(dirIndex, astWithSource, propertyName)); + + bindings.push(BindingRecord.createForHostProperty(dirIndex, astWithSource, propertyName)); }); } } @@ -185,8 +183,8 @@ function _collectNestedProtoViews( if (isBlank(result)) { result = []; } - ListWrapper.push(result, new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, - boundElementIndex)); + result.push( + new RenderProtoViewWithIndex(renderProtoView, result.length, parentIndex, boundElementIndex)); var currentIndex = result.length - 1; var childBoundElementIndex = 0; ListWrapper.forEach(renderProtoView.elementBinders, (elementBinder) => { @@ -266,7 +264,6 @@ function _collectNestedProtoViewsVariableNames( return nestedPvVariableNames; } - function _createVariableNames(parentVariableNames, renderProtoView): List { var res = isBlank(parentVariableNames) ? [] : ListWrapper.clone(parentVariableNames); MapWrapper.forEach(renderProtoView.variableBindings, diff --git a/modules/angular2/src/core/compiler/view.ts b/modules/angular2/src/core/compiler/view.ts index adbbdd5ebe..1778119c03 100644 --- a/modules/angular2/src/core/compiler/view.ts +++ b/modules/angular2/src/core/compiler/view.ts @@ -183,7 +183,7 @@ export class AppProtoView { new ElementBinder(this.elementBinders.length, parent, distanceToParent, protoElementInjector, directiveVariableBindings, componentDirective); - ListWrapper.push(this.elementBinders, elBinder); + this.elementBinders.push(elBinder); return elBinder; } diff --git a/modules/angular2/src/core/compiler/view_manager_utils.ts b/modules/angular2/src/core/compiler/view_manager_utils.ts index 54f0f765e3..cd792940c6 100644 --- a/modules/angular2/src/core/compiler/view_manager_utils.ts +++ b/modules/angular2/src/core/compiler/view_manager_utils.ts @@ -43,7 +43,7 @@ export class AppViewManagerUtils { elementInjector = protoElementInjector.instantiate(parentElementInjector); } else { elementInjector = protoElementInjector.instantiate(null); - ListWrapper.push(rootElementInjectors, elementInjector); + rootElementInjectors.push(elementInjector); } } elementInjectors[binderIdx] = elementInjector; diff --git a/modules/angular2/src/core/compiler/view_pool.ts b/modules/angular2/src/core/compiler/view_pool.ts index 667ddb22c6..5fd4047ddb 100644 --- a/modules/angular2/src/core/compiler/view_pool.ts +++ b/modules/angular2/src/core/compiler/view_pool.ts @@ -34,7 +34,7 @@ export class AppViewPool { } var haveRemainingCapacity = pooledViews.length < this._poolCapacityPerProtoView; if (haveRemainingCapacity) { - ListWrapper.push(pooledViews, view); + pooledViews.push(view); } return haveRemainingCapacity; } diff --git a/modules/angular2/src/core/testability/testability.ts b/modules/angular2/src/core/testability/testability.ts index e054c54bfc..866c1a4361 100644 --- a/modules/angular2/src/core/testability/testability.ts +++ b/modules/angular2/src/core/testability/testability.ts @@ -17,7 +17,7 @@ export class Testability { constructor() { this._pendingCount = 0; - this._callbacks = ListWrapper.create(); + this._callbacks = []; } increaseCount(delta: number = 1) { @@ -37,7 +37,7 @@ export class Testability { } whenStable(callback: Function) { - ListWrapper.push(this._callbacks, callback); + this._callbacks.push(callback); if (this._pendingCount === 0) { this._runCallbacks(); diff --git a/modules/angular2/src/debug/debug_element.ts b/modules/angular2/src/debug/debug_element.ts index 8fa81775fd..bdd72bf2ec 100644 --- a/modules/angular2/src/debug/debug_element.ts +++ b/modules/angular2/src/debug/debug_element.ts @@ -69,7 +69,7 @@ export class DebugElement { if (!isPresent(shadowView)) { // The current element is not a component. - return ListWrapper.create(); + return []; } return this._getChildElements(shadowView, null); @@ -123,7 +123,7 @@ export class DebugElement { } _getChildElements(view: AppView, parentBoundElementIndex: number): List { - var els = ListWrapper.create(); + var els = []; var parentElementBinder = null; if (isPresent(parentBoundElementIndex)) { parentElementBinder = view.proto.elementBinders[parentBoundElementIndex]; @@ -131,7 +131,7 @@ export class DebugElement { for (var i = 0; i < view.proto.elementBinders.length; ++i) { var binder = view.proto.elementBinders[i]; if (binder.parent == parentElementBinder) { - ListWrapper.push(els, new DebugElement(view, i)); + els.push(new DebugElement(view, i)); var views = view.viewContainers[i]; if (isPresent(views)) { @@ -154,8 +154,8 @@ export function inspectElement(elementRef: ElementRef): DebugElement { */ export class Scope { static all(debugElement): List { - var scope = ListWrapper.create(); - ListWrapper.push(scope, debugElement); + var scope = []; + scope.push(debugElement); ListWrapper.forEach(debugElement.children, (child) => { scope = ListWrapper.concat(scope, Scope.all(child)); }); @@ -166,19 +166,19 @@ export class Scope { return scope; } static light(debugElement): List { - var scope = ListWrapper.create(); + var scope = []; ListWrapper.forEach(debugElement.children, (child) => { - ListWrapper.push(scope, child); + scope.push(child); scope = ListWrapper.concat(scope, Scope.light(child)); }); return scope; } static view(debugElement): List { - var scope = ListWrapper.create(); + var scope = []; ListWrapper.forEach(debugElement.componentViewChildren, (child) => { - ListWrapper.push(scope, child); + scope.push(child); scope = ListWrapper.concat(scope, Scope.light(child)); }); return scope; diff --git a/modules/angular2/src/di/binding.ts b/modules/angular2/src/di/binding.ts index 705e164d41..7029ca4566 100644 --- a/modules/angular2/src/di/binding.ts +++ b/modules/angular2/src/di/binding.ts @@ -501,7 +501,7 @@ function _extractToken(typeOrFunc, annotations /*List | any*/, if (isPresent(paramAnnotation.token)) { token = paramAnnotation.token; } - ListWrapper.push(depProps, paramAnnotation); + depProps.push(paramAnnotation); } } diff --git a/modules/angular2/src/di/exceptions.ts b/modules/angular2/src/di/exceptions.ts index 28e701451b..2e96348930 100644 --- a/modules/angular2/src/di/exceptions.ts +++ b/modules/angular2/src/di/exceptions.ts @@ -5,10 +5,10 @@ function findFirstClosedCycle(keys: List): List { var res = []; for (var i = 0; i < keys.length; ++i) { if (ListWrapper.contains(res, keys[i])) { - ListWrapper.push(res, keys[i]); + res.push(keys[i]); return res; } else { - ListWrapper.push(res, keys[i]); + res.push(keys[i]); } } return res; @@ -45,7 +45,7 @@ export class AbstractBindingError extends BaseException { // TODO(tbosch): Can't do key:Key as this results in a circular dependency! addKey(key): void { - ListWrapper.push(this.keys, key); + this.keys.push(key); this.message = this.constructResolvingMessage(this.keys); } @@ -182,13 +182,13 @@ export class NoAnnotationError extends BaseException { message: string; constructor(typeOrFunc, params: List>) { super(); - var signature = ListWrapper.create(); + var signature = []; for (var i = 0, ii = params.length; i < ii; i++) { var parameter = params[i]; if (isBlank(parameter) || parameter.length == 0) { - ListWrapper.push(signature, '?'); + signature.push('?'); } else { - ListWrapper.push(signature, ListWrapper.map(parameter, stringify).join(' ')); + signature.push(ListWrapper.map(parameter, stringify).join(' ')); } } this.message = "Cannot resolve all parameters for " + stringify(typeOrFunc) + "(" + diff --git a/modules/angular2/src/di/injector.ts b/modules/angular2/src/di/injector.ts index 70ab6600db..a9d0e969c3 100644 --- a/modules/angular2/src/di/injector.ts +++ b/modules/angular2/src/di/injector.ts @@ -390,8 +390,8 @@ export function resolveBindings(bindings: List>): Lis function flattenBindings(bindings: List): List { var map = _flattenBindings(bindings, MapWrapper.create()); - var res = ListWrapper.create(); - MapWrapper.forEach(map, (binding, keyId) => ListWrapper.push(res, binding)); + var res = []; + MapWrapper.forEach(map, (binding, keyId) => res.push(binding)); return res; } diff --git a/modules/angular2/src/directives/ng_for.ts b/modules/angular2/src/directives/ng_for.ts index 6241eba0c1..011aa38895 100644 --- a/modules/angular2/src/directives/ng_for.ts +++ b/modules/angular2/src/directives/ng_for.ts @@ -1,7 +1,6 @@ import {Directive} from 'angular2/annotations'; import {ViewContainerRef, ViewRef, ProtoViewRef} from 'angular2/core'; import {isPresent, isBlank} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; /** * The `NgFor` directive instantiates a template once per item from an iterable. The context for @@ -54,16 +53,16 @@ export class NgFor { // TODO(rado): check if change detection can produce a change record that is // easier to consume than current. var recordViewTuples = []; - changes.forEachRemovedItem((removedRecord) => ListWrapper.push( - recordViewTuples, new RecordViewTuple(removedRecord, null))); + changes.forEachRemovedItem((removedRecord) => + recordViewTuples.push(new RecordViewTuple(removedRecord, null))); - changes.forEachMovedItem((movedRecord) => ListWrapper.push( - recordViewTuples, new RecordViewTuple(movedRecord, null))); + changes.forEachMovedItem((movedRecord) => + recordViewTuples.push(new RecordViewTuple(movedRecord, null))); var insertTuples = NgFor.bulkRemove(recordViewTuples, this.viewContainer); - changes.forEachAddedItem( - (addedRecord) => ListWrapper.push(insertTuples, new RecordViewTuple(addedRecord, null))); + changes.forEachAddedItem((addedRecord) => + insertTuples.push(new RecordViewTuple(addedRecord, null))); NgFor.bulkInsert(insertTuples, this.viewContainer, this.protoViewRef); @@ -85,7 +84,7 @@ export class NgFor { // separate moved views from removed views. if (isPresent(tuple.record.currentIndex)) { tuple.view = viewContainer.detach(tuple.record.previousIndex); - ListWrapper.push(movedTuples, tuple); + movedTuples.push(tuple); } else { viewContainer.remove(tuple.record.previousIndex); } diff --git a/modules/angular2/src/directives/ng_switch.ts b/modules/angular2/src/directives/ng_switch.ts index bd36984946..2ece6d28de 100644 --- a/modules/angular2/src/directives/ng_switch.ts +++ b/modules/angular2/src/directives/ng_switch.ts @@ -53,7 +53,7 @@ export class NgSwitch { constructor() { this._valueViews = MapWrapper.create(); - this._activeViews = ListWrapper.create(); + this._activeViews = []; this._useDefault = false; } @@ -86,7 +86,7 @@ export class NgSwitch { this._emptyAllActiveViews(); } view.create(); - ListWrapper.push(this._activeViews, view); + this._activeViews.push(view); } // Switch to default when there is no more active ViewContainers @@ -101,7 +101,7 @@ export class NgSwitch { for (var i = 0; i < activeContainers.length; i++) { activeContainers[i].destroy(); } - this._activeViews = ListWrapper.create(); + this._activeViews = []; } _activateViews(views: List): void { @@ -117,10 +117,10 @@ export class NgSwitch { _registerView(value, view: SwitchView): void { var views = MapWrapper.get(this._valueViews, value); if (isBlank(views)) { - views = ListWrapper.create(); + views = []; MapWrapper.set(this._valueViews, value, views); } - ListWrapper.push(views, view); + views.push(view); } _deregisterView(value, view: SwitchView): void { diff --git a/modules/angular2/src/dom/generic_browser_adapter.ts b/modules/angular2/src/dom/generic_browser_adapter.ts index 0018dcce4f..db2a797bb5 100644 --- a/modules/angular2/src/dom/generic_browser_adapter.ts +++ b/modules/angular2/src/dom/generic_browser_adapter.ts @@ -13,7 +13,7 @@ export class GenericBrowserDomAdapter extends DomAdapter { cssToRules(css: string): List { var style = this.createStyleElement(css); this.appendChild(this.defaultDoc().head, style); - var rules = ListWrapper.create(); + var rules = []; if (isPresent(style.sheet)) { // TODO(sorvell): Firefox throws when accessing the rules of a stylesheet // with an @import diff --git a/modules/angular2/src/dom/parse5_adapter.ts b/modules/angular2/src/dom/parse5_adapter.ts index 67ae4d6b83..a1e137987d 100644 --- a/modules/angular2/src/dom/parse5_adapter.ts +++ b/modules/angular2/src/dom/parse5_adapter.ts @@ -33,14 +33,14 @@ export class Parse5DomAdapter extends DomAdapter { query(selector) { throw _notImplemented('query'); } querySelector(el, selector: string) { return this.querySelectorAll(el, selector)[0]; } querySelectorAll(el, selector: string) { - var res = ListWrapper.create(); + var res = []; var _recursive = (result, node, selector, matcher) => { var cNodes = node.childNodes; if (cNodes && cNodes.length > 0) { for (var i = 0; i < cNodes.length; i++) { var childNode = cNodes[i]; if (this.elementMatches(childNode, selector, matcher)) { - ListWrapper.push(result, childNode); + result.push(childNode); } _recursive(result, childNode, selector, matcher); } @@ -86,9 +86,9 @@ export class Parse5DomAdapter extends DomAdapter { } var listeners = StringMapWrapper.get(listenersMap, evt); if (isBlank(listeners)) { - listeners = ListWrapper.create(); + listeners = []; } - ListWrapper.push(listeners, listener); + listeners.push(listener); StringMapWrapper.set(listenersMap, evt, listeners); } onAndCancel(el, evt, listener): Function { @@ -287,7 +287,7 @@ export class Parse5DomAdapter extends DomAdapter { var classList = this.classList(element); var index = classList.indexOf(classname); if (index == -1) { - ListWrapper.push(classList, classname); + classList.push(classname); element.attribs["class"] = element.className = ListWrapper.join(classList, " "); } } @@ -417,7 +417,7 @@ export class Parse5DomAdapter extends DomAdapter { } } _buildRules(parsedRules, css?) { - var rules = ListWrapper.create(); + var rules = []; for (var i = 0; i < parsedRules.length; i++) { var parsedRule = parsedRules[i]; var rule: StringMap = StringMapWrapper.create(); @@ -448,13 +448,13 @@ export class Parse5DomAdapter extends DomAdapter { StringMapWrapper.set(rule, "cssRules", this._buildRules(parsedRule.rules)); } } - ListWrapper.push(rules, rule); + rules.push(rule); } return rules; } cssToRules(css: string): List { css = css.replace(/url\(\'(.+)\'\)/g, 'url($1)'); - var rules = ListWrapper.create(); + var rules = []; var parsedCSS = cssParse(css, {silent: true}); if (parsedCSS.stylesheet && parsedCSS.stylesheet.rules) { rules = this._buildRules(parsedCSS.stylesheet.rules, css); diff --git a/modules/angular2/src/facade/collection.dart b/modules/angular2/src/facade/collection.dart index 81ad231dfb..6682bce221 100644 --- a/modules/angular2/src/facade/collection.dart +++ b/modules/angular2/src/facade/collection.dart @@ -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 diff --git a/modules/angular2/src/facade/collection.ts b/modules/angular2/src/facade/collection.ts index 51368fec82..3e50ff6ece 100644 --- a/modules/angular2/src/facade/collection.ts +++ b/modules/angular2/src/facade/collection.ts @@ -145,7 +145,6 @@ export class StringMapWrapper { } export class ListWrapper { - static create(): List { return new List(); } static createFixedSize(size): List { 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]; diff --git a/modules/angular2/src/forms/directives/ng_form_model.ts b/modules/angular2/src/forms/directives/ng_form_model.ts index fdfa64ce44..cf0213258a 100644 --- a/modules/angular2/src/forms/directives/ng_form_model.ts +++ b/modules/angular2/src/forms/directives/ng_form_model.ts @@ -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 this.form.find(dir.path); } diff --git a/modules/angular2/src/forms/directives/shared.ts b/modules/angular2/src/forms/directives/shared.ts index ecdaf0869e..0decce05a1 100644 --- a/modules/angular2/src/forms/directives/shared.ts +++ b/modules/angular2/src/forms/directives/shared.ts @@ -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; } diff --git a/modules/angular2/src/forms/model.ts b/modules/angular2/src/forms/model.ts index ee06b8cf09..fd00fbad5c 100644 --- a/modules/angular2/src/forms/model.ts +++ b/modules/angular2/src/forms/model.ts @@ -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(); } diff --git a/modules/angular2/src/forms/validators.ts b/modules/angular2/src/forms/validators.ts index 0692f12e3d..87ccb9599e 100644 --- a/modules/angular2/src/forms/validators.ts +++ b/modules/angular2/src/forms/validators.ts @@ -51,12 +51,13 @@ export class Validators { return StringMapWrapper.isEmpty(res) ? null : res; } - static _mergeErrors(control: modelModule.AbstractControl, res: StringMap): void { + static _mergeErrors(control: modelModule.AbstractControl, res: StringMap): 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); }); } } diff --git a/modules/angular2/src/http/headers.ts b/modules/angular2/src/http/headers.ts index 34ab615182..16a6ec099a 100644 --- a/modules/angular2/src/http/headers.ts +++ b/modules/angular2/src/http/headers.ts @@ -33,8 +33,8 @@ export class Headers { this._headersMap = MapWrapper.createFromStringMap(headers); MapWrapper.forEach(this._headersMap, (v, k) => { if (!isListLikeIterable(v)) { - var list = ListWrapper.create(); - ListWrapper.push(list, v); + var list = []; + list.push(v); MapWrapper.set(this._headersMap, k, list); } }); @@ -42,8 +42,8 @@ export class Headers { } append(name: string, value: string): void { - var list = MapWrapper.get(this._headersMap, name) || ListWrapper.create(); - ListWrapper.push(list, value); + var list = MapWrapper.get(this._headersMap, name) || []; + list.push(value); MapWrapper.set(this._headersMap, name, list); } @@ -61,11 +61,11 @@ export class Headers { // TODO: this implementation seems wrong. create list then check if it's iterable? set(header: string, value: string | List): void { - var list = ListWrapper.create(); + var list = []; if (!isListLikeIterable(value)) { - ListWrapper.push(list, value); + list.push(value); } else { - ListWrapper.push(list, ListWrapper.toString((>value))); + list.push(ListWrapper.toString((>value))); } MapWrapper.set(this._headersMap, header, list); @@ -73,9 +73,7 @@ export class Headers { values() { return MapWrapper.values(this._headersMap); } - getAll(header: string): Array { - return MapWrapper.get(this._headersMap, header) || ListWrapper.create(); - } + getAll(header: string): Array { return MapWrapper.get(this._headersMap, header) || []; } entries() { throw new BaseException('"entries" method is not implemented on Headers class'); } } diff --git a/modules/angular2/src/http/url_search_params.ts b/modules/angular2/src/http/url_search_params.ts index 47b1e1b7c9..86a04ae50f 100644 --- a/modules/angular2/src/http/url_search_params.ts +++ b/modules/angular2/src/http/url_search_params.ts @@ -8,8 +8,8 @@ function paramParser(rawParams: string): Map> { var split: List = StringWrapper.split(param, '='); var key = ListWrapper.get(split, 0); var val = ListWrapper.get(split, 1); - var list = MapWrapper.get(map, key) || ListWrapper.create(); - ListWrapper.push(list, val); + var list = MapWrapper.get(map, key) || []; + list.push(val); MapWrapper.set(map, key, list); }); return map; @@ -23,20 +23,18 @@ export class URLSearchParams { get(param: string): string { return ListWrapper.first(MapWrapper.get(this.paramsMap, param)); } - getAll(param: string): List { - return MapWrapper.get(this.paramsMap, param) || ListWrapper.create(); - } + getAll(param: string): List { return MapWrapper.get(this.paramsMap, param) || []; } append(param: string, val: string): void { - var list = MapWrapper.get(this.paramsMap, param) || ListWrapper.create(); - ListWrapper.push(list, val); + var list = MapWrapper.get(this.paramsMap, param) || []; + list.push(val); MapWrapper.set(this.paramsMap, param, list); } toString(): string { - var paramsList = ListWrapper.create(); + var paramsList = []; MapWrapper.forEach(this.paramsMap, (values, k) => { - ListWrapper.forEach(values, v => { ListWrapper.push(paramsList, k + '=' + v); }); + ListWrapper.forEach(values, v => { paramsList.push(k + '=' + v); }); }); return ListWrapper.join(paramsList, '&'); } diff --git a/modules/angular2/src/mock/browser_location_mock.ts b/modules/angular2/src/mock/browser_location_mock.ts index d339d2b10e..f18d319e2b 100644 --- a/modules/angular2/src/mock/browser_location_mock.ts +++ b/modules/angular2/src/mock/browser_location_mock.ts @@ -10,7 +10,7 @@ export class DummyBrowserLocation extends SpyObject { internalBaseHref: string = '/'; internalPath: string = '/'; internalTitle: string = ''; - urlChanges: List = ListWrapper.create(); + urlChanges: List = []; _subject: EventEmitter = new EventEmitter(); constructor() { super(); } @@ -28,7 +28,7 @@ export class DummyBrowserLocation extends SpyObject { pushState(ctx: any, title: string, url: string): void { this.internalTitle = title; this.internalPath = url; - ListWrapper.push(this.urlChanges, url); + this.urlChanges.push(url); } forward(): void { throw new BaseException('Not implemented yet!'); } diff --git a/modules/angular2/src/mock/location_mock.ts b/modules/angular2/src/mock/location_mock.ts index 8c374fc863..d34443a0fe 100644 --- a/modules/angular2/src/mock/location_mock.ts +++ b/modules/angular2/src/mock/location_mock.ts @@ -17,7 +17,7 @@ export class SpyLocation extends SpyObject { constructor() { super(); this._path = '/'; - this.urlChanges = ListWrapper.create(); + this.urlChanges = []; this._subject = new EventEmitter(); this._baseHref = ''; } @@ -38,7 +38,7 @@ export class SpyLocation extends SpyObject { return; } this._path = url; - ListWrapper.push(this.urlChanges, url); + this.urlChanges.push(url); } forward() { diff --git a/modules/angular2/src/render/dom/compiler/compile_control.ts b/modules/angular2/src/render/dom/compiler/compile_control.ts index 7de94e4f24..1a06502fba 100644 --- a/modules/angular2/src/render/dom/compiler/compile_control.ts +++ b/modules/angular2/src/render/dom/compiler/compile_control.ts @@ -10,14 +10,14 @@ import {CompileStep} from './compile_step'; export class CompileControl { _currentStepIndex: number = 0; _parent: CompileElement = null; - _results = null; - _additionalChildren = null; + _results: any[] = null; + _additionalChildren: any[] = null; _ignoreCurrentElement: boolean; constructor(public _steps: List) {} // only public so that it can be used by compile_pipeline - internalProcess(results, startStepIndex, parent: CompileElement, current: CompileElement) { + internalProcess(results: any[], startStepIndex, parent: CompileElement, current: CompileElement) { this._results = results; var previousStepIndex = this._currentStepIndex; var previousParent = this._parent; @@ -33,7 +33,7 @@ export class CompileControl { } if (!this._ignoreCurrentElement) { - ListWrapper.push(results, current); + results.push(current); } this._currentStepIndex = previousStepIndex; @@ -51,9 +51,9 @@ export class CompileControl { addChild(element: CompileElement) { if (isBlank(this._additionalChildren)) { - this._additionalChildren = ListWrapper.create(); + this._additionalChildren = []; } - ListWrapper.push(this._additionalChildren, element); + this._additionalChildren.push(element); } /** diff --git a/modules/angular2/src/render/dom/compiler/compile_element.ts b/modules/angular2/src/render/dom/compiler/compile_element.ts index 0be9fb4616..af5e6eee17 100644 --- a/modules/angular2/src/render/dom/compiler/compile_element.ts +++ b/modules/angular2/src/render/dom/compiler/compile_element.ts @@ -63,10 +63,10 @@ export class CompileElement { classList(): List { if (isBlank(this._classList)) { - this._classList = ListWrapper.create(); + this._classList = []; var elClassList = DOM.classList(this.element); for (var i = 0; i < elClassList.length; i++) { - ListWrapper.push(this._classList, elClassList[i]); + this._classList.push(elClassList[i]); } } return this._classList; diff --git a/modules/angular2/src/render/dom/compiler/compile_pipeline.ts b/modules/angular2/src/render/dom/compiler/compile_pipeline.ts index 87fc86cd47..a39a370a88 100644 --- a/modules/angular2/src/render/dom/compiler/compile_pipeline.ts +++ b/modules/angular2/src/render/dom/compiler/compile_pipeline.ts @@ -20,7 +20,7 @@ export class CompilePipeline { if (isBlank(protoViewType)) { protoViewType = ViewType.COMPONENT; } - var results = ListWrapper.create(); + var results = []; var rootCompileElement = new CompileElement(rootElement, compilationCtxtDescription); rootCompileElement.inheritedProtoView = new ProtoViewBuilder(rootElement, protoViewType); rootCompileElement.isViewRoot = true; diff --git a/modules/angular2/src/render/dom/compiler/directive_parser.ts b/modules/angular2/src/render/dom/compiler/directive_parser.ts index 0317ed6f93..bb6397d739 100644 --- a/modules/angular2/src/render/dom/compiler/directive_parser.ts +++ b/modules/angular2/src/render/dom/compiler/directive_parser.ts @@ -74,7 +74,7 @@ export class DirectiveParser implements CompileStep { componentDirective = directive; elementBinder.setComponentId(directive.id); } else { - ListWrapper.push(foundDirectiveIndices, directiveIndex); + foundDirectiveIndices.push(directiveIndex); } }); ListWrapper.forEach(foundDirectiveIndices, (directiveIndex) => { diff --git a/modules/angular2/src/render/dom/compiler/selector.ts b/modules/angular2/src/render/dom/compiler/selector.ts index ddba38d9e0..a339488c56 100644 --- a/modules/angular2/src/render/dom/compiler/selector.ts +++ b/modules/angular2/src/render/dom/compiler/selector.ts @@ -32,13 +32,13 @@ export class CssSelector { notSelectors: List = []; static parse(selector: string): List { - var results = ListWrapper.create(); - var _addResult = (res, cssSel) => { + var results: CssSelector[] = []; + var _addResult = (res: CssSelector[], cssSel) => { if (cssSel.notSelectors.length > 0 && isBlank(cssSel.element) && ListWrapper.isEmpty(cssSel.classNames) && ListWrapper.isEmpty(cssSel.attrs)) { cssSel.element = "*"; } - ListWrapper.push(res, cssSel); + res.push(cssSel); }; var cssSelector = new CssSelector(); var matcher = RegExpWrapper.matcher(_SELECTOR_REGEXP, selector); @@ -52,7 +52,7 @@ export class CssSelector { } inNot = true; current = new CssSelector(); - ListWrapper.push(cssSelector.notSelectors, current); + cssSelector.notSelectors.push(current); } if (isPresent(match[2])) { current.setElement(match[2]); @@ -92,16 +92,16 @@ export class CssSelector { } addAttribute(name: string, value: string = _EMPTY_ATTR_VALUE) { - ListWrapper.push(this.attrs, name.toLowerCase()); + this.attrs.push(name.toLowerCase()); if (isPresent(value)) { value = value.toLowerCase(); } else { value = _EMPTY_ATTR_VALUE; } - ListWrapper.push(this.attrs, value); + this.attrs.push(value); } - addClassName(name: string) { ListWrapper.push(this.classNames, name.toLowerCase()); } + addClassName(name: string) { this.classNames.push(name.toLowerCase()); } toString(): string { var res = ''; @@ -141,11 +141,11 @@ export class SelectorMatcher { return notMatcher; } - private _elementMap: Map> = MapWrapper.create(); + private _elementMap: Map> = MapWrapper.create(); private _elementPartialMap: Map = MapWrapper.create(); - private _classMap: Map> = MapWrapper.create(); + private _classMap: Map> = MapWrapper.create(); private _classPartialMap: Map = MapWrapper.create(); - private _attrValueMap: Map>> = MapWrapper.create(); + private _attrValueMap: Map>> = MapWrapper.create(); private _attrValuePartialMap: Map> = MapWrapper.create(); private _listContexts: List = []; @@ -153,7 +153,7 @@ export class SelectorMatcher { var listContext = null; if (cssSelectors.length > 1) { listContext = new SelectorListContext(cssSelectors); - ListWrapper.push(this._listContexts, listContext); + this._listContexts.push(listContext); } for (var i = 0; i < cssSelectors.length; i++) { this._addSelectable(cssSelectors[i], callbackCtxt, listContext); @@ -220,13 +220,14 @@ export class SelectorMatcher { } } - private _addTerminal(map: Map>, name: string, selectable: SelectorContext) { + private _addTerminal(map: Map>, name: string, + selectable: SelectorContext) { var terminalList = MapWrapper.get(map, name); if (isBlank(terminalList)) { - terminalList = ListWrapper.create(); + terminalList = []; MapWrapper.set(map, name, terminalList); } - ListWrapper.push(terminalList, selectable); + terminalList.push(selectable); } private _addPartial(map: Map, name: string): SelectorMatcher { @@ -297,8 +298,8 @@ export class SelectorMatcher { return result; } - _matchTerminal(map: Map>, name, cssSelector: CssSelector, - matchedCallback /*: (CssSelector, any) => void*/): boolean { + _matchTerminal(map: Map>, name, cssSelector: CssSelector, + matchedCallback: (CssSelector, any) => void): boolean { if (isBlank(map) || isBlank(name)) { return false; } diff --git a/modules/angular2/src/render/dom/dom_renderer.ts b/modules/angular2/src/render/dom/dom_renderer.ts index a286032968..0d57bec527 100644 --- a/modules/angular2/src/render/dom/dom_renderer.ts +++ b/modules/angular2/src/render/dom/dom_renderer.ts @@ -151,7 +151,7 @@ export class DomRenderer extends Renderer { } // add global events - view.eventHandlerRemovers = ListWrapper.create(); + view.eventHandlerRemovers = []; var binders = view.proto.elementBinders; for (var binderIdx = 0; binderIdx < binders.length; binderIdx++) { var binder = binders[binderIdx]; @@ -160,7 +160,7 @@ export class DomRenderer extends Renderer { var globalEvent = binder.globalEvents[i]; var remover = this._createGlobalEventListener(view, binderIdx, globalEvent.name, globalEvent.target, globalEvent.fullName); - ListWrapper.push(view.eventHandlerRemovers, remover); + view.eventHandlerRemovers.push(remover); } } } diff --git a/modules/angular2/src/render/dom/shadow_dom/light_dom.ts b/modules/angular2/src/render/dom/shadow_dom/light_dom.ts index 3cd7419ace..8074b69a45 100644 --- a/modules/angular2/src/render/dom/shadow_dom/light_dom.ts +++ b/modules/angular2/src/render/dom/shadow_dom/light_dom.ts @@ -55,7 +55,7 @@ export class LightDom { for (var i = 0; i < els.length; i++) { var el = els[i]; if (isPresent(el.contentTag)) { - ListWrapper.push(acc, el.contentTag); + acc.push(el.contentTag); } if (isPresent(el.viewContainer)) { ListWrapper.forEach(el.viewContainer.contentTagContainers(), @@ -83,10 +83,10 @@ export class LightDom { } else if (isPresent(content)) { res = ListWrapper.concat(res, content.nodes()); } else { - ListWrapper.push(res, root.node); + res.push(root.node); } } else { - ListWrapper.push(res, root.node); + res.push(root.node); } } return res; diff --git a/modules/angular2/src/render/dom/shadow_dom/shadow_css.ts b/modules/angular2/src/render/dom/shadow_dom/shadow_css.ts index e300fac25e..6a13c3e145 100644 --- a/modules/angular2/src/render/dom/shadow_dom/shadow_css.ts +++ b/modules/angular2/src/render/dom/shadow_dom/shadow_css.ts @@ -303,7 +303,7 @@ export class ShadowCss { var p = parts[i]; if (isBlank(p)) break; p = p.trim(); - ListWrapper.push(r, partReplacer(_polyfillHostNoCombinator, p, m[3])); + r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); } return r.join(','); } else { @@ -392,7 +392,7 @@ export class ShadowCss { this._applyStrictSelectorScope(p, scopeSelector) : this._applySelectorScope(p, scopeSelector, hostSelector); } - ListWrapper.push(r, p); + r.push(p); } return r.join(', '); } diff --git a/modules/angular2/src/render/dom/shadow_dom/shadow_dom_compile_step.ts b/modules/angular2/src/render/dom/shadow_dom/shadow_dom_compile_step.ts index 74e7fceaf7..4b4df8b154 100644 --- a/modules/angular2/src/render/dom/shadow_dom/shadow_dom_compile_step.ts +++ b/modules/angular2/src/render/dom/shadow_dom/shadow_dom_compile_step.ts @@ -31,7 +31,7 @@ export class ShadowDomCompileStep implements CompileStep { var stylePromise = this._shadowDomStrategy.processStyleElement( this._template.componentId, this._template.templateAbsUrl, current.element); if (isPresent(stylePromise) && isPromise(stylePromise)) { - ListWrapper.push(this._subTaskPromises, stylePromise); + this._subTaskPromises.push(stylePromise); } // Style elements should not be further processed by the compiler, as they can not contain diff --git a/modules/angular2/src/render/dom/shadow_dom/style_inliner.ts b/modules/angular2/src/render/dom/shadow_dom/style_inliner.ts index c6a78fb8cc..c2bd757463 100644 --- a/modules/angular2/src/render/dom/shadow_dom/style_inliner.ts +++ b/modules/angular2/src/render/dom/shadow_dom/style_inliner.ts @@ -73,7 +73,7 @@ export class StyleInliner { // Importing again might cause a circular dependency promise = PromiseWrapper.resolve(prefix); } else { - ListWrapper.push(inlinedUrls, url); + inlinedUrls.push(url); promise = PromiseWrapper.then(this._xhr.get(url), (rawCss) => { // resolve nested @import rules var inlinedCss = this._inlineImports(rawCss, url, inlinedUrls); @@ -88,7 +88,7 @@ export class StyleInliner { } }, (error) => `/* failed to import ${url} */\n`); } - ListWrapper.push(promises, promise); + promises.push(promise); partIndex += 2; } diff --git a/modules/angular2/src/render/dom/view/proto_view_builder.ts b/modules/angular2/src/render/dom/view/proto_view_builder.ts index c9dec27834..fb1a95055e 100644 --- a/modules/angular2/src/render/dom/view/proto_view_builder.ts +++ b/modules/angular2/src/render/dom/view/proto_view_builder.ts @@ -27,7 +27,7 @@ export class ProtoViewBuilder { bindElement(element, description = null): ElementBinderBuilder { var builder = new ElementBinderBuilder(this.elements.length, element, description); - ListWrapper.push(this.elements, builder); + this.elements.push(builder); DOM.addClass(element, NG_BINDING_CLASS); return builder; @@ -90,7 +90,7 @@ export class ProtoViewBuilder { transitiveContentTagCount++; } var parentIndex = isPresent(ebb.parent) ? ebb.parent.index : -1; - ListWrapper.push(apiElementBinders, new api.ElementBinder({ + apiElementBinders.push(new api.ElementBinder({ index: ebb.index, parentIndex: parentIndex, distanceToParent: ebb.distanceToParent, @@ -103,22 +103,21 @@ export class ProtoViewBuilder { readAttributes: ebb.readAttributes })); var elementIsEmpty = this._isEmptyElement(ebb.element); - ListWrapper.push(renderElementBinders, new ElementBinder({ - textNodeIndices: ebb.textBindingIndices, - contentTagSelector: ebb.contentTagSelector, - parentIndex: parentIndex, - distanceToParent: ebb.distanceToParent, - nestedProtoView: isPresent(nestedProtoView) ? - resolveInternalDomProtoView(nestedProtoView.render) : - null, - componentId: ebb.componentId, - eventLocals: new LiteralArray(ebb.eventBuilder.buildEventLocals()), - localEvents: ebb.eventBuilder.buildLocalEvents(), - globalEvents: ebb.eventBuilder.buildGlobalEvents(), - hostActions: hostActions, - propertySetters: propertySetters, - elementIsEmpty: elementIsEmpty - })); + renderElementBinders.push(new ElementBinder({ + textNodeIndices: ebb.textBindingIndices, + contentTagSelector: ebb.contentTagSelector, + parentIndex: parentIndex, + distanceToParent: ebb.distanceToParent, + nestedProtoView: + isPresent(nestedProtoView) ? resolveInternalDomProtoView(nestedProtoView.render) : null, + componentId: ebb.componentId, + eventLocals: new LiteralArray(ebb.eventBuilder.buildEventLocals()), + localEvents: ebb.eventBuilder.buildLocalEvents(), + globalEvents: ebb.eventBuilder.buildGlobalEvents(), + hostActions: hostActions, + propertySetters: propertySetters, + elementIsEmpty: elementIsEmpty + })); }); return new api.ProtoViewDto({ render: new DomProtoViewRef(new DomProtoView({ @@ -178,7 +177,7 @@ export class ElementBinderBuilder { bindDirective(directiveIndex: number): DirectiveBuilder { var directive = new DirectiveBuilder(directiveIndex); - ListWrapper.push(this.directives, directive); + this.directives.push(directive); return directive; } @@ -211,12 +210,12 @@ export class ElementBinderBuilder { } bindEvent(name, expression, target = null) { - ListWrapper.push(this.eventBindings, this.eventBuilder.add(name, expression, target)); + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); } bindText(index, expression) { - ListWrapper.push(this.textBindingIndices, index); - ListWrapper.push(this.textBindings, expression); + this.textBindingIndices.push(index); + this.textBindings.push(expression); } setContentTagSelector(value: string) { this.contentTagSelector = value; } @@ -240,11 +239,11 @@ export class DirectiveBuilder { } bindHostAction(actionName: string, actionExpression: string, expression: ASTWithSource) { - ListWrapper.push(this.hostActions, new HostAction(actionName, actionExpression, expression)); + this.hostActions.push(new HostAction(actionName, actionExpression, expression)); } bindEvent(name, expression, target = null) { - ListWrapper.push(this.eventBindings, this.eventBuilder.add(name, expression, target)); + this.eventBindings.push(this.eventBuilder.add(name, expression, target)); } } @@ -266,9 +265,9 @@ export class EventBuilder extends AstTransformer { fullName, new ASTWithSource(adjustedAst, source.source, source.location)); var event = new Event(name, target, fullName); if (isBlank(target)) { - ListWrapper.push(this.localEvents, event); + this.localEvents.push(event); } else { - ListWrapper.push(this.globalEvents, event); + this.globalEvents.push(event); } return result; } @@ -285,7 +284,7 @@ export class EventBuilder extends AstTransformer { } if (isEventAccess) { - ListWrapper.push(this.locals, ast); + this.locals.push(ast); var index = this.locals.length - 1; return new AccessMember(this._implicitReceiver, `${index}`, (arr) => arr[index], null); } else { @@ -306,13 +305,13 @@ export class EventBuilder extends AstTransformer { } _merge(host: List, tobeAdded: List) { - var names = ListWrapper.create(); + var names = []; for (var i = 0; i < host.length; i++) { - ListWrapper.push(names, host[i].fullName); + names.push(host[i].fullName); } for (var j = 0; j < tobeAdded.length; j++) { if (!ListWrapper.contains(names, tobeAdded[j].fullName)) { - ListWrapper.push(host, tobeAdded[j]); + host.push(tobeAdded[j]); } } } diff --git a/modules/angular2/src/render/xhr_mock.ts b/modules/angular2/src/render/xhr_mock.ts index 88bac08085..b74e1920ac 100644 --- a/modules/angular2/src/render/xhr_mock.ts +++ b/modules/angular2/src/render/xhr_mock.ts @@ -6,7 +6,7 @@ import {PromiseWrapper, Promise} from 'angular2/src/facade/async'; export class MockXHR extends XHR { private _expectations: List<_Expectation>; private _definitions: Map; - private _requests: List>; + private _requests: List<_PendingRequest>; constructor() { super(); @@ -17,13 +17,13 @@ export class MockXHR extends XHR { get(url: string): Promise { var request = new _PendingRequest(url); - ListWrapper.push(this._requests, request); + this._requests.push(request); return request.getPromise(); } expect(url: string, response: string) { var expectation = new _Expectation(url, response); - ListWrapper.push(this._expectations, expectation); + this._expectations.push(expectation); } when(url: string, response: string) { MapWrapper.set(this._definitions, url, response); } @@ -47,7 +47,7 @@ export class MockXHR extends XHR { var urls = []; for (var i = 0; i < this._expectations.length; i++) { var expectation = this._expectations[i]; - ListWrapper.push(urls, expectation.url); + urls.push(expectation.url); } throw new BaseException(`Unsatisfied requests: ${ListWrapper.join(urls, ', ')}`); diff --git a/modules/angular2/src/router/path_recognizer.ts b/modules/angular2/src/router/path_recognizer.ts index adc0e7cf8f..a0f03691ea 100644 --- a/modules/angular2/src/router/path_recognizer.ts +++ b/modules/angular2/src/router/path_recognizer.ts @@ -76,7 +76,7 @@ function parsePathString(route: string) { } var segments = splitBySlash(route); - var results = ListWrapper.create(); + var results = []; var specificity = 0; // The "specificity" of a path is used to determine which route is used when multiple routes match @@ -97,12 +97,12 @@ function parsePathString(route: string) { var segment = segments[i], match; if (isPresent(match = RegExpWrapper.firstMatch(paramMatcher, segment))) { - ListWrapper.push(results, new DynamicSegment(match[1])); + results.push(new DynamicSegment(match[1])); specificity += (100 - i); } else if (isPresent(match = RegExpWrapper.firstMatch(wildcardMatcher, segment))) { - ListWrapper.push(results, new StarSegment(match[1])); + results.push(new StarSegment(match[1])); } else if (segment.length > 0) { - ListWrapper.push(results, new StaticSegment(segment)); + results.push(new StaticSegment(segment)); specificity += 100 * (100 - i); } } diff --git a/modules/angular2/src/router/route_recognizer.ts b/modules/angular2/src/router/route_recognizer.ts index fc0d1bd79e..8e2efac859 100644 --- a/modules/angular2/src/router/route_recognizer.ts +++ b/modules/angular2/src/router/route_recognizer.ts @@ -54,7 +54,7 @@ export class RouteRecognizer { * */ recognize(url: string): List { - var solutions = ListWrapper.create(); + var solutions = []; MapWrapper.forEach(this.redirects, (target, path) => { // "/" redirect case @@ -77,13 +77,13 @@ export class RouteRecognizer { matchedUrl = match[0]; unmatchedUrl = StringWrapper.substring(url, match[0].length); } - ListWrapper.push(solutions, new RouteMatch({ - specificity: pathRecognizer.specificity, - handler: pathRecognizer.handler, - params: pathRecognizer.parseParams(url), - matchedUrl: matchedUrl, - unmatchedUrl: unmatchedUrl - })); + solutions.push(new RouteMatch({ + specificity: pathRecognizer.specificity, + handler: pathRecognizer.handler, + params: pathRecognizer.parseParams(url), + matchedUrl: matchedUrl, + unmatchedUrl: unmatchedUrl + })); } }); diff --git a/modules/angular2/src/test_lib/fake_async.ts b/modules/angular2/src/test_lib/fake_async.ts index 2881334cdd..8f24389f83 100644 --- a/modules/angular2/src/test_lib/fake_async.ts +++ b/modules/angular2/src/test_lib/fake_async.ts @@ -1,4 +1,4 @@ -/// +/// 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 { diff --git a/modules/angular2/src/test_lib/utils.ts b/modules/angular2/src/test_lib/utils.ts index fef4a73859..bc45a0614c 100644 --- a/modules/angular2/src/test_lib/utils.ts +++ b/modules/angular2/src/test_lib/utils.ts @@ -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]; diff --git a/modules/angular2/test/change_detection/change_detector_config.ts b/modules/angular2/test/change_detection/change_detector_config.ts index 70f3c7b3e0..3b396a1b6e 100644 --- a/modules/angular2/test/change_detection/change_detector_config.ts +++ b/modules/angular2/test/change_detection/change_detector_config.ts @@ -35,7 +35,7 @@ function _convertLocalsToVariableBindings(locals: Locals): List { var variableBindings = []; var loc = locals; while (isPresent(loc) && isPresent(loc.current)) { - MapWrapper.forEach(loc.current, (v, k) => ListWrapper.push(variableBindings, k)); + MapWrapper.forEach(loc.current, (v, k) => variableBindings.push(k)); loc = loc.parent; } return variableBindings; diff --git a/modules/angular2/test/change_detection/change_detector_spec.ts b/modules/angular2/test/change_detection/change_detector_spec.ts index 36c0ef7fd9..b1828dc5db 100644 --- a/modules/angular2/test/change_detection/change_detector_spec.ts +++ b/modules/angular2/test/change_detection/change_detector_spec.ts @@ -455,9 +455,9 @@ export function main() { var onChangesDoneCalls = []; var td1; - td1 = new TestDirective(() => ListWrapper.push(onChangesDoneCalls, td1)); + td1 = new TestDirective(() => onChangesDoneCalls.push(td1)); var td2; - td2 = new TestDirective(() => ListWrapper.push(onChangesDoneCalls, td2)); + td2 = new TestDirective(() => onChangesDoneCalls.push(td2)); cd.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([td1, td2], [])); cd.detectChanges(); @@ -473,11 +473,11 @@ export function main() { var orderOfOperations = []; var directiveInShadowDom = null; - directiveInShadowDom = new TestDirective( - () => { ListWrapper.push(orderOfOperations, directiveInShadowDom); }); + directiveInShadowDom = + new TestDirective(() => { orderOfOperations.push(directiveInShadowDom); }); var parentDirective = null; - parentDirective = new TestDirective( - () => { ListWrapper.push(orderOfOperations, parentDirective); }); + parentDirective = + new TestDirective(() => { orderOfOperations.push(parentDirective); }); parent.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([parentDirective], [])); child.hydrate(_DEFAULT_CONTEXT, null, new FakeDirectives([directiveInShadowDom], [])); @@ -989,14 +989,14 @@ class TestDispatcher extends ChangeDispatcher { } clear() { - this.log = ListWrapper.create(); - this.loggedValues = ListWrapper.create(); + this.log = []; + this.loggedValues = []; this.onAllChangesDoneCalled = true; } notifyOnBinding(binding, value) { - ListWrapper.push(this.log, `${binding.propertyName}=${this._asString(value)}`); - ListWrapper.push(this.loggedValues, value); + this.log.push(`${binding.propertyName}=${this._asString(value)}`); + this.loggedValues.push(value); } notifyOnAllChangesDone() { this.onAllChangesDoneCalled = true; } diff --git a/modules/angular2/test/change_detection/parser/parser_spec.ts b/modules/angular2/test/change_detection/parser/parser_spec.ts index 4d3002d28e..68a7e48321 100644 --- a/modules/angular2/test/change_detection/parser/parser_spec.ts +++ b/modules/angular2/test/change_detection/parser/parser_spec.ts @@ -63,7 +63,7 @@ export function main() { var c = isBlank(passedInContext) ? td() : passedInContext; var res = []; for (var i = 0; i < asts.length; i++) { - ListWrapper.push(res, asts[i].eval(c, emptyLocals())); + res.push(asts[i].eval(c, emptyLocals())); } return res; } diff --git a/modules/angular2/test/change_detection/pipes/json_pipe_spec.ts b/modules/angular2/test/change_detection/pipes/json_pipe_spec.ts index 03fe47e84f..512f876ff9 100644 --- a/modules/angular2/test/change_detection/pipes/json_pipe_spec.ts +++ b/modules/angular2/test/change_detection/pipes/json_pipe_spec.ts @@ -14,7 +14,6 @@ import { IS_DARTIUM } from 'angular2/test_lib'; import {Json, RegExp, NumberWrapper, StringWrapper} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; import {JsonPipe} from 'angular2/src/change_detection/pipes/json_pipe'; @@ -26,7 +25,7 @@ export function main() { var inceptionObjString; var catString; var pipe; - var collection; + var collection: number[]; function normalize(obj: string): string { return StringWrapper.replace(obj, regNewLine, ''); } @@ -87,7 +86,7 @@ export function main() { expect(pipe.transform(collection)).toEqual(stringCollection); - ListWrapper.push(collection, 1); + collection.push(1); expect(pipe.transform(collection)).toEqual(stringCollectionWith1); }); diff --git a/modules/angular2/test/core/compiler/compiler_spec.ts b/modules/angular2/test/core/compiler/compiler_spec.ts index ef8f758b62..a88ceb4f7f 100644 --- a/modules/angular2/test/core/compiler/compiler_spec.ts +++ b/modules/angular2/test/core/compiler/compiler_spec.ts @@ -41,7 +41,8 @@ import {RenderCompiler} from 'angular2/src/render/api'; export function main() { describe('compiler', function() { var directiveResolver, tplResolver, renderCompiler, protoViewFactory, cmpUrlMapper, - renderCompileRequests, rootProtoView; + rootProtoView; + var renderCompileRequests: any[]; beforeEach(() => { directiveResolver = new DirectiveResolver(); @@ -61,7 +62,7 @@ export function main() { var urlResolver = new FakeUrlResolver(); renderCompileRequests = []; renderCompiler.spy('compile').andCallFake((template) => { - ListWrapper.push(renderCompileRequests, template); + renderCompileRequests.push(template); return PromiseWrapper.resolve(ListWrapper.removeAt(renderCompileResults, 0)); }); @@ -607,7 +608,7 @@ class FakeProtoViewFactory extends ProtoViewFactory { createAppProtoViews(componentBinding: DirectiveBinding, renderProtoView: renderApi.ProtoViewDto, directives: List): List { - ListWrapper.push(this.requests, [componentBinding, renderProtoView, directives]); + this.requests.push([componentBinding, renderProtoView, directives]); return ListWrapper.removeAt(this.results, 0); } } diff --git a/modules/angular2/test/core/compiler/element_injector_spec.ts b/modules/angular2/test/core/compiler/element_injector_spec.ts index 70760cb613..134d16c6f7 100644 --- a/modules/angular2/test/core/compiler/element_injector_spec.ts +++ b/modules/angular2/test/core/compiler/element_injector_spec.ts @@ -226,7 +226,7 @@ export function main() { var dynamicBindings = []; for (var i = 0; i < 20; i++) { - ListWrapper.push(dynamicBindings, bind(i).toValue(i)); + dynamicBindings.push(bind(i).toValue(i)); } function createPei(parent, index, bindings, distance = 1, hasShadowRoot = false) { @@ -1090,6 +1090,6 @@ class FakeRenderer extends Renderer { this.log = []; } setElementProperty(viewRef, elementIndex, propertyName, value) { - ListWrapper.push(this.log, [viewRef, elementIndex, propertyName, value]); + this.log.push([viewRef, elementIndex, propertyName, value]); } } diff --git a/modules/angular2/test/core/compiler/view_manager_spec.ts b/modules/angular2/test/core/compiler/view_manager_spec.ts index 5a35be4b17..561e92af55 100644 --- a/modules/angular2/test/core/compiler/view_manager_spec.ts +++ b/modules/angular2/test/core/compiler/view_manager_spec.ts @@ -42,8 +42,8 @@ export function main() { var viewPool; var manager; var directiveResolver; - var createdViews; - var createdRenderViews; + var createdViews: any[]; + var createdRenderViews: any[]; function wrapPv(protoView: AppProtoView): ProtoViewRef { return new ProtoViewRef(protoView); } @@ -124,7 +124,7 @@ export function main() { utils.spy('createView') .andCallFake((proto, renderViewRef, _a, _b) => { var view = createView(proto, renderViewRef); - ListWrapper.push(createdViews, view); + createdViews.push(view); return view; }); utils.spy('attachComponentView') @@ -143,13 +143,13 @@ export function main() { renderer.spy('createRootHostView') .andCallFake((_b, _c) => { var rv = new RenderViewRef(); - ListWrapper.push(createdRenderViews, rv); + createdRenderViews.push(rv); return rv; }); renderer.spy('createView') .andCallFake((_a) => { var rv = new RenderViewRef(); - ListWrapper.push(createdRenderViews, rv); + createdRenderViews.push(rv); return rv; }); viewPool.spy('returnView').andReturn(true); diff --git a/modules/angular2/test/core/directive_lifecycle_integration_spec.ts b/modules/angular2/test/core/directive_lifecycle_integration_spec.ts index d7a65f1bc9..2ea9d8f9ac 100644 --- a/modules/angular2/test/core/directive_lifecycle_integration_spec.ts +++ b/modules/angular2/test/core/directive_lifecycle_integration_spec.ts @@ -74,13 +74,13 @@ class LifecycleDir { constructor() { this.log = []; } - onChange(_) { ListWrapper.push(this.log, "onChange"); } + onChange(_) { this.log.push("onChange"); } - onInit() { ListWrapper.push(this.log, "onInit"); } + onInit() { this.log.push("onInit"); } - onCheck() { ListWrapper.push(this.log, "onCheck"); } + onCheck() { this.log.push("onCheck"); } - onAllChangesDone() { ListWrapper.push(this.log, "onAllChangesDone"); } + onAllChangesDone() { this.log.push("onAllChangesDone"); } } @Component({selector: 'my-comp'}) diff --git a/modules/angular2/test/core/zone/ng_zone_spec.ts b/modules/angular2/test/core/zone/ng_zone_spec.ts index 208e3c7124..d581e37f3a 100644 --- a/modules/angular2/test/core/zone/ng_zone_spec.ts +++ b/modules/angular2/test/core/zone/ng_zone_spec.ts @@ -14,7 +14,6 @@ import { } from 'angular2/test_lib'; import {PromiseWrapper, TimerWrapper} from 'angular2/src/facade/async'; -import {ListWrapper} from 'angular2/src/facade/collection'; import {BaseException} from 'angular2/src/facade/lang'; import {DOM} from 'angular2/src/dom/dom_adapter'; @@ -33,13 +32,13 @@ function microTask(fn: Function): void { } var _log; -var _errors; -var _traces; +var _errors: any[]; +var _traces: any[]; var _zone; function logError(error, stackTrace) { - ListWrapper.push(_errors, error); - ListWrapper.push(_traces, stackTrace); + _errors.push(error); + _traces.push(stackTrace); } export function main() { @@ -205,7 +204,8 @@ function commonTests() { _zone.initCallbacks({ onTurnDone: () => { _log.add('onTurnDone:started'); - _zone.run(() => _log.add('nested run')) _log.add('onTurnDone:finished'); + _zone.run(() => _log.add('nested run')); + _log.add('onTurnDone:finished'); } }); diff --git a/modules/angular2/test/debug/debug_element_spec.ts b/modules/angular2/test/debug/debug_element_spec.ts index d23fe39b32..d62004013f 100644 --- a/modules/angular2/test/debug/debug_element_spec.ts +++ b/modules/angular2/test/debug/debug_element_spec.ts @@ -36,9 +36,9 @@ import {NgFor} from 'angular2/src/directives/ng_for'; class Logger { log: List; - constructor() { this.log = ListWrapper.create(); } + constructor() { this.log = []; } - add(thing: string) { ListWrapper.push(this.log, thing); } + add(thing: string) { this.log.push(thing); } } @Directive({selector: '[message]', properties: ['message']}) diff --git a/modules/angular2/test/directives/ng_for_spec.ts b/modules/angular2/test/directives/ng_for_spec.ts index b18ab63403..66564597e6 100644 --- a/modules/angular2/test/directives/ng_for_spec.ts +++ b/modules/angular2/test/directives/ng_for_spec.ts @@ -43,7 +43,7 @@ export function main() { .then((view) => { view.detectChanges(); - ListWrapper.push(view.context.items, 3); + (view.context.items).push(3); view.detectChanges(); expect(DOM.getText(view.rootNodes[0])).toEqual('1;2;3;'); @@ -72,7 +72,7 @@ export function main() { view.detectChanges(); ListWrapper.removeAt(view.context.items, 0); - ListWrapper.push(view.context.items, 1); + (view.context.items).push(1); view.detectChanges(); expect(DOM.getText(view.rootNodes[0])).toEqual('2;1;'); @@ -108,7 +108,7 @@ export function main() { expect(DOM.getText(view.rootNodes[0])).toEqual('misko;shyam;'); // GROW - ListWrapper.push(view.context.items, {'name': 'adam'}); + (view.context.items).push({'name': 'adam'}); view.detectChanges(); expect(DOM.getText(view.rootNodes[0])).toEqual('misko;shyam;adam;'); diff --git a/modules/angular2/test/facade/lang_spec.ts b/modules/angular2/test/facade/lang_spec.ts index 077cd92558..097358dd75 100644 --- a/modules/angular2/test/facade/lang_spec.ts +++ b/modules/angular2/test/facade/lang_spec.ts @@ -1,6 +1,4 @@ import {describe, it, expect, beforeEach, ddescribe, iit, xit, el} from 'angular2/test_lib'; - -import {ListWrapper} from 'angular2/src/facade/collection'; import { isPresent, RegExpWrapper, @@ -18,7 +16,7 @@ export function main() { var m; while (isPresent(m = RegExpMatcherWrapper.next(matcher))) { - ListWrapper.push(indexes, m.index); + indexes.push(m.index); expect(m[0]).toEqual('!'); expect(m[1]).toEqual('!'); expect(m.length).toBe(2); diff --git a/modules/angular2/test/forms/model_spec.ts b/modules/angular2/test/forms/model_spec.ts index d64bc0bf7f..a8740183b1 100644 --- a/modules/angular2/test/forms/model_spec.ts +++ b/modules/angular2/test/forms/model_spec.ts @@ -15,7 +15,6 @@ import { } from 'angular2/test_lib'; import {ControlGroup, Control, ControlArray, Validators} from 'angular2/forms'; import {ObservableWrapper} from 'angular2/src/facade/async'; -import {ListWrapper} from 'angular2/src/facade/collection'; export function main() { describe("Form Model", () => { @@ -312,7 +311,7 @@ export function main() { var loggedValues = []; ObservableWrapper.subscribe(g.valueChanges, (value) => { - ListWrapper.push(loggedValues, value); + loggedValues.push(value); if (loggedValues.length == 2) { expect(loggedValues) diff --git a/modules/angular2/test/render/dom/compiler/compiler_common_tests.ts b/modules/angular2/test/render/dom/compiler/compiler_common_tests.ts index 19c259b61d..695eaab17a 100644 --- a/modules/angular2/test/render/dom/compiler/compiler_common_tests.ts +++ b/modules/angular2/test/render/dom/compiler/compiler_common_tests.ts @@ -30,7 +30,7 @@ import {resolveInternalDomProtoView} from 'angular2/src/render/dom/view/proto_vi export function runCompilerCommonTests() { describe('DomCompiler', function() { - var mockStepFactory; + var mockStepFactory: MockStepFactory; function createCompiler(processClosure, urlData = null) { if (isBlank(urlData)) { @@ -117,8 +117,8 @@ export function runCompilerCommonTests() { var completer = PromiseWrapper.completer(); var compiler = createCompiler((parent, current, control) => { - ListWrapper.push(mockStepFactory.subTaskPromises, - completer.promise.then((_) => { subTasksCompleted = true; })); + mockStepFactory.subTaskPromises.push( + completer.promise.then((_) => { subTasksCompleted = true; })); }); // It should always return a Promise because the subtask is async @@ -177,7 +177,7 @@ class MockStepFactory extends CompileStepFactory { createSteps(viewDef, subTaskPromises) { this.viewDef = viewDef; this.subTaskPromises = subTaskPromises; - ListWrapper.forEach(this.subTaskPromises, (p) => ListWrapper.push(subTaskPromises, p)); + ListWrapper.forEach(this.subTaskPromises, (p) => this.subTaskPromises.push(p)); return this.steps; } } diff --git a/modules/angular2/test/render/dom/compiler/pipeline_spec.ts b/modules/angular2/test/render/dom/compiler/pipeline_spec.ts index 8348637be1..522a49a77a 100644 --- a/modules/angular2/test/render/dom/compiler/pipeline_spec.ts +++ b/modules/angular2/test/render/dom/compiler/pipeline_spec.ts @@ -213,15 +213,15 @@ class IgnoreCurrentElementStep implements CompileStep { } } -function logEntry(log, parent, current) { +function logEntry(log: string[], parent, current) { var parentId = ''; if (isPresent(parent)) { parentId = DOM.getAttribute(parent.element, 'id') + '<'; } - ListWrapper.push(log, parentId + DOM.getAttribute(current.element, 'id')); + log.push(parentId + DOM.getAttribute(current.element, 'id')); } -function createLoggerStep(log) { +function createLoggerStep(log: string[]) { return new MockStep((parent, current, control) => { logEntry(log, parent, current); }); } diff --git a/modules/angular2/test/render/dom/compiler/selector_spec.ts b/modules/angular2/test/render/dom/compiler/selector_spec.ts index de046b44bd..bbe15d29d2 100644 --- a/modules/angular2/test/render/dom/compiler/selector_spec.ts +++ b/modules/angular2/test/render/dom/compiler/selector_spec.ts @@ -6,16 +6,17 @@ import {List, ListWrapper, MapWrapper} from 'angular2/src/facade/collection'; export function main() { describe('SelectorMatcher', () => { - var matcher, matched, selectableCollector, s1, s2, s3, s4; + var matcher, selectableCollector, s1, s2, s3, s4; + var matched: any[]; - function reset() { matched = ListWrapper.create(); } + function reset() { matched = []; } beforeEach(() => { reset(); s1 = s2 = s3 = s4 = null; selectableCollector = (selector, context) => { - ListWrapper.push(matched, selector); - ListWrapper.push(matched, context); + matched.push(selector); + matched.push(context); }; matcher = new SelectorMatcher(); }); diff --git a/modules/angular2/test/render/dom/dom_testbed.ts b/modules/angular2/test/render/dom/dom_testbed.ts index 272bcfdc32..642e3010eb 100644 --- a/modules/angular2/test/render/dom/dom_testbed.ts +++ b/modules/angular2/test/render/dom/dom_testbed.ts @@ -35,7 +35,7 @@ class LoggingEventDispatcher implements EventDispatcher { constructor(log: List>) { this.log = log; } dispatchEvent(elementIndex: number, eventName: string, locals: Map) { - ListWrapper.push(this.log, [elementIndex, eventName, locals]); + this.log.push([elementIndex, eventName, locals]); return true; } } @@ -93,10 +93,10 @@ export class DomTestbed { createRootViews(protoViews: List): List { var views = []; var lastView = this.createRootView(protoViews[0]); - ListWrapper.push(views, lastView); + views.push(lastView); for (var i = 1; i < protoViews.length; i++) { lastView = this.createComponentView(lastView.viewRef, 0, protoViews[i]); - ListWrapper.push(views, lastView); + views.push(lastView); } return views; } diff --git a/modules/angular2/test/render/dom/shadow_dom/light_dom_spec.ts b/modules/angular2/test/render/dom/shadow_dom/light_dom_spec.ts index 4fc3fb92cf..b9a80c1ffc 100644 --- a/modules/angular2/test/render/dom/shadow_dom/light_dom_spec.ts +++ b/modules/angular2/test/render/dom/shadow_dom/light_dom_spec.ts @@ -31,7 +31,7 @@ class FakeProtoView extends SpyObject { @proxy @IMPLEMENTS(DomView) class FakeView extends SpyObject { - boundElements; + boundElements: any[]; proto; constructor(containers = null, transitiveContentTagCount: number = 1) { @@ -53,7 +53,7 @@ class FakeView extends SpyObject { } var boundElement = new DomElement(null, element, contentTag); boundElement.viewContainer = vc; - ListWrapper.push(this.boundElements, boundElement); + this.boundElements.push(boundElement); }); } } diff --git a/modules/angular2/test/render/dom/view/view_spec.ts b/modules/angular2/test/render/dom/view/view_spec.ts index 63397a4a21..c953024644 100644 --- a/modules/angular2/test/render/dom/view/view_spec.ts +++ b/modules/angular2/test/render/dom/view/view_spec.ts @@ -16,7 +16,6 @@ import { proxy } from 'angular2/test_lib'; import {isBlank} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; import {DomProtoView} from 'angular2/src/render/dom/view/proto_view'; import {ElementBinder} from 'angular2/src/render/dom/view/element_binder'; @@ -42,8 +41,7 @@ export function main() { var root = el('
'); var boundElements = []; for (var i = 0; i < boundElementCount; i++) { - ListWrapper.push(boundElements, - new DomElement(pv.elementBinders[i], el(' { throw "Not implemented"; } - confirm(message: string, okMessage: string, cancelMessage: string): Promise { + confirm(message: string, okMessage: string, cancelMessage: string): Promise { throw "Not implemented"; } } @@ -176,7 +176,7 @@ export class MdDialogRef { /** Gets a promise that is resolved when the dialog is closed. */ - get whenClosed(): Promise { + get whenClosed(): Promise { return this.whenClosedDeferred.promise; } diff --git a/modules/angular2_material/src/components/grid_list/grid_list.ts b/modules/angular2_material/src/components/grid_list/grid_list.ts index 70fa4be5d2..c13fae1844 100644 --- a/modules/angular2_material/src/components/grid_list/grid_list.ts +++ b/modules/angular2_material/src/components/grid_list/grid_list.ts @@ -51,7 +51,7 @@ export class MdGridList { } set cols(value) { - this._cols = isString(value) ? NumberWrapper.parseInt(value, 10) : value; + this._cols = isString(value) ? NumberWrapper.parseInt(value, 10) : value; } get cols() { @@ -105,7 +105,7 @@ export class MdGridList { * @param tile */ addTile(tile: MdGridTile) { - ListWrapper.push(this.tiles, tile); + this.tiles.push(tile); } /** @@ -253,7 +253,7 @@ export class MdGridTile { } set rowspan(value) { - this._rowspan = isString(value) ? NumberWrapper.parseInt(value, 10) : value; + this._rowspan = isString(value) ? NumberWrapper.parseInt(value, 10) : value; } get rowspan() { @@ -261,7 +261,7 @@ export class MdGridTile { } set colspan(value) { - this._colspan = isString(value) ? NumberWrapper.parseInt(value, 10) : value; + this._colspan = isString(value) ? NumberWrapper.parseInt(value, 10) : value; } get colspan() { diff --git a/modules/angular2_material/src/components/radio/radio_button.ts b/modules/angular2_material/src/components/radio/radio_button.ts index 557c0fd693..cc7646269d 100644 --- a/modules/angular2_material/src/components/radio/radio_button.ts +++ b/modules/angular2_material/src/components/radio/radio_button.ts @@ -119,7 +119,7 @@ export class MdRadioGroup { /** Registers a child radio button with this group. */ register(radio: MdRadioButton) { - ListWrapper.push(this.radios_, radio); + this.radios_.push(radio); } /** Handles up and down arrow key presses to change the selected child radio. */ diff --git a/modules/angular2_material/src/components/radio/radio_dispatcher.ts b/modules/angular2_material/src/components/radio/radio_dispatcher.ts index 5b766d9e0a..a4b1bf8f8b 100644 --- a/modules/angular2_material/src/components/radio/radio_dispatcher.ts +++ b/modules/angular2_material/src/components/radio/radio_dispatcher.ts @@ -19,6 +19,6 @@ export class MdRadioDispatcher { /** Listen for future changes to radio button selection. */ listen(listener) { - ListWrapper.push(this.listeners_, listener); + this.listeners_.push(listener); } } diff --git a/modules/benchmarks/src/compiler/selector_benchmark.ts b/modules/benchmarks/src/compiler/selector_benchmark.ts index c8ddea8087..eb2ee08154 100644 --- a/modules/benchmarks/src/compiler/selector_benchmark.ts +++ b/modules/benchmarks/src/compiler/selector_benchmark.ts @@ -1,7 +1,6 @@ import {SelectorMatcher} from "angular2/src/render/dom/compiler/selector"; import {CssSelector} from "angular2/src/render/dom/compiler/selector"; import {StringWrapper, Math} from 'angular2/src/facade/lang'; -import {ListWrapper} from 'angular2/src/facade/collection'; import {getIntParameter, bindAction} from 'angular2/src/test_lib/benchmark_util'; import {BrowserDomAdapter} from 'angular2/src/dom/browser_adapter'; @@ -13,10 +12,10 @@ export function main() { var fixedSelectorStrings = []; var fixedSelectors = []; for (var i = 0; i < count; i++) { - ListWrapper.push(fixedSelectorStrings, randomSelector()); + fixedSelectorStrings.push(randomSelector()); } for (var i = 0; i < count; i++) { - ListWrapper.push(fixedSelectors, CssSelector.parse(fixedSelectorStrings[i])); + fixedSelectors.push(CssSelector.parse(fixedSelectorStrings[i])); } fixedMatcher = new SelectorMatcher(); for (var i = 0; i < count; i++) { @@ -26,7 +25,7 @@ export function main() { function parse() { var result = []; for (var i = 0; i < count; i++) { - ListWrapper.push(result, CssSelector.parse(fixedSelectorStrings[i])); + result.push(CssSelector.parse(fixedSelectorStrings[i])); } return result; } diff --git a/modules/benchmarks/src/naive_infinite_scroll/app.ts b/modules/benchmarks/src/naive_infinite_scroll/app.ts index 04274052f3..b8a5802f5e 100644 --- a/modules/benchmarks/src/naive_infinite_scroll/app.ts +++ b/modules/benchmarks/src/naive_infinite_scroll/app.ts @@ -36,7 +36,7 @@ export class App { appSize = appSize > 1 ? appSize - 1 : 0; // draw at least one table this.scrollAreas = []; for (var i = 0; i < appSize; i++) { - ListWrapper.push(this.scrollAreas, i); + this.scrollAreas.push(i); } bindAction('#run-btn', () => { this.runBenchmark(); }); bindAction('#reset-btn', () => { diff --git a/modules/benchmarks/src/naive_infinite_scroll/random_data.ts b/modules/benchmarks/src/naive_infinite_scroll/random_data.ts index 32e4b8e7e5..80c859b7e0 100644 --- a/modules/benchmarks/src/naive_infinite_scroll/random_data.ts +++ b/modules/benchmarks/src/naive_infinite_scroll/random_data.ts @@ -13,7 +13,7 @@ import { export function generateOfferings(count: int): List { var res = []; for (var i = 0; i < count; i++) { - ListWrapper.push(res, generateOffering(i)); + res.push(generateOffering(i)); } return res; } diff --git a/modules/benchpress/src/metric/perflog_metric.ts b/modules/benchpress/src/metric/perflog_metric.ts index 59cacf7379..038e4a9590 100644 --- a/modules/benchpress/src/metric/perflog_metric.ts +++ b/modules/benchpress/src/metric/perflog_metric.ts @@ -156,10 +156,10 @@ export class PerflogMetric extends Metric { startEvent['ph'] = 'B'; endEvent['ph'] = 'E'; endEvent['ts'] = startEvent['ts'] + startEvent['dur']; - ListWrapper.push(this._remainingEvents, startEvent); - ListWrapper.push(this._remainingEvents, endEvent); + this._remainingEvents.push(startEvent); + this._remainingEvents.push(endEvent); } else { - ListWrapper.push(this._remainingEvents, event); + this._remainingEvents.push(event); } }); if (needSort) { @@ -239,10 +239,10 @@ export class PerflogMetric extends Metric { if (StringWrapper.equals(ph, 'I') || StringWrapper.equals(ph, 'i')) { if (isPresent(frameCaptureStartEvent) && isBlank(frameCaptureEndEvent) && StringWrapper.equals(name, 'frame')) { - ListWrapper.push(frameTimestamps, event['ts']); + frameTimestamps.push(event['ts']); if (frameTimestamps.length >= 2) { - ListWrapper.push(frameTimes, frameTimestamps[frameTimestamps.length - 1] - - frameTimestamps[frameTimestamps.length - 2]); + frameTimes.push(frameTimestamps[frameTimestamps.length - 1] - + frameTimestamps[frameTimestamps.length - 2]); } } } diff --git a/modules/benchpress/src/reporter/console_reporter.ts b/modules/benchpress/src/reporter/console_reporter.ts index 323bd7eb3d..4e85589927 100644 --- a/modules/benchpress/src/reporter/console_reporter.ts +++ b/modules/benchpress/src/reporter/console_reporter.ts @@ -33,7 +33,7 @@ export class ConsoleReporter extends Reporter { static _sortedProps(obj) { var props = []; - StringMapWrapper.forEach(obj, (value, prop) => ListWrapper.push(props, prop)); + StringMapWrapper.forEach(obj, (value, prop) => props.push(prop)); props.sort(); return props; } diff --git a/modules/benchpress/src/runner.ts b/modules/benchpress/src/runner.ts index 0a5cb08f07..80f3a2a42a 100644 --- a/modules/benchpress/src/runner.ts +++ b/modules/benchpress/src/runner.ts @@ -41,13 +41,13 @@ export class Runner { bind(Options.EXECUTE).toValue(execute) ]; if (isPresent(prepare)) { - ListWrapper.push(sampleBindings, bind(Options.PREPARE).toValue(prepare)); + sampleBindings.push(bind(Options.PREPARE).toValue(prepare)); } if (isPresent(microMetrics)) { - ListWrapper.push(sampleBindings, bind(Options.MICRO_METRICS).toValue(microMetrics)); + sampleBindings.push(bind(Options.MICRO_METRICS).toValue(microMetrics)); } if (isPresent(bindings)) { - ListWrapper.push(sampleBindings, bindings); + sampleBindings.push(bindings); } return Injector.resolveAndCreate(sampleBindings) .asyncGet(Sampler) diff --git a/modules/benchpress/src/validator/regression_slope_validator.ts b/modules/benchpress/src/validator/regression_slope_validator.ts index 435dad34d9..0b560c4099 100644 --- a/modules/benchpress/src/validator/regression_slope_validator.ts +++ b/modules/benchpress/src/validator/regression_slope_validator.ts @@ -39,8 +39,8 @@ export class RegressionSlopeValidator extends Validator { for (var i = 0; i < latestSample.length; i++) { // For now, we only use the array index as x value. // TODO(tbosch): think about whether we should use time here instead - ListWrapper.push(xValues, i); - ListWrapper.push(yValues, latestSample[i].values[this._metric]); + xValues.push(i); + yValues.push(latestSample[i].values[this._metric]); } var regressionSlope = Statistic.calculateRegressionSlope( xValues, Statistic.calculateMean(xValues), yValues, Statistic.calculateMean(yValues)); diff --git a/modules/benchpress/src/webdriver/chrome_driver_extension.ts b/modules/benchpress/src/webdriver/chrome_driver_extension.ts index 58e7c8ac9f..a10d810382 100644 --- a/modules/benchpress/src/webdriver/chrome_driver_extension.ts +++ b/modules/benchpress/src/webdriver/chrome_driver_extension.ts @@ -53,7 +53,7 @@ export class ChromeDriverExtension extends WebDriverExtension { ListWrapper.forEach(entries, function(entry) { var message = Json.parse(entry['message'])['message']; if (StringWrapper.equals(message['method'], 'Tracing.dataCollected')) { - ListWrapper.push(events, message['params']); + events.push(message['params']); } if (StringWrapper.equals(message['method'], 'Tracing.bufferUsage')) { throw new BaseException('The DevTools trace buffer filled during the test!'); @@ -79,14 +79,14 @@ export class ChromeDriverExtension extends WebDriverExtension { if (StringWrapper.equals(name, 'FunctionCall') && (isBlank(args) || isBlank(args['data']) || !StringWrapper.equals(args['data']['scriptName'], 'InjectedScript'))) { - ListWrapper.push(normalizedEvents, normalizeEvent(event, {'name': 'script'})); + normalizedEvents.push(normalizeEvent(event, {'name': 'script'})); } else if (StringWrapper.equals(name, 'RecalculateStyles') || StringWrapper.equals(name, 'Layout') || StringWrapper.equals(name, 'UpdateLayerTree') || StringWrapper.equals(name, 'Paint') || StringWrapper.equals(name, 'Rasterize') || StringWrapper.equals(name, 'CompositeLayers')) { - ListWrapper.push(normalizedEvents, normalizeEvent(event, {'name': 'render'})); + normalizedEvents.push(normalizeEvent(event, {'name': 'render'})); } else if (StringWrapper.equals(name, 'GCEvent')) { var normArgs = { @@ -97,12 +97,11 @@ export class ChromeDriverExtension extends WebDriverExtension { normArgs['majorGc'] = isPresent(majorGCPids[pid]) && majorGCPids[pid]; } majorGCPids[pid] = false; - ListWrapper.push(normalizedEvents, - normalizeEvent(event, {'name': 'gc', 'args': normArgs})); + normalizedEvents.push(normalizeEvent(event, {'name': 'gc', 'args': normArgs})); } } else if (StringWrapper.equals(cat, 'blink.console')) { - ListWrapper.push(normalizedEvents, normalizeEvent(event, {'name': name})); + normalizedEvents.push(normalizeEvent(event, {'name': name})); } else if (StringWrapper.equals(cat, 'v8')) { if (StringWrapper.equals(name, 'majorGC')) { @@ -118,7 +117,7 @@ export class ChromeDriverExtension extends WebDriverExtension { throw new BaseException('multi-frame render stats not supported'); } if (frameCount == 1) { - ListWrapper.push(normalizedEvents, normalizeEvent(event, {'name': 'frame'})); + normalizedEvents.push(normalizeEvent(event, {'name': 'frame'})); } } else if (StringWrapper.equals(name, 'BenchmarkInstrumentation::DisplayRenderingStats') || StringWrapper.equals(name, 'vsync_before')) { diff --git a/modules/benchpress/src/webdriver/ios_driver_extension.ts b/modules/benchpress/src/webdriver/ios_driver_extension.ts index 380353394c..0bbc216d9b 100644 --- a/modules/benchpress/src/webdriver/ios_driver_extension.ts +++ b/modules/benchpress/src/webdriver/ios_driver_extension.ts @@ -44,14 +44,14 @@ export class IOsDriverExtension extends WebDriverExtension { ListWrapper.forEach(entries, function(entry) { var message = Json.parse(entry['message'])['message']; if (StringWrapper.equals(message['method'], 'Timeline.eventRecorded')) { - ListWrapper.push(records, message['params']['record']); + records.push(message['params']['record']); } }); return this._convertPerfRecordsToEvents(records); }); } - _convertPerfRecordsToEvents(records: any[], events = null) { + _convertPerfRecordsToEvents(records: any[], events: any[] = null) { if (isBlank(events)) { events = []; } @@ -64,18 +64,18 @@ export class IOsDriverExtension extends WebDriverExtension { if (StringWrapper.equals(type, 'FunctionCall') && (isBlank(data) || !StringWrapper.equals(data['scriptName'], 'InjectedScript'))) { - ListWrapper.push(events, createStartEvent('script', startTime)); + events.push(createStartEvent('script', startTime)); endEvent = createEndEvent('script', endTime); } else if (StringWrapper.equals(type, 'Time')) { - ListWrapper.push(events, createMarkStartEvent(data['message'], startTime)); + events.push(createMarkStartEvent(data['message'], startTime)); } else if (StringWrapper.equals(type, 'TimeEnd')) { - ListWrapper.push(events, createMarkEndEvent(data['message'], startTime)); + events.push(createMarkEndEvent(data['message'], startTime)); } else if (StringWrapper.equals(type, 'RecalculateStyles') || StringWrapper.equals(type, 'Layout') || StringWrapper.equals(type, 'UpdateLayerTree') || StringWrapper.equals(type, 'Paint') || StringWrapper.equals(type, 'Rasterize') || StringWrapper.equals(type, 'CompositeLayers')) { - ListWrapper.push(events, createStartEvent('render', startTime)); + events.push(createStartEvent('render', startTime)); endEvent = createEndEvent('render', endTime); } // Note: ios used to support GCEvent up until iOS 6 :-( @@ -83,7 +83,7 @@ export class IOsDriverExtension extends WebDriverExtension { this._convertPerfRecordsToEvents(record['children'], events); } if (isPresent(endEvent)) { - ListWrapper.push(events, endEvent); + events.push(endEvent); } }); return events; diff --git a/modules/benchpress/test/metric/perflog_metric_spec.ts b/modules/benchpress/test/metric/perflog_metric_spec.ts index 54020741b8..814a539c54 100644 --- a/modules/benchpress/test/metric/perflog_metric_spec.ts +++ b/modules/benchpress/test/metric/perflog_metric_spec.ts @@ -28,7 +28,7 @@ import { import {TraceEventFactory} from '../trace_event_factory'; export function main() { - var commandLog; + var commandLog: any[]; var eventFactory = new TraceEventFactory('timeline', 'pid0'); function createMetric(perfLogs, microMetrics = null, perfLogFeatures = null, forceGc = null, @@ -46,17 +46,17 @@ export function main() { bind(Options.MICRO_METRICS).toValue(microMetrics), bind(PerflogMetric.SET_TIMEOUT) .toValue((fn, millis) => { - ListWrapper.push(commandLog, ['setTimeout', millis]); + commandLog.push(['setTimeout', millis]); fn(); }), bind(WebDriverExtension) .toValue(new MockDriverExtension(perfLogs, commandLog, perfLogFeatures)) ]; if (isPresent(forceGc)) { - ListWrapper.push(bindings, bind(Options.FORCE_GC).toValue(forceGc)); + bindings.push(bind(Options.FORCE_GC).toValue(forceGc)); } if (isPresent(captureFrames)) { - ListWrapper.push(bindings, bind(Options.CAPTURE_FRAMES).toValue(captureFrames)); + bindings.push(bind(Options.CAPTURE_FRAMES).toValue(captureFrames)); } return Injector.resolveAndCreate(bindings).get(PerflogMetric); } @@ -65,7 +65,7 @@ export function main() { function sortedKeys(stringMap) { var res = []; - StringMapWrapper.forEach(stringMap, (_, key) => { ListWrapper.push(res, key); }); + StringMapWrapper.forEach(stringMap, (_, key) => { res.push(key); }); res.sort(); return res; } @@ -324,9 +324,9 @@ export function main() { describe('aggregation', () => { - function aggregate(events, microMetrics = null, captureFrames = null) { + function aggregate(events: any[], microMetrics = null, captureFrames = null) { ListWrapper.insert(events, 0, eventFactory.markStart('benchpress0', 0)); - ListWrapper.push(events, eventFactory.markEnd('benchpress0', 10)); + events.push(eventFactory.markEnd('benchpress0', 10)); var metric = createMetric([events], microMetrics, null, null, captureFrames); return metric.beginMeasure().then((_) => metric.endMeasure(false)); } @@ -640,19 +640,19 @@ class MockDriverExtension extends WebDriverExtension { } timeBegin(name): Promise { - ListWrapper.push(this._commandLog, ['timeBegin', name]); + this._commandLog.push(['timeBegin', name]); return PromiseWrapper.resolve(null); } timeEnd(name, restartName): Promise { - ListWrapper.push(this._commandLog, ['timeEnd', name, restartName]); + this._commandLog.push(['timeEnd', name, restartName]); return PromiseWrapper.resolve(null); } perfLogFeatures(): PerfLogFeatures { return this._perfLogFeatures; } readPerfLog(): Promise { - ListWrapper.push(this._commandLog, 'readPerfLog'); + this._commandLog.push('readPerfLog'); if (this._perfLogs.length > 0) { var next = this._perfLogs[0]; ListWrapper.removeAt(this._perfLogs, 0); @@ -663,7 +663,7 @@ class MockDriverExtension extends WebDriverExtension { } gc(): Promise { - ListWrapper.push(this._commandLog, ['gc']); + this._commandLog.push(['gc']); return PromiseWrapper.resolve(null); } } diff --git a/modules/benchpress/test/reporter/console_reporter_spec.ts b/modules/benchpress/test/reporter/console_reporter_spec.ts index e24f9c7c8a..69631052e4 100644 --- a/modules/benchpress/test/reporter/console_reporter_spec.ts +++ b/modules/benchpress/test/reporter/console_reporter_spec.ts @@ -16,7 +16,7 @@ import { export function main() { describe('console reporter', () => { var reporter; - var log; + var log: string[]; function createReporter({columnWidth = null, sampleId = null, descriptions = null, metrics = null}: {columnWidth?, sampleId?, descriptions?, metrics?}) { @@ -30,10 +30,10 @@ export function main() { var bindings = [ ConsoleReporter.BINDINGS, bind(SampleDescription).toValue(new SampleDescription(sampleId, descriptions, metrics)), - bind(ConsoleReporter.PRINT).toValue((line) => ListWrapper.push(log, line)) + bind(ConsoleReporter.PRINT).toValue((line) => log.push(line)) ]; if (isPresent(columnWidth)) { - ListWrapper.push(bindings, bind(ConsoleReporter.COLUMN_WIDTH).toValue(columnWidth)); + bindings.push(bind(ConsoleReporter.COLUMN_WIDTH).toValue(columnWidth)); } reporter = Injector.resolveAndCreate(bindings).get(ConsoleReporter); } diff --git a/modules/benchpress/test/sampler_spec.ts b/modules/benchpress/test/sampler_spec.ts index 44cb6adb65..4720a28a4e 100644 --- a/modules/benchpress/test/sampler_spec.ts +++ b/modules/benchpress/test/sampler_spec.ts @@ -69,7 +69,7 @@ export function main() { bind(Options.NOW).toValue(() => DateWrapper.fromMillis(time++)) ]; if (isPresent(prepare)) { - ListWrapper.push(bindings, bind(Options.PREPARE).toValue(prepare)); + bindings.push(bind(Options.PREPARE).toValue(prepare)); } sampler = Injector.resolveAndCreate(bindings).get(Sampler); @@ -81,7 +81,7 @@ export function main() { var count = 0; var driver = new MockDriverAdapter([], (callback) => { var result = callback(); - ListWrapper.push(log, result); + log.push(result); return PromiseWrapper.resolve(result); }); createSampler({ @@ -105,8 +105,8 @@ export function main() { createSampler({ metric: createCountingMetric(log), validator: createCountingValidator(2), - prepare: () => { ListWrapper.push(log, `p${workCount++}`); }, - execute: () => { ListWrapper.push(log, `w${workCount++}`); } + prepare: () => { log.push(`p${workCount++}`); }, + execute: () => { log.push(`w${workCount++}`); } }); sampler.sample().then((_) => { expect(log).toEqual([ @@ -130,7 +130,7 @@ export function main() { createSampler({ metric: createCountingMetric(log), validator: createCountingValidator(2), - execute: () => { ListWrapper.push(log, `w${workCount++}`); }, + execute: () => { log.push(`w${workCount++}`); }, prepare: null }); sampler.sample().then((_) => { @@ -282,7 +282,7 @@ class MockValidator extends Validator { } validate(completeSample: List): List { var stableSample = isPresent(this._validate) ? this._validate(completeSample) : completeSample; - ListWrapper.push(this._log, ['validate', completeSample, stableSample]); + this._log.push(['validate', completeSample, stableSample]); return stableSample; } } @@ -297,12 +297,12 @@ class MockMetric extends Metric { this._log = log; } beginMeasure() { - ListWrapper.push(this._log, ['beginMeasure']); + this._log.push(['beginMeasure']); return PromiseWrapper.resolve(null); } endMeasure(restart) { var measureValues = isPresent(this._endMeasure) ? this._endMeasure() : {}; - ListWrapper.push(this._log, ['endMeasure', restart, measureValues]); + this._log.push(['endMeasure', restart, measureValues]); return PromiseWrapper.resolve(measureValues); } } @@ -317,11 +317,11 @@ class MockReporter extends Reporter { this._log = log; } reportMeasureValues(values): Promise { - ListWrapper.push(this._log, ['reportMeasureValues', values]); + this._log.push(['reportMeasureValues', values]); return PromiseWrapper.resolve(null); } reportSample(completeSample, validSample): Promise { - ListWrapper.push(this._log, ['reportSample', completeSample, validSample]); + this._log.push(['reportSample', completeSample, validSample]); return PromiseWrapper.resolve(null); } } diff --git a/modules/benchpress/test/webdriver/chrome_driver_extension_spec.ts b/modules/benchpress/test/webdriver/chrome_driver_extension_spec.ts index 0593442993..6ad8419930 100644 --- a/modules/benchpress/test/webdriver/chrome_driver_extension_spec.ts +++ b/modules/benchpress/test/webdriver/chrome_driver_extension_spec.ts @@ -11,7 +11,6 @@ import { xit, } from 'angular2/test_lib'; -import {ListWrapper} from 'angular2/src/facade/collection'; import {PromiseWrapper} from 'angular2/src/facade/async'; import {Json, isBlank} from 'angular2/src/facade/lang'; @@ -307,12 +306,12 @@ class MockDriverAdapter extends WebDriverAdapter { } executeScript(script) { - ListWrapper.push(this._log, ['executeScript', script]); + this._log.push(['executeScript', script]); return PromiseWrapper.resolve(null); } logs(type) { - ListWrapper.push(this._log, ['logs', type]); + this._log.push(['logs', type]); if (type === 'performance') { return PromiseWrapper.resolve(this._events.map((event) => { return { diff --git a/modules/benchpress/test/webdriver/ios_driver_extension_spec.ts b/modules/benchpress/test/webdriver/ios_driver_extension_spec.ts index 40ed3a2d04..555ddff4a6 100644 --- a/modules/benchpress/test/webdriver/ios_driver_extension_spec.ts +++ b/modules/benchpress/test/webdriver/ios_driver_extension_spec.ts @@ -11,7 +11,6 @@ import { xit, } from 'angular2/test_lib'; -import {ListWrapper} from 'angular2/src/facade/collection'; import {PromiseWrapper} from 'angular2/src/facade/async'; import {Json, isBlank, isPresent} from 'angular2/src/facade/lang'; @@ -196,12 +195,12 @@ class MockDriverAdapter extends WebDriverAdapter { constructor(private _log: List, private _perfRecords: List) { super(); } executeScript(script) { - ListWrapper.push(this._log, ['executeScript', script]); + this._log.push(['executeScript', script]); return PromiseWrapper.resolve(null); } logs(type) { - ListWrapper.push(this._log, ['logs', type]); + this._log.push(['logs', type]); if (type === 'performance') { return PromiseWrapper.resolve(this._perfRecords.map(function(record) { return { diff --git a/modules/examples/src/todo/services/TodoStore.ts b/modules/examples/src/todo/services/TodoStore.ts index 8f3f60d9e8..9797549661 100644 --- a/modules/examples/src/todo/services/TodoStore.ts +++ b/modules/examples/src/todo/services/TodoStore.ts @@ -26,7 +26,7 @@ export class TodoFactory { export class Store { list: List = []; - add(record: KeyModel): void { ListWrapper.push(this.list, record); } + add(record: KeyModel): void { this.list.push(record); } remove(record: KeyModel): void { this._spliceOut(record); }