diff --git a/src/compiler/parser.ts b/src/compiler/parser.ts index 05b5ea55505..0b17d95ac2b 100644 --- a/src/compiler/parser.ts +++ b/src/compiler/parser.ts @@ -876,7 +876,10 @@ module ts { var sourceFile = createNode(SyntaxKind.SourceFile, /*pos*/ 0); - sourceFile.pos = sourceFile.end = 0; + sourceFile.pos = 0; + sourceFile.end = sourceText.length; + sourceFile.text = sourceText; + sourceFile.referenceDiagnostics = []; sourceFile.parseDiagnostics = []; sourceFile.bindDiagnostics = []; @@ -961,13 +964,6 @@ module ts { // attached to the EOF token. var parseErrorBeforeNextFinishedNode: boolean = false; - sourceFile.syntacticDiagnostics = undefined; - sourceFile.referenceDiagnostics = []; - sourceFile.parseDiagnostics = []; - sourceFile.bindDiagnostics = []; - sourceFile.end = sourceText.length; - sourceFile.text = sourceText; - // Create and prime the scanner before parsing the source elements. scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceText, scanError); token = nextToken();