We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f98a483 commit be74623Copy full SHA for be74623
src/util/canDefinitelyInvoke.ts
@@ -8,7 +8,15 @@ export default function canDefinitelyInvoke<T extends t.Node>(
8
let target: NodePath<any> | undefined = expr
9
while (target) {
10
if (target.isIdentifier()) {
11
- target = target.scope.getBinding(target.node.name)?.path
+ const nextTarget: NodePath<any> | undefined = target.scope.getBinding(
12
+ target.node.name
13
+ )?.path
14
+ if (
15
+ nextTarget === target ||
16
+ (nextTarget && nextTarget.node === target.node)
17
+ )
18
+ break
19
+ target = nextTarget
20
} else if (target.isVariableDeclarator()) {
21
target = (target as NodePath<t.VariableDeclarator>).get('init')
22
} else {
0 commit comments