chore(build): Remove .es6 files which shadow .ts files.

This removes .es6 files which are pure duplicates of a
.ts file in the same folder.
Next we need to remove .js files as well, and remove karma preprocessors for dart.
This commit is contained in:
Alex Eagle
2015-04-27 16:11:20 -07:00
parent c1579222bd
commit 3c77855b39
24 changed files with 45 additions and 870 deletions
@@ -1,7 +0,0 @@
import {Type, isPresent} from 'angular2/src/facade/lang';
import {List, ListWrapper} from 'angular2/src/facade/collection';
import {Reflector} from './reflector';
export {Reflector} from './reflector';
import {ReflectionCapabilities} from './reflection_capabilities';
export var reflector = new Reflector(new ReflectionCapabilities());
@@ -1,96 +0,0 @@
import {Type, isPresent} from 'angular2/src/facade/lang';
import {List, ListWrapper} from 'angular2/src/facade/collection';
import {GetterFn, SetterFn, MethodFn} from './types';
export class ReflectionCapabilities {
factory(type:Type):Function {
switch (type.length) {
case 0:
return function(){return new type();};
case 1:
return function(a1){return new type(a1);};
case 2:
return function(a1, a2){return new type(a1, a2);};
case 3:
return function(a1, a2, a3){return new type(a1, a2, a3);};
case 4:
return function(a1, a2, a3, a4){return new type(a1, a2, a3, a4);};
case 5:
return function(a1, a2, a3, a4, a5){return new type(a1, a2, a3, a4, a5);};
case 6:
return function(a1, a2, a3, a4, a5, a6){return new type(a1, a2, a3, a4, a5, a6);};
case 7:
return function(a1, a2, a3, a4, a5, a6, a7){return new type(a1, a2, a3, a4, a5, a6, a7);};
case 8:
return function(a1, a2, a3, a4, a5, a6, a7, a8){return new type(a1, a2, a3, a4, a5, a6, a7, a8);};
case 9:
return function(a1, a2, a3, a4, a5, a6, a7, a8, a9){return new type(a1, a2, a3, a4, a5, a6, a7, a8, a9);};
case 10:
return function(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10){return new type(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);};
};
throw new Error("Factory cannot take more than 10 arguments");
}
parameters(typeOfFunc):List<List> {
// Prefer the direct API.
if (isPresent(typeOfFunc.parameters)) {
return typeOfFunc.parameters;
}
if (isPresent(window.Reflect) && isPresent(window.Reflect.getMetadata)) {
var paramAnnotations = window.Reflect.getMetadata('parameters', typeOfFunc);
var paramTypes = window.Reflect.getMetadata('design:paramtypes', typeOfFunc);
if (isPresent(paramTypes) || isPresent(paramAnnotations)) {
return this._zipTypesAndAnnotaions(paramTypes, paramAnnotations);
}
}
return ListWrapper.createFixedSize(typeOfFunc.length);
}
_zipTypesAndAnnotaions(paramTypes, paramAnnotations) {
var result = ListWrapper.createFixedSize(paramTypes.length);
for (var i = 0; i < result.length; i++) {
// TS outputs Object for parameters without types, while Traceur omits
// the annotations. For now we preserve the Traceur behavior to aid
// migration, but this can be revisited.
if (paramTypes[i] != Object) {
result[i] = [paramTypes[i]];
} else {
result[i] = [];
}
if (isPresent(paramAnnotations[i])) {
result[i] = result[i].concat(paramAnnotations[i]);
}
}
return result;
}
annotations(typeOfFunc):List {
// Prefer the direct API.
if (isPresent(typeOfFunc.annotations)) {
return typeOfFunc.annotations;
}
if (isPresent(window.Reflect) && isPresent(window.Reflect.getMetadata)) {
var annotations = window.Reflect.getMetadata('annotations', typeOfFunc);
if (isPresent(annotations)) return annotations;
}
return [];
}
getter(name:string):GetterFn {
return new Function('o', 'return o.' + name + ';');
}
setter(name:string):SetterFn {
return new Function('o', 'v', 'return o.' + name + ' = v;');
}
method(name:string):MethodFn {
var method = `o.${name}`;
return new Function('o', 'args',
`if (!${method}) throw new Error('"${name}" is undefined');` +
`return ${method}.apply(o, args);`);
}
}
-88
View File
@@ -1,88 +0,0 @@
import {Type, isPresent, stringify, BaseException} from 'angular2/src/facade/lang';
import {List, ListWrapper, Map, MapWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
import {SetterFn, GetterFn, MethodFn} from './types';
export {SetterFn, GetterFn, MethodFn} from './types';
export class Reflector {
_typeInfo:Map;
_getters:Map;
_setters:Map;
_methods:Map;
reflectionCapabilities:any;
constructor(reflectionCapabilities) {
this._typeInfo = MapWrapper.create();
this._getters = MapWrapper.create();
this._setters = MapWrapper.create();
this._methods = MapWrapper.create();
this.reflectionCapabilities = reflectionCapabilities;
}
registerType(type, typeInfo){
MapWrapper.set(this._typeInfo, type, typeInfo);
}
registerGetters(getters){
_mergeMaps(this._getters, getters);
}
registerSetters(setters){
_mergeMaps(this._setters, setters);
}
registerMethods(methods){
_mergeMaps(this._methods, methods);
}
factory(type:Type):Function {
if(MapWrapper.contains(this._typeInfo, type)) {
return MapWrapper.get(this._typeInfo, type)["factory"];
} else {
return this.reflectionCapabilities.factory(type);
}
}
parameters(typeOfFunc):List {
if(MapWrapper.contains(this._typeInfo, typeOfFunc)) {
return MapWrapper.get(this._typeInfo, typeOfFunc)["parameters"];
} else {
return this.reflectionCapabilities.parameters(typeOfFunc);
}
}
annotations(typeOfFunc):List {
if(MapWrapper.contains(this._typeInfo, typeOfFunc)) {
return MapWrapper.get(this._typeInfo, typeOfFunc)["annotations"];
} else {
return this.reflectionCapabilities.annotations(typeOfFunc);
}
}
getter(name:string):GetterFn {
if(MapWrapper.contains(this._getters, name)) {
return MapWrapper.get(this._getters, name);
} else {
return this.reflectionCapabilities.getter(name);
}
}
setter(name:string):SetterFn {
if(MapWrapper.contains(this._setters, name)) {
return MapWrapper.get(this._setters, name);
} else {
return this.reflectionCapabilities.setter(name);
}
}
method(name:string):MethodFn {
if(MapWrapper.contains(this._methods, name)) {
return MapWrapper.get(this._methods, name);
} else {
return this.reflectionCapabilities.method(name);
}
}
}
function _mergeMaps(target:Map, config) {
StringMapWrapper.forEach(config, (v, k) => MapWrapper.set(target, k, v));
}
@@ -1,3 +0,0 @@
export var SetterFn = Function;
export var GetterFn = Function;
export var MethodFn = Function;