chore(typings): remove traceur-runtime.d.ts

fixes #4297

Closes #4415
This commit is contained in:
Alex Eagle
2015-09-29 11:11:06 -07:00
committed by Alex Eagle
parent fb9796130d
commit 9b7378d132
59 changed files with 142 additions and 256 deletions

View File

@ -42,7 +42,7 @@ export class CodegenNameUtil {
* See [sanitizeName] for details.
*/
_sanitizedNames: string[];
_sanitizedEventNames: Map<EventBinding, string[]>;
_sanitizedEventNames = new Map<EventBinding, string[]>();
constructor(private _records: ProtoRecord[], private _eventBindings: EventBinding[],
private _directiveRecords: any[], private _utilName: string) {
@ -52,7 +52,6 @@ export class CodegenNameUtil {
this._sanitizedNames[i + 1] = sanitizeName(`${this._records[i].name}${i}`);
}
this._sanitizedEventNames = new Map();
for (var ebIndex = 0; ebIndex < _eventBindings.length; ++ebIndex) {
var eb = _eventBindings[ebIndex];
var names = [_CONTEXT_ACCESSOR];

View File

@ -568,7 +568,7 @@ class _DuplicateItemRecordList {
}
class _DuplicateMap {
map: Map<any, _DuplicateItemRecordList> = new Map();
map = new Map<any, _DuplicateItemRecordList>();
put(record: CollectionChangeRecord) {
// todo(vicb) handle corner cases

View File

@ -45,8 +45,8 @@ import {
*/
@Injectable()
export class CompilerCache {
_cache: Map<Type, AppProtoView> = new Map();
_hostCache: Map<Type, AppProtoView> = new Map();
_cache = new Map<Type, AppProtoView>();
_hostCache = new Map<Type, AppProtoView>();
set(component: Type, protoView: AppProtoView): void { this._cache.set(component, protoView); }
@ -99,7 +99,7 @@ export class CompilerCache {
*/
@Injectable()
export class Compiler {
private _compiling: Map<Type, Promise<AppProtoView>> = new Map();
private _compiling = new Map<Type, Promise<AppProtoView>>();
private _appUrl: string;
private _defaultPipes: Type[];
@ -151,17 +151,17 @@ export class Compiler {
Compiler._assertTypeIsComponent(componentBinding);
var directiveMetadata = componentBinding.metadata;
hostPvPromise =
this._render.compileHost(directiveMetadata)
.then((hostRenderPv) => {
var protoViews = this._protoViewFactory.createAppProtoViews(
componentBinding, hostRenderPv, [componentBinding], []);
return this._compileNestedProtoViews(protoViews, componentType, new Map());
})
.then((appProtoView) => {
this._compilerCache.setHost(componentType, appProtoView);
return appProtoView;
});
hostPvPromise = this._render.compileHost(directiveMetadata)
.then((hostRenderPv) => {
var protoViews = this._protoViewFactory.createAppProtoViews(
componentBinding, hostRenderPv, [componentBinding], []);
return this._compileNestedProtoViews(protoViews, componentType,
new Map<Type, AppProtoView>());
})
.then((appProtoView) => {
this._compilerCache.setHost(componentType, appProtoView);
return appProtoView;
});
}
return hostPvPromise.then((hostAppProtoView) => {
wtfEndTimeRange(r);
@ -221,7 +221,7 @@ export class Compiler {
}
private _removeDuplicatedDirectives(directives: DirectiveBinding[]): DirectiveBinding[] {
var directivesMap: Map<number, DirectiveBinding> = new Map();
var directivesMap = new Map<number, DirectiveBinding>();
directives.forEach((dirBinding) => { directivesMap.set(dirBinding.key.id, dirBinding); });
return MapWrapper.values(directivesMap);
}

View File

@ -24,12 +24,9 @@ export class ComponentUrlMapper {
}
export class RuntimeComponentUrlMapper extends ComponentUrlMapper {
_componentUrls: Map<Type, string>;
_componentUrls = new Map<Type, string>();
constructor() {
super();
this._componentUrls = new Map();
}
constructor() { super(); }
setComponentUrl(component: Type, url: string) { this._componentUrls.set(component, url); }

View File

@ -33,7 +33,7 @@ import {ElementBinder} from './element_binder';
import {ProtoElementInjector, DirectiveBinding} from './element_injector';
export class BindingRecordsCreator {
_directiveRecordsMap: Map<number, DirectiveRecord> = new Map();
_directiveRecordsMap = new Map<number, DirectiveRecord>();
getEventBindingRecords(elementBinders: RenderElementBinder[],
allDirectiveMetadatas: RenderDirectiveMetadata[]): BindingRecord[] {
@ -353,7 +353,7 @@ function _collectNestedProtoViewsVariableBindings(nestedPvsWithIndex: RenderProt
}
function _createVariableBindings(renderProtoView): Map<string, string> {
var variableBindings = new Map();
var variableBindings = new Map<string, string>();
MapWrapper.forEach(renderProtoView.variableBindings,
(mappedName, varName) => { variableBindings.set(varName, mappedName); });
return variableBindings;
@ -384,7 +384,7 @@ function _createVariableNames(parentVariableNames: string[], renderProtoView): s
export function createVariableLocations(elementBinders: RenderElementBinder[]):
Map<string, number> {
var variableLocations = new Map();
var variableLocations = new Map<string, number>();
for (var i = 0; i < elementBinders.length; i++) {
var binder = elementBinders[i];
MapWrapper.forEach(binder.variableBindings,
@ -478,7 +478,7 @@ function _createElementBinder(protoView: AppProtoView, boundElementIndex, render
export function createDirectiveVariableBindings(renderElementBinder: RenderElementBinder,
directiveBindings: DirectiveBinding[]):
Map<string, number> {
var directiveVariableBindings = new Map();
var directiveVariableBindings = new Map<string, number>();
MapWrapper.forEach(renderElementBinder.variableBindings, (templateName, exportAs) => {
var dirIndex = _findDirectiveIndexByExportAs(renderElementBinder, directiveBindings, exportAs);
directiveVariableBindings.set(templateName, dirIndex);

View File

@ -167,7 +167,7 @@ export class AppView implements ChangeDispatcher, RenderEventDispatcher {
* @param {number} boundElementIndex
*/
triggerEventHandlers(eventName: string, eventObj: Event, boundElementIndex: number): void {
var locals = new Map();
var locals = new Map<string, any>();
locals.set('$event', eventObj);
this.dispatchEvent(boundElementIndex, eventName, locals);
}
@ -332,7 +332,7 @@ class EventEvaluationError extends WrappedException {
*/
export class AppProtoView {
elementBinders: ElementBinder[] = [];
protoLocals: Map<string, any> = new Map();
protoLocals = new Map<string, any>();
mergeMapping: AppProtoViewMergeMapping;
ref: ProtoViewRef;

View File

@ -10,7 +10,7 @@ export const APP_VIEW_POOL_CAPACITY = CONST_EXPR(new OpaqueToken('AppViewPool.vi
@Injectable()
export class AppViewPool {
_poolCapacityPerProtoView: number;
_pooledViewsPerProtoView: Map<viewModule.AppProtoView, Array<viewModule.AppView>> = new Map();
_pooledViewsPerProtoView = new Map<viewModule.AppProtoView, Array<viewModule.AppView>>();
constructor(@Inject(APP_VIEW_POOL_CAPACITY) poolCapacityPerProtoView) {
this._poolCapacityPerProtoView = poolCapacityPerProtoView;

View File

@ -10,7 +10,7 @@ import {reflector} from 'angular2/src/core/reflection/reflection';
@Injectable()
export class ViewResolver {
_cache: Map<Type, ViewMetadata> = new Map();
_cache = new Map<Type, ViewMetadata>();
resolve(component: Type): ViewMetadata {
var view = this._cache.get(component);

View File

@ -470,7 +470,8 @@ export function resolveBinding(binding: Binding): ResolvedBinding {
* Resolve a list of Bindings.
*/
export function resolveBindings(bindings: Array<Type | Binding | any[]>): ResolvedBinding[] {
var normalized = _createListOfBindings(_normalizeBindings(bindings, new Map()));
var normalized = _createListOfBindings(
_normalizeBindings(bindings, new Map<number, _NormalizedBinding | _NormalizedBinding[]>()));
return normalized.map(b => {
if (b instanceof _NormalizedBinding) {
return new ResolvedBinding(b.key, [b.resolvedFactory], false);

View File

@ -49,7 +49,7 @@ export class Key {
* @private
*/
export class KeyRegistry {
private _allKeys: Map<Object, Key> = new Map();
private _allKeys = new Map<Object, Key>();
get(token: Object): Key {
if (token instanceof Key) return token;

View File

@ -43,7 +43,7 @@ export class SwitchView {
export class NgSwitch {
private _switchValue: any;
private _useDefault: boolean = false;
private _valueViews: Map<any, SwitchView[]> = new Map();
private _valueViews = new Map<any, SwitchView[]>();
private _activeViews: SwitchView[] = [];
set ngSwitch(value) {

View File

@ -216,7 +216,7 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
getStyle(element, stylename: string): string { return element.style[stylename]; }
tagName(element): string { return element.tagName; }
attributeMap(element): Map<string, string> {
var res = new Map();
var res = new Map<string, string>();
var elAttrs = element.attributes;
for (var i = 0; i < elAttrs.length; i++) {
var attrib = elAttrs[i];

View File

@ -409,7 +409,7 @@ export class Parse5DomAdapter extends DomAdapter {
}
tagName(element): string { return element.tagName == "style" ? "STYLE" : element.tagName; }
attributeMap(element): Map<string, string> {
var res = new Map();
var res = new Map<string, string>();
var elAttrs = treeAdapter.getAttrList(element);
for (var i = 0; i < elAttrs.length; i++) {
var attrib = elAttrs[i];

View File

@ -15,7 +15,7 @@ export var StringMap = global.Object;
// Map constructor. We work around that by manually adding the items.
var createMapFromPairs: {(pairs: any[]): Map<any, any>} = (function() {
try {
if (new Map([[1, 2]]).size === 1) {
if (new Map(<any>[[1, 2]]).size === 1) {
return function createMapFromPairs(pairs: any[]): Map<any, any> { return new Map(pairs); };
}
} catch (e) {
@ -31,8 +31,8 @@ var createMapFromPairs: {(pairs: any[]): Map<any, any>} = (function() {
})();
var createMapFromMap: {(m: Map<any, any>): Map<any, any>} = (function() {
try {
if (new Map(new Map())) {
return function createMapFromMap(m: Map<any, any>): Map<any, any> { return new Map(m); };
if (new Map(<any>new Map())) {
return function createMapFromMap(m: Map<any, any>): Map<any, any> { return new Map(<any>m); };
}
} catch (e) {
}
@ -80,7 +80,7 @@ var _arrayFromMap: {(m: Map<any, any>, getValues: boolean): any[]} = (function()
export class MapWrapper {
static clone<K, V>(m: Map<K, V>): Map<K, V> { return createMapFromMap(m); }
static createFromStringMap<T>(stringMap: StringMap<string, T>): Map<string, T> {
var result = new Map();
var result = new Map<string, T>();
for (var prop in stringMap) {
result.set(prop, stringMap[prop]);
}

View File

@ -350,6 +350,7 @@ export function setValueOnPath(global: any, path: string, value: any) {
}
// When Symbol.iterator doesn't exist, retrieves the key used in es6-shim
declare var Symbol;
var _symbolIterator = null;
export function getSymbolIterator(): string | symbol {
if (isBlank(_symbolIterator)) {

View File

@ -20,18 +20,14 @@ export class ReflectionInfo {
}
export class Reflector {
_injectableInfo: Map<any, ReflectionInfo>;
_getters: Map<string, GetterFn>;
_setters: Map<string, SetterFn>;
_methods: Map<string, MethodFn>;
_injectableInfo = new Map<any, ReflectionInfo>();
_getters = new Map<string, GetterFn>();
_setters = new Map<string, SetterFn>();
_methods = new Map<string, MethodFn>();
_usedKeys: Set<any>;
reflectionCapabilities: PlatformReflectionCapabilities;
constructor(reflectionCapabilities: PlatformReflectionCapabilities) {
this._injectableInfo = new Map();
this._getters = new Map();
this._setters = new Map();
this._methods = new Map();
this._usedKeys = null;
this.reflectionCapabilities = reflectionCapabilities;
}

View File

@ -238,9 +238,9 @@ export class RenderDirectiveMetadata {
exportAs?: string,
queries?: StringMap<string, any>
}): RenderDirectiveMetadata {
let hostListeners = new Map();
let hostProperties = new Map();
let hostAttributes = new Map();
let hostListeners = new Map<string, string>();
let hostProperties = new Map<string, string>();
let hostAttributes = new Map<string, string>();
if (isPresent(host)) {
MapWrapper.forEach(host, (value: string, key: string) => {

View File

@ -12,7 +12,7 @@ export class CompileStepFactory {
}
export class DefaultStepFactory extends CompileStepFactory {
private _componentUIDsCache: Map<string, string> = new Map();
private _componentUIDsCache = new Map<string, string>();
constructor(private _parser: Parser, private _appId: string) { super(); }
createSteps(view: ViewDefinition): CompileStep[] {

View File

@ -156,12 +156,12 @@ export class SelectorMatcher {
return notMatcher;
}
private _elementMap: Map<string, SelectorContext[]> = new Map();
private _elementPartialMap: Map<string, SelectorMatcher> = new Map();
private _classMap: Map<string, SelectorContext[]> = new Map();
private _classPartialMap: Map<string, SelectorMatcher> = new Map();
private _attrValueMap: Map<string, Map<string, SelectorContext[]>> = new Map();
private _attrValuePartialMap: Map<string, Map<string, SelectorMatcher>> = new Map();
private _elementMap = new Map<string, SelectorContext[]>();
private _elementPartialMap = new Map<string, SelectorMatcher>();
private _classMap = new Map<string, SelectorContext[]>();
private _classPartialMap = new Map<string, SelectorMatcher>();
private _attrValueMap = new Map<string, Map<string, SelectorContext[]>>();
private _attrValuePartialMap = new Map<string, Map<string, SelectorMatcher>>();
private _listContexts: SelectorListContext[] = [];
addSelectables(cssSelectors: CssSelector[], callbackCtxt?: any) {
@ -218,7 +218,7 @@ export class SelectorMatcher {
var terminalMap = matcher._attrValueMap;
var terminalValuesMap = terminalMap.get(attrName);
if (isBlank(terminalValuesMap)) {
terminalValuesMap = new Map();
terminalValuesMap = new Map<string, SelectorContext[]>();
terminalMap.set(attrName, terminalValuesMap);
}
this._addTerminal(terminalValuesMap, attrValue, selectable);
@ -226,7 +226,7 @@ export class SelectorMatcher {
var parttialMap = matcher._attrValuePartialMap;
var partialValuesMap = parttialMap.get(attrName);
if (isBlank(partialValuesMap)) {
partialValuesMap = new Map();
partialValuesMap = new Map<string, SelectorMatcher>();
parttialMap.set(attrName, partialValuesMap);
}
matcher = this._addPartial(partialValuesMap, attrValue);

View File

@ -28,7 +28,7 @@ export class TemplateAndStyles {
*/
@Injectable()
export class ViewLoader {
_cache: Map<string, Promise<string>> = new Map();
_cache = new Map<string, Promise<string>>();
constructor(private _xhr: XHR, private _styleInliner: StyleInliner,
private _styleUrlResolver: StyleUrlResolver) {}

View File

@ -5,7 +5,7 @@ import {DOM} from 'angular2/src/core/dom/dom_adapter';
import {ElementSchemaRegistry} from './element_schema_registry';
export class DomElementSchemaRegistry extends ElementSchemaRegistry {
private _protoElements: Map<string, Element> = new Map();
private _protoElements = new Map<string, Element>();
private _getProtoElement(tagName: string): Element {
var element = this._protoElements.get(tagName);

View File

@ -38,11 +38,11 @@ import {NG_BINDING_CLASS, queryBoundTextNodeIndices, camelCaseToDashCase} from '
import {EVENT_TARGET_SEPARATOR} from "../../event_config";
export class ProtoViewBuilder {
variableBindings: Map<string, string> = new Map();
variableBindings = new Map<string, string>();
elements: ElementBinderBuilder[] = [];
rootTextBindings: Map<Node, ASTWithSource> = new Map();
rootTextBindings = new Map<Node, ASTWithSource>();
ngContentCount: number = 0;
hostAttributes: Map<string, string> = new Map();
hostAttributes = new Map<string, string>();
constructor(public rootElement, public type: ViewType,
public viewEncapsulation: ViewEncapsulation) {}
@ -89,7 +89,7 @@ export class ProtoViewBuilder {
});
ListWrapper.forEach(this.elements, (ebb: ElementBinderBuilder) => {
var directiveTemplatePropertyNames = new Set();
var directiveTemplatePropertyNames = new Set<string>();
var apiDirectiveBinders = ListWrapper.map(ebb.directives, (dbb: DirectiveBuilder) => {
ebb.eventBuilder.merge(dbb.eventBuilder);
ListWrapper.forEach(dbb.templatePropertyNames,
@ -155,12 +155,12 @@ export class ElementBinderBuilder {
distanceToParent: number = 0;
directives: DirectiveBuilder[] = [];
nestedProtoView: ProtoViewBuilder = null;
propertyBindings: Map<string, ASTWithSource> = new Map();
variableBindings: Map<string, string> = new Map();
propertyBindings = new Map<string, ASTWithSource>();
variableBindings = new Map<string, string>();
eventBindings: EventBinding[] = [];
eventBuilder: EventBuilder = new EventBuilder();
textBindings: Map<Node, ASTWithSource> = new Map();
readAttributes: Map<string, string> = new Map();
textBindings = new Map<Node, ASTWithSource>();
readAttributes = new Map<string, string>();
componentId: string = null;
constructor(public index: number, public element, description: string) {}
@ -231,10 +231,10 @@ export class ElementBinderBuilder {
export class DirectiveBuilder {
// mapping from directive property name to AST for that directive
propertyBindings: Map<string, ASTWithSource> = new Map();
propertyBindings = new Map<string, ASTWithSource>();
// property names used in the template
templatePropertyNames: string[] = [];
hostPropertyBindings: Map<string, ASTWithSource> = new Map();
hostPropertyBindings = new Map<string, ASTWithSource>();
eventBindings: EventBinding[] = [];
eventBuilder: EventBuilder = new EventBuilder();

View File

@ -36,7 +36,7 @@ export function mergeProtoViewsRecursively(templateCloner: TemplateCloner,
// modify the DOM
mergeEmbeddedPvsIntoComponentOrRootPv(clonedProtoViews, hostViewAndBinderIndices);
var fragments = [];
var elementsWithNativeShadowRoot: Set<Element> = new Set();
var elementsWithNativeShadowRoot = new Set<Element>();
mergeComponents(clonedProtoViews, hostViewAndBinderIndices, fragments,
elementsWithNativeShadowRoot);
// Note: Need to remark parent elements of bound text nodes
@ -50,7 +50,7 @@ export function mergeProtoViewsRecursively(templateCloner: TemplateCloner,
// read out the new element / text node / ElementBinder order
var mergedBoundElements = queryBoundElements(rootNode, false);
var mergedBoundTextIndices: Map<Node, number> = new Map();
var mergedBoundTextIndices = new Map<Node, number>();
var boundTextNodeMap: Map<Node, any> = indexBoundTextNodes(clonedProtoViews);
var rootTextNodeIndices =
calcRootTextNodeIndices(rootNode, boundTextNodeMap, mergedBoundTextIndices);
@ -69,7 +69,7 @@ export function mergeProtoViewsRecursively(templateCloner: TemplateCloner,
var mergedProtoView =
DomProtoView.create(templateCloner, mainProtoView.original.type, rootElement,
mainProtoView.original.encapsulation, fragmentsRootNodeCount,
rootTextNodeIndices, mergedElementBinders, new Map());
rootTextNodeIndices, mergedElementBinders, new Map<string, string>());
return new RenderProtoViewMergeMapping(new DomProtoViewRef(mergedProtoView),
fragmentsRootNodeCount.length, mappedElementIndices,
mergedBoundElements.length, mappedTextIndices,
@ -116,7 +116,7 @@ function markBoundTextNodeParentsAsBoundElements(mergableProtoViews: ClonedProto
}
function indexBoundTextNodes(mergableProtoViews: ClonedProtoView[]): Map<Node, any> {
var boundTextNodeMap = new Map();
var boundTextNodeMap = new Map<Node, any>();
for (var pvIndex = 0; pvIndex < mergableProtoViews.length; pvIndex++) {
var mergableProtoView = mergableProtoViews[pvIndex];
mergableProtoView.boundTextNodes.forEach(
@ -352,7 +352,7 @@ function calcElementBinders(clonedProtoViews: ClonedProtoView[], mergedBoundElem
function indexElementBindersByElement(mergableProtoViews: ClonedProtoView[]):
Map<Element, DomElementBinder> {
var elementBinderByElement = new Map();
var elementBinderByElement = new Map<Element, DomElementBinder>();
mergableProtoViews.forEach((mergableProtoView) => {
for (var i = 0; i < mergableProtoView.boundElements.length; i++) {
var el = mergableProtoView.boundElements[i];
@ -442,7 +442,7 @@ function calcNestedViewCounts(hostViewAndBinderIndices: number[][]): number[] {
}
function indexArray(arr: any[]): Map<any, number> {
var map = new Map();
var map = new Map<any, number>();
for (var i = 0; i < arr.length; i++) {
map.set(arr[i], i);
}

View File

@ -6,7 +6,7 @@ import {DOCUMENT} from '../dom_tokens';
@Injectable()
export class SharedStylesHost {
_styles: string[] = [];
_stylesSet: Set<string> = new Set();
_stylesSet = new Set<string>();
constructor() {}
@ -29,7 +29,7 @@ export class SharedStylesHost {
@Injectable()
export class DomSharedStylesHost extends SharedStylesHost {
private _hostNodes: Set<Node> = new Set();
private _hostNodes = new Set<Node>();
constructor(@Inject(DOCUMENT) doc: any) {
super();
this._hostNodes.add(doc.head);

View File

@ -69,7 +69,7 @@ export class DomView {
dispatchEvent(elementIndex: number, eventName: string, event: Event): boolean {
var allowDefaultBehavior = true;
if (isPresent(this.eventDispatcher)) {
var evalLocals = new Map();
var evalLocals = new Map<string, any>();
evalLocals.set('$event', event);
// TODO(tbosch): reenable this when we are parsing element properties
// out of action expressions

View File

@ -52,7 +52,7 @@ export class DefaultRenderView<N> extends RenderViewRef {
dispatchRenderEvent(boundElementIndex: number, eventName: string, event: any): boolean {
var allowDefaultBehavior = true;
if (isPresent(this.eventDispatcher)) {
var locals = new Map();
var locals = new Map<string, any>();
locals.set('$event', event);
allowDefaultBehavior =
this.eventDispatcher.dispatchRenderEvent(boundElementIndex, eventName, locals);

View File

@ -6,13 +6,12 @@ import {PromiseCompleter, PromiseWrapper, Promise} from 'angular2/src/core/facad
export class MockXHR extends XHR {
private _expectations: _Expectation[];
private _definitions: Map<string, string>;
private _definitions = new Map<string, string>();
private _requests: _PendingRequest[];
constructor() {
super();
this._expectations = [];
this._definitions = new Map();
this._requests = [];
}

View File

@ -74,7 +74,7 @@ export class Testability {
@Injectable()
export class TestabilityRegistry {
_applications: Map<any, Testability> = new Map();
_applications = new Map<any, Testability>();
constructor() { testabilityGetter.addToWindow(this); }