Skip to content

Commit bd43e45

Browse files
committed
Move getCurrentDirectory to builder program
1 parent f29c0e3 commit bd43e45

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

src/compiler/builder.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -257,14 +257,14 @@ namespace ts {
257257
getSyntacticDiagnostics: (sourceFile, cancellationToken) => state.program.getSyntacticDiagnostics(sourceFile, cancellationToken),
258258
getSemanticDiagnostics,
259259
emit,
260-
getAllDependencies: sourceFile => BuilderState.getAllDependencies(state, state.program, sourceFile)
260+
getAllDependencies: sourceFile => BuilderState.getAllDependencies(state, state.program, sourceFile),
261+
getCurrentDirectory: () => state.program.getCurrentDirectory()
261262
};
262263

263264
if (kind === BuilderProgramKind.SemanticDiagnosticsBuilderProgram) {
264265
(result as SemanticDiagnosticsBuilderProgram).getSemanticDiagnosticsOfNextAffectedFile = getSemanticDiagnosticsOfNextAffectedFile;
265266
}
266267
else if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
267-
(result as EmitAndSemanticDiagnosticsBuilderProgram).getCurrentDirectory = () => state.program.getCurrentDirectory();
268268
(result as EmitAndSemanticDiagnosticsBuilderProgram).emitNextAffectedFile = emitNextAffectedFile;
269269
}
270270
else {
@@ -485,6 +485,10 @@ namespace ts {
485485
* in that order would be used to write the files
486486
*/
487487
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult;
488+
/**
489+
* Get the current directory of the program
490+
*/
491+
getCurrentDirectory(): string;
488492
}
489493

490494
/**
@@ -503,10 +507,6 @@ namespace ts {
503507
* The semantic diagnostics are cached per file and managed by clearing for the changed/affected files
504508
*/
505509
export interface EmitAndSemanticDiagnosticsBuilderProgram extends BuilderProgram {
506-
/**
507-
* Get the current directory of the program
508-
*/
509-
getCurrentDirectory(): string;
510510
/**
511511
* Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete
512512
* The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host

tests/baselines/reference/api/typescript.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -3929,6 +3929,10 @@ declare namespace ts {
39293929
* in that order would be used to write the files
39303930
*/
39313931
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback, cancellationToken?: CancellationToken, emitOnlyDtsFiles?: boolean, customTransformers?: CustomTransformers): EmitResult;
3932+
/**
3933+
* Get the current directory of the program
3934+
*/
3935+
getCurrentDirectory(): string;
39323936
}
39333937
/**
39343938
* The builder that caches the semantic diagnostics for the program and handles the changed files and affected files
@@ -3945,10 +3949,6 @@ declare namespace ts {
39453949
* The semantic diagnostics are cached per file and managed by clearing for the changed/affected files
39463950
*/
39473951
interface EmitAndSemanticDiagnosticsBuilderProgram extends BuilderProgram {
3948-
/**
3949-
* Get the current directory of the program
3950-
*/
3951-
getCurrentDirectory(): string;
39523952
/**
39533953
* Emits the next affected file's emit result (EmitResult and sourceFiles emitted) or returns undefined if iteration is complete
39543954
* The first of writeFile if provided, writeFile of BuilderProgramHost if provided, writeFile of compiler host

0 commit comments

Comments
 (0)