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

@ -50,7 +50,7 @@ module.exports = new Package('angular-v2-docs', [jsdocPackage, nunjucksPackage,
createTypeDefinitionFile.typeDefinitions = [
{
id: 'angular2/angular2',
references: ['../es6-promise/es6-promise.d.ts'],
references: ['../es6-shim/es6-shim.d.ts'],
modules: {
'angular2/angular2': {namespace: 'ng', id: 'angular2/angular2'},
'angular2/web_worker/worker': {namespace: 'ngWorker', id: 'angular2/web_worker/worker'},

View File

@ -1,89 +0,0 @@
// This file is used for TypeScript compilation to ES5 only.
// Since this file is not included in the compilation to ES6, it is an error
// to <reference> this file from other sources.
// Instead it is referenced by the rootFilePaths option to the compiler.
// We also want the following typings to be available only when compiling to
// ES5, because they are redundant with lib.es6.d.ts.
/// <reference path="../typings/es6-promise/es6-promise.d.ts"/>
// Extend the ES5 standard library with some ES6 features we polyfill at runtime
// by loading es6-shim.js
// These are mostly copied from lib.es6.d.ts
interface String {
/**
* Returns true if the sequence of elements of searchString converted to a String is the
* same as the corresponding elements of this object (converted to a String) starting at
* position. Otherwise returns false.
*/
startsWith(searchString: string, position?: number): boolean;
}
interface NumberConstructor {
/**
* Returns true if the value passed is an integer, false otherwise.
* @param number A numeric value.
*/
isInteger(number: number): boolean;
}
interface Array<T> {
/**
* Returns the this object after filling the section identified by start and end with value
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: T, start?: number, end?: number): T[];
}
// Copied from lib.dom.d.ts and modified
interface Map<K, V> {
clear(): void;
delete (key: K): boolean;
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
keys(): Array<K>;
values(): Array<V>;
get(key: K): V;
has(key: K): boolean;
set(key: K, value: V): Map<K, V>;
size: number;
}
declare var Map: {
new (): Map<any, any>;
new<K, V>(): Map<K, V>;
// alexeagle: PATCHED
new<K, V>(m: Map<K, V>): Map<any, any>;
new<K, V>(l: Array<any>): Map<any, any>;
prototype: Map<any, any>;
};
interface Set<T> {
add(value: T): Set<T>;
clear(): void;
delete (value: T): boolean;
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
has(value: T): boolean;
size: number;
}
declare var Set: {
new (): Set<any>;
new<T>(): Set<T>;
// alexeagle PATCHED
new<T>(s: Set<T>): Set<T>;
new<T>(l: Array<T>): Set<T>;
prototype: Set<any>;
};
interface SymbolConstructor {
/**
* A method that returns the default iterator for an object.Called by the semantics of the
* for-of statement.
*/
iterator: symbol;
}
declare var Symbol: SymbolConstructor;

View File

@ -25,7 +25,7 @@ var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))$/g;
@Injectable()
export class RuntimeMetadataResolver {
private _cache: Map<Type, cpl.CompileDirectiveMetadata> = new Map();
private _cache = new Map<Type, cpl.CompileDirectiveMetadata>();
constructor(private _directiveResolver: DirectiveResolver, private _viewResolver: ViewResolver) {}
@ -84,7 +84,7 @@ export class RuntimeMetadataResolver {
function removeDuplicatedDirectives(directives: cpl.CompileDirectiveMetadata[]):
cpl.CompileDirectiveMetadata[] {
var directivesMap: Map<Type, cpl.CompileDirectiveMetadata> = new Map();
var directivesMap = new Map<Type, cpl.CompileDirectiveMetadata>();
directives.forEach((dirMeta) => { directivesMap.set(dirMeta.type.runtime, dirMeta); });
return MapWrapper.values(directivesMap);
}

View File

@ -31,9 +31,9 @@ import {Inject} from 'angular2/src/core/di';
@Injectable()
export class TemplateCompiler {
private _hostCacheKeys: Map<Type, any> = new Map();
private _compiledTemplateCache: Map<Type, CompiledTemplate> = new Map();
private _compiledTemplateDone: Map<Type, Promise<CompiledTemplate>> = new Map();
private _hostCacheKeys = new Map<Type, any>();
private _compiledTemplateCache = new Map<any, CompiledTemplate>();
private _compiledTemplateDone = new Map<any, Promise<CompiledTemplate>>();
private _appId: string;
constructor(private _runtimeMetadataResolver: RuntimeMetadataResolver,

View File

@ -95,7 +95,7 @@ export class TemplateParser {
class TemplateParseVisitor implements HtmlAstVisitor {
selectorMatcher: SelectorMatcher;
errors: string[] = [];
directivesIndex: Map<CompileDirectiveMetadata, number> = new Map();
directivesIndex = new Map<CompileDirectiveMetadata, number>();
constructor(directives: CompileDirectiveMetadata[], private _exprParser: Parser,
private _schemaRegistry: ElementSchemaRegistry) {
this.selectorMatcher = new SelectorMatcher();
@ -407,7 +407,7 @@ class TemplateParseVisitor implements HtmlAstVisitor {
props: BoundElementOrDirectiveProperty[],
possibleExportAsVars: VariableAst[],
sourceInfo: string): DirectiveAst[] {
var matchedVariables: Set<string> = new Set();
var matchedVariables = new Set<string>();
var directiveAsts = directives.map((directive: CompileDirectiveMetadata) => {
var hostProperties: BoundElementPropertyAst[] = [];
var hostEvents: BoundEventAst[] = [];
@ -461,7 +461,7 @@ class TemplateParseVisitor implements HtmlAstVisitor {
boundProps: BoundElementOrDirectiveProperty[],
targetBoundDirectiveProps: BoundDirectivePropertyAst[]) {
if (isPresent(directiveProperties)) {
var boundPropsByName: Map<string, BoundElementOrDirectiveProperty> = new Map();
var boundPropsByName = new Map<string, BoundElementOrDirectiveProperty>();
boundProps.forEach(boundProp => {
var key = dashCaseToCamelCase(boundProp.name);
var prevValue = boundPropsByName.get(boundProp.name);
@ -487,7 +487,7 @@ class TemplateParseVisitor implements HtmlAstVisitor {
private _createElementPropertyAsts(elementName: string, props: BoundElementOrDirectiveProperty[],
directives: DirectiveAst[]): BoundElementPropertyAst[] {
var boundElementProps: BoundElementPropertyAst[] = [];
var boundDirectivePropsIndex: Map<string, BoundDirectivePropertyAst> = new Map();
var boundDirectivePropsIndex = new Map<string, BoundDirectivePropertyAst>();
directives.forEach((directive: DirectiveAst) => {
directive.properties.forEach((prop: BoundDirectivePropertyAst) => {
boundDirectivePropsIndex.set(prop.templateName, prop);
@ -664,4 +664,4 @@ function createElementCssSelector(elementName: string, matchableAttrs: string[][
}
var EMPTY_COMPONENT = new Component(new SelectorMatcher(), null);
var NON_BINDABLE_VISITOR = new NonBindableVisitor();
var NON_BINDABLE_VISITOR = new NonBindableVisitor();

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); }

View File

@ -38,7 +38,7 @@ export class Headers {
_headersMap: Map<string, string[]>;
constructor(headers?: Headers | StringMap<string, any>) {
if (isBlank(headers)) {
this._headersMap = new Map();
this._headersMap = new Map<string, string[]>();
return;
}

View File

@ -7,7 +7,7 @@ import {
} from 'angular2/src/core/facade/collection';
function paramParser(rawParams: string = ''): Map<string, string[]> {
var map: Map<string, string[]> = new Map();
var map = new Map<string, string[]>();
if (rawParams.length > 0) {
var params: string[] = StringWrapper.split(rawParams, new RegExp('&'));
ListWrapper.forEach(params, (param: string) => {

View File

@ -4,8 +4,8 @@ import {DirectiveMetadata, ComponentMetadata} from '../core/metadata';
import {DirectiveResolver} from 'angular2/src/core/compiler/directive_resolver';
export class MockDirectiveResolver extends DirectiveResolver {
private _bindingsOverrides: Map<Type, any[]> = new Map();
private _viewBindingsOverrides: Map<Type, any[]> = new Map();
private _bindingsOverrides = new Map<Type, any[]>();
private _viewBindingsOverrides = new Map<Type, any[]>();
resolve(type: Type): DirectiveMetadata {
var dm = super.resolve(type);

View File

@ -6,10 +6,10 @@ import {ViewMetadata} from '../core/metadata';
import {ViewResolver} from 'angular2/src/core/compiler/view_resolver';
export class MockViewResolver extends ViewResolver {
_views: Map<Type, ViewMetadata> = new Map();
_inlineTemplates: Map<Type, string> = new Map();
_viewCache: Map<Type, ViewMetadata> = new Map();
_directiveOverrides: Map<Type, Map<Type, Type>> = new Map();
_views = new Map<Type, ViewMetadata>();
_inlineTemplates = new Map<Type, string>();
_viewCache = new Map<Type, ViewMetadata>();
_directiveOverrides = new Map<Type, Map<Type, Type>>();
constructor() { super(); }
@ -48,7 +48,7 @@ export class MockViewResolver extends ViewResolver {
var overrides = this._directiveOverrides.get(component);
if (isBlank(overrides)) {
overrides = new Map();
overrides = new Map<Type, Type>();
this._directiveOverrides.set(component, overrides);
}

View File

@ -31,9 +31,9 @@ import {ComponentInstruction} from './instruction';
* components.
*/
export class RouteRecognizer {
names: Map<string, PathRecognizer> = new Map();
names = new Map<string, PathRecognizer>();
auxRoutes: Map<string, PathRecognizer> = new Map();
auxRoutes = new Map<string, PathRecognizer>();
// TODO: optimize this into a trie
matchers: PathRecognizer[] = [];

View File

@ -43,7 +43,7 @@ var _resolveToNull = PromiseWrapper.resolve(null);
*/
@Injectable()
export class RouteRegistry {
private _rules: Map<any, RouteRecognizer> = new Map();
private _rules = new Map<any, RouteRecognizer>();
/**
* Given a component and a configuration object, add the route to this registry

View File

@ -50,7 +50,7 @@ export class Router {
private _currentNavigation: Promise<any> = _resolveToTrue;
private _outlet: RouterOutlet = null;
private _auxRouters: Map<string, Router> = new Map();
private _auxRouters = new Map<string, Router>();
private _childRouter: Router;
private _subject: EventEmitter = new EventEmitter();

View File

@ -52,20 +52,14 @@ var _nextRootElementId = 0;
*/
@Injectable()
export class TestComponentBuilder {
_bindingsOverrides: Map<Type, any[]>;
_directiveOverrides: Map<Type, Map<Type, Type>>;
_templateOverrides: Map<Type, string>;
_viewBindingsOverrides: Map<Type, any[]>;
_viewOverrides: Map<Type, ViewMetadata>;
_bindingsOverrides = new Map<Type, any[]>();
_directiveOverrides = new Map<Type, Map<Type, Type>>();
_templateOverrides = new Map<Type, string>();
_viewBindingsOverrides = new Map<Type, any[]>();
_viewOverrides = new Map<Type, ViewMetadata>();
constructor(private _injector: Injector) {
this._bindingsOverrides = new Map();
this._directiveOverrides = new Map();
this._templateOverrides = new Map();
this._viewBindingsOverrides = new Map();
this._viewOverrides = new Map();
}
constructor(private _injector: Injector) {}
_clone(): TestComponentBuilder {
var clone = new TestComponentBuilder(this._injector);
@ -117,7 +111,7 @@ export class TestComponentBuilder {
var clone = this._clone();
var overridesForComponent = clone._directiveOverrides.get(componentType);
if (!isPresent(overridesForComponent)) {
clone._directiveOverrides.set(componentType, new Map());
clone._directiveOverrides.set(componentType, new Map<Type, Type>());
overridesForComponent = clone._directiveOverrides.get(componentType);
}
overridesForComponent.set(from, to);

View File

@ -179,7 +179,7 @@ export class Serializer {
*/
objectToMap(obj: StringMap<string, any>, type?: Type, data?: any): Map<string, any> {
if (isPresent(type)) {
var map: Map<string, any> = new Map();
var map = new Map<string, any>();
StringMapWrapper.forEach(obj,
(val, key) => { map.set(key, this.deserialize(val, type, data)); });
return map;

View File

@ -329,7 +329,7 @@ export function humanizeTemplate(template: CompiledTemplate,
humanizedTemplates: Map<number, StringMap<string, any>> = null):
StringMap<string, any> {
if (isBlank(humanizedTemplates)) {
humanizedTemplates = new Map();
humanizedTemplates = new Map<number, StringMap<string, any>>();
}
var result = humanizedTemplates.get(template.id);
if (isPresent(result)) {

View File

@ -608,7 +608,7 @@ function createProtoView(elementBinders = null, type: ViewType = null,
type = ViewType.COMPONENT;
}
var pv = new AppProtoView(type, isEmbeddedFragment, new RenderProtoViewRef(), null, null,
new Map(), null, null);
new Map<string, number>(), null, null);
if (isBlank(elementBinders)) {
elementBinders = [];
}
@ -703,7 +703,7 @@ class DirectiveWithAttributes {
}
class FakeViewResolver extends ViewResolver {
_cmpViews: Map<Type, ViewMetadata> = new Map();
_cmpViews = new Map<Type, ViewMetadata>();
constructor() { super(); }

View File

@ -151,11 +151,13 @@ export function main() {
it("should not throw when not binding to a name exported by two directives", () => {
expect(() => {
createDirectiveVariableBindings(new RenderElementBinder({variableBindings: new Map()}), [
directiveBinding({metadata: RenderDirectiveMetadata.create({exportAs: 'exportName'})}),
directiveBinding(
{metadata: RenderDirectiveMetadata.create({exportAs: 'exportName'})})
]);
createDirectiveVariableBindings(
new RenderElementBinder({variableBindings: new Map<string, string>()}), [
directiveBinding(
{metadata: RenderDirectiveMetadata.create({exportAs: 'exportName'})}),
directiveBinding(
{metadata: RenderDirectiveMetadata.create({exportAs: 'exportName'})})
]);
}).not.toThrow();
});
});

View File

@ -29,7 +29,7 @@ export function main() {
}
function createView(pv) {
return new AppView(null, pv, null, null, null, null, new Map(), null, null);
return new AppView(null, pv, null, null, null, null, new Map<string, any>(), null, null);
}
it('should support multiple AppProtoViews', () => {

View File

@ -183,12 +183,9 @@ export function main() {
}
class FakeXHR extends XHR {
_responses: Map<string, string>;
_responses = new Map<string, string>();
constructor() {
super();
this._responses = new Map();
}
constructor() { super(); }
get(url: string): Promise<string> {
var response = this._responses.get(url);

View File

@ -194,7 +194,7 @@ export function main() {
class SomeComponent {}
class FakeXHR extends XHR {
_responses: Map<string, string> = new Map();
_responses = new Map<string, string>();
constructor() { super(); }

View File

@ -95,14 +95,14 @@ export function main() {
}
class FakeEventManagerPlugin extends EventManagerPlugin {
_eventHandler: Map<string, Function> = new Map();
_eventHandler = new Map<string, Function>();
constructor(public _supports: string[]) { super(); }
supports(eventName: string): boolean { return ListWrapper.contains(this._supports, eventName); }
addEventListener(element, eventName: string, handler: Function) {
this._eventHandler.set(eventName, handler);
return () => { MapWrapper.delete(this._eventHandler, eventName) };
return () => { MapWrapper.delete(this._eventHandler, eventName); };
}
}

View File

@ -57,7 +57,7 @@ export function main() {
describe('createRenderView', () => {
var nodeFactory: DomNodeFactory;
var eventDispatcher: SpyRenderEventDispatcher;
var componentTemplates: Map<number, RenderTemplateCmd[]> = new Map();
var componentTemplates = new Map<number, RenderTemplateCmd[]>();
beforeEach(() => {
nodeFactory = new DomNodeFactory(componentTemplates);
eventDispatcher = new SpyRenderEventDispatcher();
@ -523,4 +523,4 @@ function mapAttrs(nodes: Node[], attrName): string[] {
function mapText(nodes: Node[]): string[] {
return nodes.map(node => DOM.getText(node));
}
}

View File

@ -30,11 +30,8 @@ var unused: Response;
class MockBrowserJsonp extends BrowserJsonp {
src: string;
callbacks: Map<string, (data: any) => any>;
constructor() {
super();
this.callbacks = new Map();
}
callbacks = new Map<string, (data: any) => any>();
constructor() { super(); }
addEventListener(type: string, cb: (data: any) => any) { this.callbacks.set(type, cb); }

View File

@ -38,7 +38,7 @@ class MockBrowserXHR extends BrowserXhr {
response: any;
responseText: string;
setRequestHeader: any;
callbacks: Map<string, Function>;
callbacks = new Map<string, Function>();
status: number;
constructor() {
super();
@ -47,7 +47,6 @@ class MockBrowserXHR extends BrowserXhr {
this.send = sendSpy = spy.spy('send');
this.open = openSpy = spy.spy('open');
this.setRequestHeader = setRequestHeaderSpy = spy.spy('setRequestHeader');
this.callbacks = new Map();
}
setStatusCode(status) { this.status = status; }

View File

@ -5,19 +5,18 @@
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"es6-promise/es6-promise.d.ts": {
"commit": "be0b6b394f77a59e192ad7cfec18078706e44db5"
"es6-shim/es6-shim.d.ts": {
"commit": "4b36b94d5910aa8a4d20bdcd5bd1f9ae6ad18d3c"
},
"hammerjs/hammerjs.d.ts": {
"commit": "22c44d95912a07f81c103a694330b15b92f7cb40"
},
"jasmine/jasmine.d.ts": {
"commit": "055b3172e8eb374a75826710c4d08677872620d3"
"commit": "4b36b94d5910aa8a4d20bdcd5bd1f9ae6ad18d3c"
},
"node/node.d.ts": {
"commit": "51738fdf1643d269067861b405e87503b7479236"
},
"selenium-webdriver/selenium-webdriver.d.ts": {
"commit": "be0b6b394f77a59e192ad7cfec18078706e44db5"
},

View File

@ -10026,7 +10026,7 @@
}
},
"ts2dart": {
"version": "0.7.9",
"version": "0.7.10",
"dependencies": {
"source-map": {
"version": "0.4.4",

6
npm-shrinkwrap.json generated
View File

@ -15496,9 +15496,9 @@
}
},
"ts2dart": {
"version": "0.7.9",
"from": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.9.tgz",
"resolved": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.9.tgz",
"version": "0.7.10",
"from": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.10.tgz",
"resolved": "https://registry.npmjs.org/ts2dart/-/ts2dart-0.7.10.tgz",
"dependencies": {
"source-map": {
"version": "0.4.4",

View File

@ -128,7 +128,7 @@
"temp": "^0.8.1",
"ternary-stream": "^1.2.3",
"through2": "^0.6.1",
"ts2dart": "^0.7.9",
"ts2dart": "^0.7.10",
"tsd": "^0.6.5-beta",
"tslint": "^2.5.0",
"typescript": "^1.6.2",

View File

@ -19,11 +19,7 @@ class TSToDartTranspiler implements DiffingBroccoliPlugin {
}
rebuild(treeDiff: DiffResult) {
// Matches rootFilePaths in node_tree.ts
// These files are not compatible with Typescript's ES6 library
// so they must be explicitly included when targetting ES5, as ts2dart does.
// see https://github.com/angular/angular/issues/3770
let toEmit = [path.resolve(this.inputPath, 'angular2/manual_typings/traceur-runtime.d.ts')];
let toEmit = [];
let getDartFilePath = (path: string) => path.replace(/((\.js)|(\.ts))$/i, '.dart');
treeDiff.addedPaths.concat(treeDiff.changedPaths)
.forEach((changedPath) => {

View File

@ -78,8 +78,7 @@ module.exports = function makeBrowserTree(options, destinationPath) {
'benchmarks/e2e_test/**',
'angular1_router/**',
// Exclude ES6 polyfill typings when tsc target=ES6
'angular2/manual_typings/traceur-runtime.d.ts',
'angular2/typings/es6-promise/**'
'angular2/typings/es6-*/**',
],
destDir: '/'
});

View File

@ -40,8 +40,7 @@ module.exports = function makeNodeTree(destinationPath) {
moduleResolution: 1 /* classic */,
noEmitOnError: true,
rootDir: '.',
rootFilePaths:
['angular2/manual_typings/traceur-runtime.d.ts', 'angular2/manual_typings/globals.d.ts'],
rootFilePaths: ['angular2/manual_typings/globals.d.ts'],
sourceMap: true,
sourceRoot: '.',
target: 'ES5'