build(bazel): fix bazel types reference directive resolves (#25581)

PR Close #25581
This commit is contained in:
Greg Magolan
2018-08-20 12:58:33 -07:00
committed by Misko Hevery
parent 20b9c61d4c
commit 910381ddbd
8 changed files with 28 additions and 24 deletions

View File

@ -17,7 +17,16 @@ import {FactoryGenerator} from './generator';
export class GeneratedFactoryHostWrapper implements ts.CompilerHost {
constructor(
private delegate: ts.CompilerHost, private generator: FactoryGenerator,
private factoryToSourceMap: Map<string, string>) {}
private factoryToSourceMap: Map<string, string>) {
if (delegate.resolveTypeReferenceDirectives) {
this.resolveTypeReferenceDirectives = (names: string[], containingFile: string) =>
delegate.resolveTypeReferenceDirectives !(names, containingFile);
}
}
resolveTypeReferenceDirectives?:
(names: string[],
containingFile: string) => (ts.ResolvedTypeReferenceDirective | undefined)[];
getSourceFile(
fileName: string, languageVersion: ts.ScriptTarget,

View File

@ -78,6 +78,9 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos
trace !: (s: string) => void;
// TODO(issue/24571): remove '!'.
getDirectories !: (path: string) => string[];
resolveTypeReferenceDirectives?:
(names: string[],
containingFile: string) => (ts.ResolvedTypeReferenceDirective | undefined)[];
directoryExists?: (directoryName: string) => boolean;
constructor(
@ -102,6 +105,10 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos
if (context.getDefaultLibLocation) {
this.getDefaultLibLocation = () => context.getDefaultLibLocation !();
}
if (context.resolveTypeReferenceDirectives) {
this.resolveTypeReferenceDirectives = (names: string[], containingFile: string) =>
context.resolveTypeReferenceDirectives !(names, containingFile);
}
if (context.trace) {
this.trace = s => context.trace !(s);
}