Skip to content

Commit 50eeeb7

Browse files
committed
[index] Add 'call' and 'isDynamic' roles
1 parent 1b1320b commit 50eeeb7

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

include/swift/Index/IndexSymbol.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ struct FuncDeclIndexSymbol : public IndexSymbol {
106106

107107
struct CallRefIndexSymbol : public IndexSymbol {
108108
StringRef ReceiverUSR;
109-
bool IsDynamic = false;
110-
111109
CallRefIndexSymbol() : IndexSymbol(CallReference) {}
112110
};
113111

lib/Index/Index.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,6 +867,8 @@ bool IndexSwiftASTWalker::initCallRefIndexSymbol(Expr *CurrentE, Expr *ParentE,
867867
if (initIndexSymbol(D, Loc, /*IsRef=*/true, Info))
868868
return true;
869869

870+
Info.roles |= (unsigned)SymbolRole::Call;
871+
870872
Expr *BaseE = nullptr;
871873
if (auto DotE = dyn_cast<DotSyntaxCallExpr>(ParentE))
872874
BaseE = DotE->getBase();
@@ -888,7 +890,8 @@ bool IndexSwiftASTWalker::initCallRefIndexSymbol(Expr *CurrentE, Expr *ParentE,
888890
StringRef unused;
889891
if (getNameAndUSR(TyD, unused, Info.ReceiverUSR))
890892
return true;
891-
Info.IsDynamic = isDynamicCall(BaseE, D);
893+
if (isDynamicCall(BaseE, D))
894+
Info.roles |= (unsigned)SymbolRole::Dynamic;
892895
}
893896
}
894897

tools/SourceKit/lib/SwiftLang/SwiftIndexing.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ class SKIndexDataConsumer : public IndexDataConsumer {
121121
initEntity(info, symbol);
122122
auto call = static_cast<const CallRefIndexSymbol &>(symbol);
123123
info.ReceiverUSR = call.ReceiverUSR;
124-
info.IsDynamic = call.IsDynamic;
124+
info.IsDynamic = call.roles & (unsigned)SymbolRole::Dynamic;
125125
return func(info);
126126
}
127127
}

0 commit comments

Comments
 (0)