Skip to content

Commit 48c71c9

Browse files
committed
Swift: add comment about TypeRepr in ASTNode fetching
1 parent 033b239 commit 48c71c9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

swift/extractor/infra/SwiftDispatcher.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,10 @@ class SwiftDispatcher {
251251

252252
template <typename Tag, typename T, typename... Ts>
253253
bool fetchLabelFromUnionCase(const llvm::PointerUnion<Ts...> u, TrapLabel<Tag>& output) {
254+
// we rely on the fact that when we extract `ASTNode` instances (which only happens
255+
// on `BraceStmt` elements), we cannot encounter a standalone `TypeRepr` there, so we skip
256+
// this case, which would be problematic as we would not be able to provide the corresponding
257+
// type
254258
if constexpr (!std::is_same_v<T, swift::TypeRepr*>) {
255259
if (auto e = u.template dyn_cast<T>()) {
256260
output = fetchLabel(e);

0 commit comments

Comments
 (0)