added helper

This commit is contained in:
Arthur Ozga
2015-08-03 13:38:45 -07:00
parent 4c7b214a69
commit a759f9f0b5
4 changed files with 12 additions and 15 deletions
+2 -2
View File
@@ -794,7 +794,7 @@ namespace ts {
if (!expression) {
let verboseDebugString = "";
if (verboseDebugInfo) {
verboseDebugString = "\r\nVerbose Debug Information: " + verboseDebugInfo();
verboseDebugString = getNewLineOrDefault() + "Verbose Debug Information: " + verboseDebugInfo();
}
throw new Error("Debug Failure. False expression: " + (message || "") + verboseDebugString);
@@ -805,4 +805,4 @@ namespace ts {
Debug.assert(false, message);
}
}
}
}
+8
View File
@@ -2092,6 +2092,14 @@ namespace ts {
}
return carriageReturnLineFeed;
}
/**
* The default is CRLF.
*/
export function getNewLineOrDefault(getNewLine?: () => string): string {
return getNewLine ? getNewLine() : carriageReturnLineFeed;
var x: number;
}
}
namespace ts {
+1 -8
View File
@@ -1560,13 +1560,6 @@ namespace ts {
/// Language Service
interface FormattingOptions {
useTabs: boolean;
spacesPerTab: number;
indentSpaces: number;
newLineCharacter: string;
}
// Information about a specific host file.
interface HostFileInformation {
hostFileName: string;
@@ -2535,7 +2528,7 @@ namespace ts {
getCancellationToken: () => cancellationToken,
getCanonicalFileName,
useCaseSensitiveFileNames: () => useCaseSensitivefileNames,
getNewLine: () => host.getNewLine ? host.getNewLine() : "\r\n",
getNewLine: () => getNewLineOrDefault(host.getNewLine),
getDefaultLibFileName: (options) => host.getDefaultLibFileName(options),
writeFile: (fileName, data, writeByteOrderMark) => { },
getCurrentDirectory: () => host.getCurrentDirectory()
+1 -5
View File
@@ -529,7 +529,7 @@ namespace ts {
}
private realizeDiagnostics(diagnostics: Diagnostic[]): { message: string; start: number; length: number; category: string; }[]{
var newLine = this.getNewLine();
var newLine = getNewLineOrDefault(this.host.getNewLine);
return ts.realizeDiagnostics(diagnostics, newLine);
}
@@ -571,10 +571,6 @@ namespace ts {
});
}
private getNewLine(): string {
return this.host.getNewLine ? this.host.getNewLine() : "\r\n";
}
public getSyntacticDiagnostics(fileName: string): string {
return this.forwardJSONCall(
"getSyntacticDiagnostics('" + fileName + "')",