mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Remove 'isEmitBlocked' from the program API.
If emitting is blocked, then calling .emit on the program will simply return immediately with an appropriate reason given in the EmitResult.
This commit is contained in:
@@ -4471,7 +4471,7 @@ module ts {
|
||||
return {
|
||||
emitResultStatus,
|
||||
diagnostics,
|
||||
sourceMaps: sourceMapDataList
|
||||
sourceMaps: isEmitBlocked ? undefined : sourceMapDataList
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ module ts {
|
||||
getNewLine: compilerHost.getNewLine,
|
||||
getSourceFile: program.getSourceFile,
|
||||
getSourceFiles: program.getSourceFiles,
|
||||
isEmitBlocked: program.isEmitBlocked,
|
||||
isEmitBlocked,
|
||||
writeFile: writeFileCallback || compilerHost.writeFile,
|
||||
};
|
||||
}
|
||||
|
||||
+1
-4
@@ -338,10 +338,7 @@ module ts {
|
||||
else {
|
||||
var checkStart = new Date().getTime();
|
||||
errors = program.getTypeCheckerDiagnostics();
|
||||
if (program.isEmitBlocked()) {
|
||||
exitStatus = EmitReturnStatus.AllOutputGenerationSkipped;
|
||||
}
|
||||
else if (compilerOptions.noEmit) {
|
||||
if (compilerOptions.noEmit) {
|
||||
exitStatus = EmitReturnStatus.Succeeded;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -947,8 +947,6 @@ module ts {
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
|
||||
// These will merge with the below diagnostics function in a followup checkin.
|
||||
getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
getTypeCheckerGlobalDiagnostics(): Diagnostic[];
|
||||
|
||||
@@ -1081,22 +1081,16 @@ module Harness {
|
||||
(fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark }),
|
||||
options.target, useCaseSensitiveFileNames, currentDirectory));
|
||||
|
||||
var isEmitBlocked = program.isEmitBlocked();
|
||||
|
||||
// only emit if there weren't parse errors
|
||||
var emitResult: ts.EmitResult;
|
||||
if (!isEmitBlocked) {
|
||||
emitResult = program.emit();
|
||||
}
|
||||
var emitResult = program.emit();
|
||||
|
||||
var errors: HarnessDiagnostic[] = [];
|
||||
program.getDiagnostics().concat(program.getTypeCheckerDiagnostics()).concat(emitResult ? emitResult.diagnostics : []).forEach(err => {
|
||||
program.getDiagnostics().concat(program.getTypeCheckerDiagnostics()).concat(emitResult.diagnostics).forEach(err => {
|
||||
// TODO: new compiler formats errors after this point to add . and newlines so we'll just do it manually for now
|
||||
errors.push(getMinimalDiagnostic(err));
|
||||
});
|
||||
this.lastErrors = errors;
|
||||
|
||||
var result = new CompilerResult(fileOutputs, errors, program, ts.sys.getCurrentDirectory(), emitResult ? emitResult.sourceMaps : undefined);
|
||||
var result = new CompilerResult(fileOutputs, errors, program, ts.sys.getCurrentDirectory(), emitResult.sourceMaps);
|
||||
onComplete(result, program);
|
||||
|
||||
// reset what newline means in case the last test changed it
|
||||
|
||||
@@ -753,7 +753,6 @@ declare module "typescript" {
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
getTypeCheckerGlobalDiagnostics(): Diagnostic[];
|
||||
getDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
|
||||
@@ -2272,11 +2272,6 @@ declare module "typescript" {
|
||||
>WriteFileCallback : WriteFileCallback
|
||||
>EmitResult : EmitResult
|
||||
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
>isEmitBlocked : (sourceFile?: SourceFile) => boolean
|
||||
>sourceFile : SourceFile
|
||||
>SourceFile : SourceFile
|
||||
|
||||
getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
>getTypeCheckerDiagnostics : (sourceFile?: SourceFile) => Diagnostic[]
|
||||
>sourceFile : SourceFile
|
||||
|
||||
@@ -784,7 +784,6 @@ declare module "typescript" {
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
getTypeCheckerGlobalDiagnostics(): Diagnostic[];
|
||||
getDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
|
||||
@@ -2419,11 +2419,6 @@ declare module "typescript" {
|
||||
>WriteFileCallback : WriteFileCallback
|
||||
>EmitResult : EmitResult
|
||||
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
>isEmitBlocked : (sourceFile?: SourceFile) => boolean
|
||||
>sourceFile : SourceFile
|
||||
>SourceFile : SourceFile
|
||||
|
||||
getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
>getTypeCheckerDiagnostics : (sourceFile?: SourceFile) => Diagnostic[]
|
||||
>sourceFile : SourceFile
|
||||
|
||||
@@ -784,7 +784,6 @@ declare module "typescript" {
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
getTypeCheckerGlobalDiagnostics(): Diagnostic[];
|
||||
getDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
|
||||
@@ -2360,11 +2360,6 @@ declare module "typescript" {
|
||||
>WriteFileCallback : WriteFileCallback
|
||||
>EmitResult : EmitResult
|
||||
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
>isEmitBlocked : (sourceFile?: SourceFile) => boolean
|
||||
>sourceFile : SourceFile
|
||||
>SourceFile : SourceFile
|
||||
|
||||
getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
>getTypeCheckerDiagnostics : (sourceFile?: SourceFile) => Diagnostic[]
|
||||
>sourceFile : SourceFile
|
||||
|
||||
@@ -822,7 +822,6 @@ declare module "typescript" {
|
||||
* will be invoked when writing the javascript and declaration files.
|
||||
*/
|
||||
emit(targetSourceFile?: SourceFile, writeFile?: WriteFileCallback): EmitResult;
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
getTypeCheckerGlobalDiagnostics(): Diagnostic[];
|
||||
getDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
|
||||
@@ -2545,11 +2545,6 @@ declare module "typescript" {
|
||||
>WriteFileCallback : WriteFileCallback
|
||||
>EmitResult : EmitResult
|
||||
|
||||
isEmitBlocked(sourceFile?: SourceFile): boolean;
|
||||
>isEmitBlocked : (sourceFile?: SourceFile) => boolean
|
||||
>sourceFile : SourceFile
|
||||
>SourceFile : SourceFile
|
||||
|
||||
getTypeCheckerDiagnostics(sourceFile?: SourceFile): Diagnostic[];
|
||||
>getTypeCheckerDiagnostics : (sourceFile?: SourceFile) => Diagnostic[]
|
||||
>sourceFile : SourceFile
|
||||
|
||||
Reference in New Issue
Block a user