do not report use-before-declaration error in async like IIFE initial… (#55279)

This commit is contained in:
Zzzen
2023-08-29 01:47:32 +08:00
committed by GitHub
parent 4d7753ae3e
commit 788239ff87
6 changed files with 160 additions and 2 deletions

View File

@@ -452,7 +452,6 @@ import {
isAssignmentOperator,
isAssignmentPattern,
isAssignmentTarget,
isAsyncFunction,
isAutoAccessorPropertyDeclaration,
isAwaitExpression,
isBinaryExpression,
@@ -3874,7 +3873,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
function isSameScopeDescendentOf(initial: Node, parent: Node | undefined, stopAt: Node): boolean {
return !!parent && !!findAncestor(initial, n =>
n === parent
|| (n === stopAt || isFunctionLike(n) && (!getImmediatelyInvokedFunctionExpression(n) || isAsyncFunction(n)) ? "quit" : false));
|| (n === stopAt || isFunctionLike(n) && (!getImmediatelyInvokedFunctionExpression(n) || (getFunctionFlags(n) & FunctionFlags.AsyncGenerator)) ? "quit" : false));
}
function getAnyImportSyntax(node: Node): AnyImportSyntax | undefined {