mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[index] Add 'call' and 'isDynamic' roles
This commit is contained in:
@@ -106,8 +106,6 @@ struct FuncDeclIndexSymbol : public IndexSymbol {
|
|||||||
|
|
||||||
struct CallRefIndexSymbol : public IndexSymbol {
|
struct CallRefIndexSymbol : public IndexSymbol {
|
||||||
StringRef ReceiverUSR;
|
StringRef ReceiverUSR;
|
||||||
bool IsDynamic = false;
|
|
||||||
|
|
||||||
CallRefIndexSymbol() : IndexSymbol(CallReference) {}
|
CallRefIndexSymbol() : IndexSymbol(CallReference) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -867,6 +867,8 @@ bool IndexSwiftASTWalker::initCallRefIndexSymbol(Expr *CurrentE, Expr *ParentE,
|
|||||||
if (initIndexSymbol(D, Loc, /*IsRef=*/true, Info))
|
if (initIndexSymbol(D, Loc, /*IsRef=*/true, Info))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
Info.roles |= (unsigned)SymbolRole::Call;
|
||||||
|
|
||||||
Expr *BaseE = nullptr;
|
Expr *BaseE = nullptr;
|
||||||
if (auto DotE = dyn_cast<DotSyntaxCallExpr>(ParentE))
|
if (auto DotE = dyn_cast<DotSyntaxCallExpr>(ParentE))
|
||||||
BaseE = DotE->getBase();
|
BaseE = DotE->getBase();
|
||||||
@@ -888,7 +890,8 @@ bool IndexSwiftASTWalker::initCallRefIndexSymbol(Expr *CurrentE, Expr *ParentE,
|
|||||||
StringRef unused;
|
StringRef unused;
|
||||||
if (getNameAndUSR(TyD, unused, Info.ReceiverUSR))
|
if (getNameAndUSR(TyD, unused, Info.ReceiverUSR))
|
||||||
return true;
|
return true;
|
||||||
Info.IsDynamic = isDynamicCall(BaseE, D);
|
if (isDynamicCall(BaseE, D))
|
||||||
|
Info.roles |= (unsigned)SymbolRole::Dynamic;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ private:
|
|||||||
initEntity(info, symbol);
|
initEntity(info, symbol);
|
||||||
auto call = static_cast<const CallRefIndexSymbol &>(symbol);
|
auto call = static_cast<const CallRefIndexSymbol &>(symbol);
|
||||||
info.ReceiverUSR = call.ReceiverUSR;
|
info.ReceiverUSR = call.ReceiverUSR;
|
||||||
info.IsDynamic = call.IsDynamic;
|
info.IsDynamic = call.roles & (unsigned)SymbolRole::Dynamic;
|
||||||
return func(info);
|
return func(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user