chore(ts2dart): replace List with Array

Closes #3514
This commit is contained in:
Misko Hevery
2015-08-28 11:29:19 -07:00
committed by Miško Hevery
parent 4415855683
commit e916836261
204 changed files with 815 additions and 947 deletions

View File

@ -132,5 +132,5 @@ export class FnArg {
}
export class UiArguments {
constructor(public method: string, public args?: List<FnArg>) {}
constructor(public method: string, public args?: FnArg[]) {}
}

View File

@ -5,7 +5,7 @@ import {
RenderViewWithFragments
} from "angular2/src/core/render/api";
import {ON_WEB_WORKER} from "angular2/src/web_workers/shared/api";
import {List, MapWrapper, ListWrapper} from "angular2/src/core/facade/collection";
import {MapWrapper, ListWrapper} from "angular2/src/core/facade/collection";
@Injectable()
export class RenderViewWithFragmentsStore {
@ -13,13 +13,13 @@ export class RenderViewWithFragmentsStore {
private _onWebWorker: boolean;
private _lookupByIndex: Map<number, RenderViewRef | RenderFragmentRef>;
private _lookupByView: Map<RenderViewRef | RenderFragmentRef, number>;
private _viewFragments: Map<RenderViewRef, List<RenderFragmentRef>>;
private _viewFragments: Map<RenderViewRef, RenderFragmentRef[]>;
constructor(@Inject(ON_WEB_WORKER) onWebWorker) {
this._onWebWorker = onWebWorker;
this._lookupByIndex = new Map<number, RenderViewRef | RenderFragmentRef>();
this._lookupByView = new Map<RenderViewRef | RenderFragmentRef, number>();
this._viewFragments = new Map<RenderViewRef, List<RenderFragmentRef>>();
this._viewFragments = new Map<RenderViewRef, RenderFragmentRef[]>();
}
allocate(fragmentCount: number): RenderViewWithFragments {

View File

@ -7,7 +7,6 @@ import {
BaseException
} from "angular2/src/core/facade/lang";
import {
List,
ListWrapper,
Map,
StringMap,
@ -119,7 +118,7 @@ export class Serializer {
return null;
}
if (isArray(map)) {
var obj: List<any> = new List<any>();
var obj: any[] = [];
ListWrapper.forEach(map, (val) => { obj.push(this.deserialize(val, type, data)); });
return obj;
}

View File

@ -35,11 +35,10 @@ export class ServiceMessageBroker {
ObservableWrapper.subscribe(source, (message) => this._handleMessage(message));
}
registerMethod(methodName: string, signature: List<Type>, method: Function, returnType?: Type):
void {
registerMethod(methodName: string, signature: Type[], method: Function, returnType?: Type): void {
this._methods.set(methodName, (message: ReceivedMessage) => {
var serializedArgs = message.args;
var deserializedArgs: List<any> = ListWrapper.createFixedSize(signature.length);
var deserializedArgs: any[] = ListWrapper.createFixedSize(signature.length);
for (var i = 0; i < signature.length; i++) {
var serializedArg = serializedArgs[i];
deserializedArgs[i] = this._serializer.deserialize(serializedArg, signature[i]);
@ -70,7 +69,7 @@ export class ServiceMessageBroker {
export class ReceivedMessage {
method: string;
args: List<any>;
args: any[];
id: string;
type: string;

View File

@ -2,7 +2,7 @@
// There should be a way to refactor application so that this file is unnecessary. See #3277
import {Injector, bind, Binding} from "angular2/di";
import {Reflector, reflector} from 'angular2/src/core/reflection/reflection';
import {List, ListWrapper} from 'angular2/src/core/facade/collection';
import {ListWrapper} from 'angular2/src/core/facade/collection';
import {
Parser,
Lexer,
@ -76,7 +76,7 @@ var _rootBindings = [bind(Reflector).toValue(reflector)];
// TODO: This code is nearly identitcal to core/application. There should be a way to only write it
// once
function _injectorBindings(): List<any> {
function _injectorBindings(): any[] {
var bestChangeDetection = new DynamicChangeDetection();
if (PreGeneratedChangeDetection.isSupported()) {
bestChangeDetection = new PreGeneratedChangeDetection();

View File

@ -69,7 +69,7 @@ function addTarget(e: Event, serializedEvent: StringMap<string, any>): StringMap
return serializedEvent;
}
function serializeEvent(e: any, properties: List<string>): StringMap<string, any> {
function serializeEvent(e: any, properties: string[]): StringMap<string, any> {
var serialized = {};
for (var i = 0; i < properties.length; i++) {
var prop = properties[i];

View File

@ -28,7 +28,7 @@ var _postMessage: PostMessageInterface = <any>postMessage;
* See the bootstrap() docs for more details.
*/
export function bootstrapWebWorker(
appComponentType: Type, componentInjectableBindings: List<Type | Binding | List<any>> = null):
appComponentType: Type, componentInjectableBindings: Array<Type | Binding | any[]> = null):
Promise<ApplicationRef> {
var sink = new PostMessageBusSink({
postMessage:

View File

@ -29,7 +29,7 @@ import {DirectiveResolver} from 'angular2/src/core/compiler/directive_resolver';
import {StyleUrlResolver} from 'angular2/src/core/render/dom/compiler/style_url_resolver';
import {PipeResolver} from 'angular2/src/core/compiler/pipe_resolver';
import {ViewResolver} from 'angular2/src/core/compiler/view_resolver';
import {List, ListWrapper} from 'angular2/src/core/facade/collection';
import {ListWrapper} from 'angular2/src/core/facade/collection';
import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/core/facade/async';
import {NgZone} from 'angular2/src/core/zone/ng_zone';
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
@ -77,7 +77,7 @@ class PrintLogger {
}
function _injectorBindings(appComponentType, bus: MessageBus, initData: StringMap<string, any>):
List<Type | Binding | List<any>> {
Array<Type | Binding | any[]> {
var bestChangeDetection = new DynamicChangeDetection();
if (PreGeneratedChangeDetection.isSupported()) {
bestChangeDetection = new PreGeneratedChangeDetection();
@ -141,7 +141,7 @@ function _injectorBindings(appComponentType, bus: MessageBus, initData: StringMa
export function bootstrapWebWorkerCommon(
appComponentType: Type, bus: MessageBus,
componentInjectableBindings: List<Type | Binding | List<any>> = null): Promise<ApplicationRef> {
componentInjectableBindings: Array<Type | Binding | any[]> = null): Promise<ApplicationRef> {
var bootstrapProcess: PromiseCompleter<any> = PromiseWrapper.completer();
var zone = new NgZone({enableLongStackTrace: assertionsEnabled()});
@ -184,7 +184,7 @@ export function bootstrapWebWorkerCommon(
return bootstrapProcess.promise;
}
function _createAppInjector(appComponentType: Type, bindings: List<Type | Binding | List<any>>,
function _createAppInjector(appComponentType: Type, bindings: Array<Type | Binding | any[]>,
zone: NgZone, bus: MessageBus, initData: StringMap<string, any>):
Injector {
if (isBlank(_rootInjector)) _rootInjector = Injector.resolveAndCreate(_rootBindings);

View File

@ -42,7 +42,7 @@ export class WebWorkerCompiler implements RenderCompiler {
* Creats a ProtoViewDto that contains a single nested component with the given componentId.
*/
compileHost(directiveMetadata: RenderDirectiveMetadata): Promise<ProtoViewDto> {
var fnArgs: List<FnArg> = [new FnArg(directiveMetadata, RenderDirectiveMetadata)];
var fnArgs: FnArg[] = [new FnArg(directiveMetadata, RenderDirectiveMetadata)];
var args: UiArguments = new UiArguments("compileHost", fnArgs);
return this._messageBroker.runOnUiThread(args, ProtoViewDto);
}
@ -53,7 +53,7 @@ export class WebWorkerCompiler implements RenderCompiler {
* but only the needed ones based on previous calls.
*/
compile(view: ViewDefinition): Promise<ProtoViewDto> {
var fnArgs: List<FnArg> = [new FnArg(view, ViewDefinition)];
var fnArgs: FnArg[] = [new FnArg(view, ViewDefinition)];
var args: UiArguments = new UiArguments("compile", fnArgs);
return this._messageBroker.runOnUiThread(args, ProtoViewDto);
}
@ -64,12 +64,12 @@ export class WebWorkerCompiler implements RenderCompiler {
* should be merged.
* If the array contains other arrays, they will be merged before processing the parent array.
* The array must contain an entry for every component and embedded ProtoView of the first entry.
* @param protoViewRefs List of ProtoViewRefs or nested
* @param protoViewRefs Array of ProtoViewRefs or nested
* @return the merge result for every input array in depth first order.
*/
mergeProtoViewsRecursively(
protoViewRefs: List<RenderProtoViewRef | List<any>>): Promise<RenderProtoViewMergeMapping> {
var fnArgs: List<FnArg> = [new FnArg(protoViewRefs, RenderProtoViewRef)];
protoViewRefs: Array<RenderProtoViewRef | any[]>): Promise<RenderProtoViewMergeMapping> {
var fnArgs: FnArg[] = [new FnArg(protoViewRefs, RenderProtoViewRef)];
var args: UiArguments = new UiArguments("mergeProtoViewsRecursively", fnArgs);
return this._messageBroker.runOnUiThread(args, RenderProtoViewMergeMapping);
}
@ -114,7 +114,7 @@ export class WebWorkerRenderer implements Renderer {
var renderViewWithFragments = this._renderViewStore.allocate(fragmentCount);
var startIndex = (<WebWorkerRenderViewRef>(renderViewWithFragments.viewRef)).refNumber;
var fnArgs: List<FnArg> = [
var fnArgs: FnArg[] = [
new FnArg(protoViewRef, RenderProtoViewRef),
new FnArg(fragmentCount, null),
];
@ -255,7 +255,7 @@ export class WebWorkerRenderer implements Renderer {
* Calls a method on an element.
* Note: For now we're assuming that everything in the args list are primitive
*/
invokeElementMethod(location: RenderElementRef, methodName: string, args: List<any>) {
invokeElementMethod(location: RenderElementRef, methodName: string, args: any[]) {
var fnArgs = [
new FnArg(location, WebWorkerElementRef),
new FnArg(methodName, null),

View File

@ -23,7 +23,7 @@ export class WebWorkerXHRImpl extends XHR {
}
get(url: string): Promise<string> {
var fnArgs: List<FnArg> = [new FnArg(url, null)];
var fnArgs: FnArg[] = [new FnArg(url, null)];
var args: UiArguments = new UiArguments("get", fnArgs);
return this._messageBroker.runOnUiThread(args, String);
}