Merge pull request #2321 from Microsoft/diagnosticAsserts
Add additional asserts to ensure we don't create diagnostics with bogus ...
This commit is contained in:
commit
ecfa19a760
1 changed files with 4 additions and 0 deletions
|
@ -269,8 +269,12 @@ module ts {
|
|||
|
||||
export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage, ...args: any[]): Diagnostic;
|
||||
export function createFileDiagnostic(file: SourceFile, start: number, length: number, message: DiagnosticMessage): Diagnostic {
|
||||
var end = start + length;
|
||||
|
||||
Debug.assert(start >= 0, "start must be non-negative, is " + start);
|
||||
Debug.assert(length >= 0, "length must be non-negative, is " + length);
|
||||
Debug.assert(start <= file.text.length, `start must be within the bounds of the file. ${ start } > ${ file.text.length }`);
|
||||
Debug.assert(end <= file.text.length, `end must be the bounds of the file. ${ end } > ${ file.text.length }`);
|
||||
|
||||
var text = getLocaleSpecificMessage(message.key);
|
||||
|
||||
|
|
Loading…
Reference in a new issue