fix(compiler): properly report unresolved dependencies
Fixes #9332 Closes #9341
This commit is contained in:
@ -164,21 +164,23 @@ export class CompileMetadataResolver {
|
||||
}
|
||||
}
|
||||
|
||||
getTypeMetadata(type: Type, moduleUrl: string): cpl.CompileTypeMetadata {
|
||||
getTypeMetadata(type: Type, moduleUrl: string, dependencies: any[] = null):
|
||||
cpl.CompileTypeMetadata {
|
||||
return new cpl.CompileTypeMetadata({
|
||||
name: this.sanitizeTokenName(type),
|
||||
moduleUrl: moduleUrl,
|
||||
runtime: type,
|
||||
diDeps: this.getDependenciesMetadata(type, null)
|
||||
diDeps: this.getDependenciesMetadata(type, dependencies)
|
||||
});
|
||||
}
|
||||
|
||||
getFactoryMetadata(factory: Function, moduleUrl: string): cpl.CompileFactoryMetadata {
|
||||
getFactoryMetadata(factory: Function, moduleUrl: string, dependencies: any[] = null):
|
||||
cpl.CompileFactoryMetadata {
|
||||
return new cpl.CompileFactoryMetadata({
|
||||
name: this.sanitizeTokenName(factory),
|
||||
moduleUrl: moduleUrl,
|
||||
runtime: factory,
|
||||
diDeps: this.getDependenciesMetadata(factory, null)
|
||||
diDeps: this.getDependenciesMetadata(factory, dependencies)
|
||||
});
|
||||
}
|
||||
|
||||
@ -229,9 +231,6 @@ export class CompileMetadataResolver {
|
||||
params = [];
|
||||
}
|
||||
let dependenciesMetadata: cpl.CompileDiDependencyMetadata[] = params.map((param) => {
|
||||
if (isBlank(param)) {
|
||||
return null;
|
||||
}
|
||||
let isAttribute = false;
|
||||
let isHost = false;
|
||||
let isSelf = false;
|
||||
@ -330,21 +329,25 @@ export class CompileMetadataResolver {
|
||||
}
|
||||
|
||||
getProviderMetadata(provider: Provider): cpl.CompileProviderMetadata {
|
||||
var compileDeps: any /** TODO #9100 */;
|
||||
var compileDeps: cpl.CompileDiDependencyMetadata[];
|
||||
var compileTypeMetadata: cpl.CompileTypeMetadata = null;
|
||||
var compileFactoryMetadata: cpl.CompileFactoryMetadata = null;
|
||||
|
||||
if (isPresent(provider.useClass)) {
|
||||
compileDeps = this.getDependenciesMetadata(provider.useClass, provider.dependencies);
|
||||
compileTypeMetadata = this.getTypeMetadata(
|
||||
provider.useClass, staticTypeModuleUrl(provider.useClass), provider.dependencies);
|
||||
compileDeps = compileTypeMetadata.diDeps;
|
||||
} else if (isPresent(provider.useFactory)) {
|
||||
compileDeps = this.getDependenciesMetadata(provider.useFactory, provider.dependencies);
|
||||
compileFactoryMetadata = this.getFactoryMetadata(
|
||||
provider.useFactory, staticTypeModuleUrl(provider.useFactory), provider.dependencies);
|
||||
compileDeps = compileFactoryMetadata.diDeps;
|
||||
}
|
||||
|
||||
return new cpl.CompileProviderMetadata({
|
||||
token: this.getTokenMetadata(provider.token),
|
||||
useClass: isPresent(provider.useClass) ?
|
||||
this.getTypeMetadata(provider.useClass, staticTypeModuleUrl(provider.useClass)) :
|
||||
null,
|
||||
useClass: compileTypeMetadata,
|
||||
useValue: convertToCompileValue(provider.useValue),
|
||||
useFactory: isPresent(provider.useFactory) ?
|
||||
this.getFactoryMetadata(provider.useFactory, staticTypeModuleUrl(provider.useFactory)) :
|
||||
null,
|
||||
useFactory: compileFactoryMetadata,
|
||||
useExisting: isPresent(provider.useExisting) ? this.getTokenMetadata(provider.useExisting) :
|
||||
null,
|
||||
deps: compileDeps,
|
||||
|
Reference in New Issue
Block a user