fix(compiler_cli): allow to use builtin directives like NgIf, …

Related to #8448
Closes #8454
This commit is contained in:
Tobias Bosch
2016-05-03 17:31:40 -07:00
parent 0297398f5e
commit edec158dd8
14 changed files with 130 additions and 20 deletions

View File

@ -11,5 +11,5 @@ export interface PlatformReflectionCapabilities {
getter(name: string): GetterFn;
setter(name: string): SetterFn;
method(name: string): MethodFn;
importUri(type: Type): string;
importUri(type: any): string;
}

View File

@ -342,7 +342,12 @@ class ReflectionCapabilities implements PlatformReflectionCapabilities {
return classMirror.metadata;
}
String importUri(Type type) {
String importUri(dynamic type) {
// StaticSymbol
if (type is Map && type['filePath'] != null) {
return type['filePath'];
}
// Runtime type
return '${(reflectClass(type).owner as LibraryMirror).uri}';
}
}

View File

@ -214,7 +214,14 @@ export class ReflectionCapabilities implements PlatformReflectionCapabilities {
}
// There is not a concept of import uri in Js, but this is useful in developing Dart applications.
importUri(type: Type): string { return `./${stringify(type)}`; }
importUri(type: any): string {
// StaticSymbol
if (typeof type === 'object' && type['filePath']) {
return type['filePath'];
}
// Runtime type
return `./${stringify(type)}`;
}
}
function convertTsickleDecoratorIntoMetadata(decoratorInvocations: any[]): any[] {

View File

@ -45,6 +45,10 @@ export class Reflector extends ReflectorReader {
this.reflectionCapabilities = reflectionCapabilities;
}
updateCapabilities(caps: PlatformReflectionCapabilities) {
this.reflectionCapabilities = caps;
}
isReflectionEnabled(): boolean { return this.reflectionCapabilities.isReflectionEnabled(); }
/**
@ -160,7 +164,7 @@ export class Reflector extends ReflectorReader {
/** @internal */
_containsReflectionInfo(typeOrFunc: any) { return this._injectableInfo.has(typeOrFunc); }
importUri(type: Type): string { return this.reflectionCapabilities.importUri(type); }
importUri(type: any): string { return this.reflectionCapabilities.importUri(type); }
}
function _mergeMaps(target: Map<string, Function>, config: {[key: string]: Function}): void {