Fix TokenOrIdentifierObject.getText() crash (#19673)

TokenOrIdentifierObject.getText() needs to pass `sourceFile` as an
argument to `getStart()`.

Fixes https://github.com/Microsoft/TypeScript/issues/19670
This commit is contained in:
Mike Morearty 2017-11-01 16:37:06 -07:00 committed by Mohamed Hegazy
parent ba98cbbf92
commit 1a7a587a9e

View file

@ -276,7 +276,10 @@ namespace ts {
}
public getText(sourceFile?: SourceFile): string {
return (sourceFile || this.getSourceFile()).text.substring(this.getStart(), this.getEnd());
if (!sourceFile) {
sourceFile = this.getSourceFile();
}
return sourceFile.text.substring(this.getStart(sourceFile), this.getEnd());
}
public getChildCount(): number {