Don't check function expression grammar if this is SkipContextSensitive (#17698)

This commit is contained in:
Andy 2017-08-09 14:09:52 -07:00 committed by GitHub
parent 6221d7089e
commit f28f5fd041

View File

@ -16851,18 +16851,18 @@ namespace ts {
function checkFunctionExpressionOrObjectLiteralMethod(node: FunctionExpression | MethodDeclaration, checkMode?: CheckMode): Type {
Debug.assert(node.kind !== SyntaxKind.MethodDeclaration || isObjectLiteralMethod(node));
// Grammar checking
const hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
if (!hasGrammarError && node.kind === SyntaxKind.FunctionExpression) {
checkGrammarForGenerator(node);
}
// The identityMapper object is used to indicate that function expressions are wildcards
if (checkMode === CheckMode.SkipContextSensitive && isContextSensitive(node)) {
checkNodeDeferred(node);
return anyFunctionType;
}
// Grammar checking
const hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
if (!hasGrammarError && node.kind === SyntaxKind.FunctionExpression) {
checkGrammarForGenerator(node);
}
const links = getNodeLinks(node);
const type = getTypeOfSymbol(node.symbol);