Skip to content

Commit 0005c1f

Browse files
[AST] Consider async let _: <Type> and async let _ = when checking for async let in pattern binding decl
1 parent 90c5dfa commit 0005c1f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/AST/Decl.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1745,6 +1745,18 @@ bool PatternBindingDecl::isAsyncLet() const {
17451745
if (auto var = getAnchoringVarDecl(0))
17461746
return var->isAsyncLet();
17471747

1748+
// Check for "async let _: <Type> = <expression>" pattern.
1749+
auto *pattern = getPatternList()[0].getPattern();
1750+
if (auto *typedPattern = dyn_cast<TypedPattern>(pattern)) {
1751+
auto *anyPattern = dyn_cast<AnyPattern>(typedPattern->getSubPattern());
1752+
return anyPattern && anyPattern->isAsyncLet();
1753+
}
1754+
1755+
// Check for "async let _ = <expression>" pattern.
1756+
if (auto *anyPattern = dyn_cast<AnyPattern>(pattern)) {
1757+
return anyPattern->isAsyncLet();
1758+
}
1759+
17481760
return false;
17491761
}
17501762

0 commit comments

Comments
 (0)