fix(compiler): fix inheritance for AOT with summaries (#15583)
Allows to inherit ctor args, lifecycle hooks and statics from a class in another compilation unit. Will error if trying to inherit from a class in another compilation unit that has an `@Component` / `@Directive` / `@Pipe` / `@NgModule`.
This commit is contained in:

committed by
Alex Rickabaugh

parent
28bf222a6a
commit
8ef621ad2a
@ -74,6 +74,7 @@ export class DummyResourceLoader extends ResourceLoader {
|
||||
export class TypeScriptServiceHost implements LanguageServiceHost {
|
||||
private _resolver: CompileMetadataResolver;
|
||||
private _staticSymbolCache = new StaticSymbolCache();
|
||||
private _summaryResolver: AotSummaryResolver;
|
||||
private _staticSymbolResolver: StaticSymbolResolver;
|
||||
private _reflector: StaticReflector;
|
||||
private _reflectorHost: ReflectorHost;
|
||||
@ -407,7 +408,7 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
|
||||
private get staticSymbolResolver(): StaticSymbolResolver {
|
||||
let result = this._staticSymbolResolver;
|
||||
if (!result) {
|
||||
const summaryResolver = new AotSummaryResolver(
|
||||
this._summaryResolver = new AotSummaryResolver(
|
||||
{
|
||||
loadSummary(filePath: string) { return null; },
|
||||
isSourceFile(sourceFilePath: string) { return true; },
|
||||
@ -415,7 +416,7 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
|
||||
},
|
||||
this._staticSymbolCache);
|
||||
result = this._staticSymbolResolver = new StaticSymbolResolver(
|
||||
this.reflectorHost, this._staticSymbolCache, summaryResolver,
|
||||
this.reflectorHost, this._staticSymbolCache, this._summaryResolver,
|
||||
(e, filePath) => this.collectError(e, filePath));
|
||||
}
|
||||
return result;
|
||||
@ -424,8 +425,9 @@ export class TypeScriptServiceHost implements LanguageServiceHost {
|
||||
private get reflector(): StaticReflector {
|
||||
let result = this._reflector;
|
||||
if (!result) {
|
||||
const ssr = this.staticSymbolResolver;
|
||||
result = this._reflector = new StaticReflector(
|
||||
this.staticSymbolResolver, [], [], (e, filePath) => this.collectError(e, filePath));
|
||||
this._summaryResolver, ssr, [], [], (e, filePath) => this.collectError(e, filePath));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user