Update check for syntax tree existance

This commit is contained in:
Mohamed Hegazy 2014-08-04 15:36:26 -07:00
parent ab05b75297
commit 21fb3bc675

View file

@ -392,7 +392,7 @@ module ts {
// the old syntax tree.
var oldSyntaxTree = this.syntaxTree;
if (textChangeRange !== null && Debug.shouldAssert(AssertionLevel.Normal)) {
if (textChangeRange && Debug.shouldAssert(AssertionLevel.Normal)) {
var oldText = this.scriptSnapshot;
var newText = scriptSnapshot;
@ -413,7 +413,7 @@ module ts {
// If we don't have a text change, or we don't have an old syntax tree, then do a full
// parse. Otherwise, do an incremental parse.
var newSyntaxTree = textChangeRange === null || oldSyntaxTree === null
var newSyntaxTree = !textChangeRange || !oldSyntaxTree
? TypeScript.Parser.parse(this.filename, text, this.languageVersion, TypeScript.isDTSFile(this.filename))
: TypeScript.IncrementalParser.parse(oldSyntaxTree, textChangeRange, text);