mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-12 21:37:41 -06:00
Merge pull request #7311 from Microsoft/issue7310
Fix JS parsing perf issue (#7310)
This commit is contained in:
commit
619ed2b956
@ -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,
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -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') {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user