X Tutup
Skip to content

Commit e916836

Browse files
committed
chore(ts2dart): replace List with Array
Closes angular#3514
1 parent 4415855 commit e916836

File tree

204 files changed

+815
-947
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

204 files changed

+815
-947
lines changed

docs/typescript-definition-package/templates/angular2/angular2.d.ts.template.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{% extends '../type-definition.template.html' %}
22
{% block staticDeclarations %}
33

4-
interface List<T> extends Array<T> {}
54
interface Map<K,V> {}
65
interface StringMap<K,V> extends Map<K,V> {}
76

modules/angular2/directives.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,5 @@ export * from './src/core/directives/ng_switch';
6060
* ```
6161
*
6262
*/
63-
export const CORE_DIRECTIVES: List<Type> =
63+
export const CORE_DIRECTIVES: Type[] =
6464
CONST_EXPR([NgClass, NgFor, NgIf, NgNonBindable, NgSwitch, NgSwitchWhen, NgSwitchDefault]);

modules/angular2/forms.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ export {FormBuilder} from './src/forms/form_builder';
3939
import {FormBuilder} from './src/forms/form_builder';
4040
import {CONST_EXPR, Type} from './src/core/facade/lang';
4141

42-
export const FORM_BINDINGS: List<Type> = CONST_EXPR([FormBuilder]);
42+
export const FORM_BINDINGS: Type[] = CONST_EXPR([FormBuilder]);

modules/angular2/globals.d.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@
55
/// <reference path="typings/zone/zone.d.ts"/>
66
declare var assert: any;
77

8-
interface List<T> extends Array<T> {}
9-
108
// FIXME: K must be string!
119
// FIXME: should have an index signature, `[k: string]: V;`
12-
interface StringMap<K, V> {}
10+
interface StringMap<K extends string, V> {}
1311

1412
interface BrowserNodeGlobal {
1513
Object: typeof Object;

modules/angular2/http.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ export {EventEmitter, Observable} from './src/core/facade/async';
6262
* ```
6363
*
6464
*/
65-
export const HTTP_BINDINGS: List<any> = [
65+
export const HTTP_BINDINGS: any[] = [
6666
// TODO(pascal): use factory type annotations once supported in DI
6767
// issue: https://github.com/angular/angular/issues/3183
6868
bind(Http)
@@ -74,7 +74,7 @@ export const HTTP_BINDINGS: List<any> = [
7474
XHRBackend
7575
];
7676

77-
export const JSONP_BINDINGS: List<any> = [
77+
export const JSONP_BINDINGS: any[] = [
7878
// TODO(pascal): use factory type annotations once supported in DI
7979
// issue: https://github.com/angular/angular/issues/3183
8080
bind(Jsonp)

modules/angular2/router.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,10 @@ import {Location} from './src/router/location';
3535
import {APP_COMPONENT} from './src/core/application_tokens';
3636
import {Binding} from './di';
3737
import {CONST_EXPR} from './src/core/facade/lang';
38-
import {List} from './src/core/facade/collection';
3938

40-
export const ROUTER_DIRECTIVES: List<any> = CONST_EXPR([RouterOutlet, RouterLink]);
39+
export const ROUTER_DIRECTIVES: any[] = CONST_EXPR([RouterOutlet, RouterLink]);
4140

42-
export const ROUTER_BINDINGS: List<any> = CONST_EXPR([
41+
export const ROUTER_BINDINGS: any[] = CONST_EXPR([
4342
RouteRegistry,
4443
Pipeline,
4544
CONST_EXPR(new Binding(LocationStrategy, {toClass: PathLocationStrategy})),

modules/angular2/src/compiler/html_parser.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {MapWrapper, ListWrapper} from 'angular2/src/core/facade/collection';
21
import {
32
isPresent,
43
StringWrapper,
@@ -56,8 +55,8 @@ function parseAttrs(element: Element, elementSourceInfo: string): HtmlAttrAst[]
5655
// in DOM parsers!
5756
var attrMap = DOM.attributeMap(element);
5857
var attrList: string[][] = [];
59-
MapWrapper.forEach(attrMap, (value, name) => { attrList.push([name, value]); });
60-
ListWrapper.sort(attrList, (entry1, entry2) => StringWrapper.compare(entry1[0], entry2[0]));
58+
attrMap.forEach((value, name) => attrList.push([name, value]));
59+
attrList.sort((entry1, entry2) => StringWrapper.compare(entry1[0], entry2[0]));
6160
return attrList.map(entry => parseAttr(element, elementSourceInfo, entry[0], entry[1]));
6261
}
6362

modules/angular2/src/core/application_common.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ import {StyleInliner} from 'angular2/src/core/render/dom/compiler/style_inliner'
3333
import {ViewResolver} from './compiler/view_resolver';
3434
import {DirectiveResolver} from './compiler/directive_resolver';
3535
import {PipeResolver} from './compiler/pipe_resolver';
36-
import {List, ListWrapper} from 'angular2/src/core/facade/collection';
36+
import {ListWrapper} from 'angular2/src/core/facade/collection';
3737
import {Promise, PromiseWrapper, PromiseCompleter} from 'angular2/src/core/facade/async';
3838
import {NgZone} from 'angular2/src/core/zone/ng_zone';
3939
import {LifeCycle} from 'angular2/src/core/life_cycle/life_cycle';
@@ -84,7 +84,7 @@ var _rootInjector: Injector;
8484
// Contains everything that is safe to share between applications.
8585
var _rootBindings = [bind(Reflector).toValue(reflector), TestabilityRegistry];
8686

87-
function _injectorBindings(appComponentType): List<Type | Binding | List<any>> {
87+
function _injectorBindings(appComponentType): Array<Type | Binding | any[]> {
8888
var bestChangeDetection = new DynamicChangeDetection();
8989
if (PreGeneratedChangeDetection.isSupported()) {
9090
bestChangeDetection = new PreGeneratedChangeDetection();
@@ -290,9 +290,9 @@ export function createNgZone(): NgZone {
290290
*
291291
* Returns a `Promise` of {@link ApplicationRef}.
292292
*/
293-
export function commonBootstrap(
294-
appComponentType: /*Type*/ any,
295-
componentInjectableBindings: List<Type | Binding | List<any>> = null): Promise<ApplicationRef> {
293+
export function commonBootstrap(appComponentType: /*Type*/ any,
294+
componentInjectableBindings: Array<Type | Binding | any[]> = null):
295+
Promise<ApplicationRef> {
296296
BrowserDomAdapter.makeCurrent();
297297
wtfInit();
298298
var bootstrapProcess = PromiseWrapper.completer();
@@ -338,7 +338,7 @@ export function commonBootstrap(
338338
return bootstrapProcess.promise;
339339
}
340340

341-
function _createAppInjector(appComponentType: Type, bindings: List<Type | Binding | List<any>>,
341+
function _createAppInjector(appComponentType: Type, bindings: Array<Type | Binding | any[]>,
342342
zone: NgZone): Injector {
343343
if (isBlank(_rootInjector)) _rootInjector = Injector.resolveAndCreate(_rootBindings);
344344
var mergedBindings: any[] =

modules/angular2/src/core/change_detection/abstract_change_detector.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {isPresent, isBlank, BaseException, StringWrapper} from 'angular2/src/core/facade/lang';
2-
import {List, ListWrapper} from 'angular2/src/core/facade/collection';
2+
import {ListWrapper} from 'angular2/src/core/facade/collection';
33
import {ChangeDetectionUtil} from './change_detection_util';
44
import {ChangeDetectorRef} from './change_detector_ref';
55
import {DirectiveIndex} from './directive_record';
@@ -25,8 +25,8 @@ class _Context {
2525
}
2626

2727
export class AbstractChangeDetector<T> implements ChangeDetector {
28-
lightDomChildren: List<any> = [];
29-
shadowDomChildren: List<any> = [];
28+
lightDomChildren: any[] = [];
29+
shadowDomChildren: any[] = [];
3030
parent: ChangeDetector;
3131
ref: ChangeDetectorRef;
3232

modules/angular2/src/core/change_detection/change_detection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
ChangeDetectorGenConfig
1313
} from './interfaces';
1414
import {Injector, Inject, Injectable, OpaqueToken, Optional, Binding} from 'angular2/di';
15-
import {List, StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection';
15+
import {StringMap, StringMapWrapper} from 'angular2/src/core/facade/collection';
1616
import {
1717
CONST,
1818
CONST_EXPR,

0 commit comments

Comments
 (0)
X Tutup