diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 8fd21ed008a..d605a684a76 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -430,7 +430,7 @@ namespace ts { JavaScriptFile = 1 << 5, // Context flags set directly by the parser. - ParserGeneratedFlags = DisallowIn | Yield | Decorator | ThisNodeHasError | Await, + ParserGeneratedFlags = DisallowIn | Yield | Decorator | ThisNodeHasError | Await | JavaScriptFile, // Exclude these flags when parsing a Type TypeExcludesFlags = Yield | Await, diff --git a/src/harness/harness.ts b/src/harness/harness.ts index 5c191a3b9d7..858607143d2 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -285,6 +285,10 @@ namespace Utils { // data we don't care about in the dump. We only care what the parser set directly // on the ast. let value = n.parserContextFlags & ts.ParserContextFlags.ParserGeneratedFlags; + + // Remove the JavaScriptFile flag, as this is just noise for JSDocParser and Test262 tests + // (which are the only tests that use this function). + value = value & ~ts.ParserContextFlags.JavaScriptFile; if (value) { o[propertyName] = getParserContextFlagName(value); } diff --git a/tests/cases/unittests/jsDocParsing.ts b/tests/cases/unittests/jsDocParsing.ts index 9988383b467..9c68cea3297 100644 --- a/tests/cases/unittests/jsDocParsing.ts +++ b/tests/cases/unittests/jsDocParsing.ts @@ -11,6 +11,7 @@ module ts { assert.isTrue(typeAndDiagnostics && typeAndDiagnostics.diagnostics.length === 0); let result = Utils.sourceFileToJSON(typeAndDiagnostics.jsDocTypeExpression.type); + assert.equal(result, expected); } @@ -998,7 +999,7 @@ module ts { ? JSON.parse(Utils.sourceFileToJSON(v)) : v; }, 4); - + if (result !== expected) { // Turn on a human-readable diff if (typeof require !== 'undefined') {