Add back getSourceFile and mark it as deprecated

This commit is contained in:
Mohamed Hegazy
2016-09-19 11:51:01 -07:00
parent 5f1336be9e
commit 3a46371004
3 changed files with 18 additions and 0 deletions
+3
View File
@@ -462,6 +462,9 @@ namespace Harness.LanguageService {
getNonBoundSourceFile(fileName: string): ts.SourceFile {
throw new Error("SourceFile can not be marshaled across the shim layer.");
}
getSourceFile(fileName: string): ts.SourceFile {
throw new Error("SourceFile can not be marshaled across the shim layer.");
}
dispose(): void { this.shim.dispose({}); }
}
+4
View File
@@ -641,6 +641,10 @@ namespace ts.server {
throw new Error("SourceFile objects are not serializable through the server protocol.");
}
getSourceFile(fileName: string): SourceFile {
throw new Error("SourceFile objects are not serializable through the server protocol.");
}
cleanupSemanticCache(): void {
throw new Error("cleanupSemanticCache is not available through the server layer.");
}
+11
View File
@@ -1246,6 +1246,12 @@ namespace ts {
/* @internal */ getNonBoundSourceFile(fileName: string): SourceFile;
/**
* @internal
* @deprecated Use ts.createSourceFile instead.
*/
getSourceFile(fileName: string): SourceFile;
dispose(): void;
}
@@ -7174,6 +7180,10 @@ namespace ts {
return syntaxTreeCache.getCurrentSourceFile(fileName);
}
function getSourceFile(fileName: string): SourceFile {
return getNonBoundSourceFile(fileName);
}
function getNameOrDottedNameSpan(fileName: string, startPos: number, endPos: number): TextSpan {
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
@@ -8338,6 +8348,7 @@ namespace ts {
isValidBraceCompletionAtPosition,
getEmitOutput,
getNonBoundSourceFile,
getSourceFile,
getProgram
};
}