mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[index] Fix dynamicMemberLookup subscript reference implicit role
When building the implicit subscript expression, set the "implicit" bit correctly and pass it through in the indexer so that we get implicit refernces to the subscript. This would be useful for e.g. searching for all uses of the dynamic subscript.
This commit is contained in:
@@ -41,8 +41,10 @@ enum class SemaReferenceKind : uint8_t {
|
||||
struct ReferenceMetaData {
|
||||
SemaReferenceKind Kind;
|
||||
llvm::Optional<AccessKind> AccKind;
|
||||
ReferenceMetaData(SemaReferenceKind Kind, llvm::Optional<AccessKind> AccKind) :
|
||||
Kind(Kind), AccKind(AccKind) {}
|
||||
bool isImplicit = false;
|
||||
ReferenceMetaData(SemaReferenceKind Kind, llvm::Optional<AccessKind> AccKind,
|
||||
bool isImplicit = false)
|
||||
: Kind(Kind), AccKind(AccKind), isImplicit(isImplicit) {}
|
||||
};
|
||||
|
||||
/// An abstract class used to traverse an AST.
|
||||
|
||||
@@ -113,11 +113,11 @@ public:
|
||||
///
|
||||
/// \param D the referenced decl.
|
||||
/// \param Range the source range of the source reference.
|
||||
/// \param AccKind whether this is a read, write or read/write access.
|
||||
/// \param Data whether this is a read, write or read/write access, etc.
|
||||
/// \param IsOpenBracket this is \c true when the method is called on an
|
||||
/// open bracket.
|
||||
virtual bool visitSubscriptReference(ValueDecl *D, CharSourceRange Range,
|
||||
Optional<AccessKind> AccKind,
|
||||
ReferenceMetaData Data,
|
||||
bool IsOpenBracket);
|
||||
|
||||
/// This method is called for each keyword argument in a call expression.
|
||||
|
||||
@@ -231,7 +231,7 @@ private:
|
||||
bool tryResolve(ModuleEntity Mod, SourceLoc Loc);
|
||||
bool tryResolve(Stmt *St);
|
||||
bool visitSubscriptReference(ValueDecl *D, CharSourceRange Range,
|
||||
Optional<AccessKind> AccKind,
|
||||
ReferenceMetaData Data,
|
||||
bool IsOpenBracket) override;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user