Skip to content

Commit abf6a30

Browse files
authored
Revert "[Index] Apply RelationContainedBy role to references contained by VarDecl."
1 parent 9218ca0 commit abf6a30

9 files changed

+116
-685
lines changed

Diff for: include/swift/IDE/SourceEntityWalker.h

-17
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,6 @@ class SourceEntityWalker {
8888
/// false, the remaining traversal is terminated and returns failure.
8989
virtual bool walkToDeclPost(Decl *D) { return true; }
9090

91-
/// This method is called in AST order, unlike \c walkToDecl* which are called
92-
/// in source order. It is guaranteed to be called in balance with its
93-
/// counterpart \c endBalancedASTOrderDeclVisit.
94-
virtual void beginBalancedASTOrderDeclVisit(Decl *D){};
95-
96-
/// This method is called after declaration visitation in AST order.
97-
virtual void endBalancedASTOrderDeclVisit(Decl *D){};
98-
9991
/// This method is called when first visiting a statement, before walking into
10092
/// its children. If it returns false, the subtree is skipped.
10193
virtual bool walkToStmtPre(Stmt *S) { return true; }
@@ -120,15 +112,6 @@ class SourceEntityWalker {
120112
/// returns false, the remaining traversal is terminated and returns failure.
121113
virtual bool walkToPatternPost(Pattern *P) { return true; }
122114

123-
/// This method is called when first visiting a type representation, before
124-
/// walking into its children. If it returns false, the subtree is skipped.
125-
virtual bool walkToTypeReprPre(TypeRepr *T) { return true; }
126-
127-
/// This method is called after visiting the children of a type
128-
/// representation. If it returns false, the remaining traversal is terminated
129-
/// and returns failure.
130-
virtual bool walkToTypeReprPost(TypeRepr *T) { return true; }
131-
132115
/// This method is called when a ValueDecl is referenced in source. If it
133116
/// returns false, the remaining traversal is terminated and returns failure.
134117
///

Diff for: lib/IDE/SourceEntityWalker.cpp

+1-38
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,10 @@ class SemaAnnotator : public ASTWalker {
5555
return SEWalker.shouldWalkIntoGenericParams();
5656
}
5757
bool walkToDeclPre(Decl *D) override;
58-
bool walkToDeclPreProper(Decl *D);
5958
std::pair<bool, Expr *> walkToExprPre(Expr *E) override;
6059
bool walkToTypeReprPre(TypeRepr *T) override;
6160

6261
bool walkToDeclPost(Decl *D) override;
63-
bool walkToDeclPostProper(Decl *D);
6462
Expr *walkToExprPost(Expr *E) override;
6563
bool walkToTypeReprPost(TypeRepr *T) override;
6664

@@ -120,21 +118,6 @@ bool SemaAnnotator::walkToDeclPre(Decl *D) {
120118
return isa<PatternBindingDecl>(D);
121119
}
122120

123-
SEWalker.beginBalancedASTOrderDeclVisit(D);
124-
bool Continue = walkToDeclPreProper(D);
125-
126-
if (!Continue) {
127-
// To satisfy the contract of balanced calls to
128-
// begin/endBalancedASTOrderDeclVisit, we must call
129-
// endBalancedASTOrderDeclVisit here if walkToDeclPost isn't going to be
130-
// called.
131-
SEWalker.endBalancedASTOrderDeclVisit(D);
132-
}
133-
134-
return Continue;
135-
}
136-
137-
bool SemaAnnotator::walkToDeclPreProper(Decl *D) {
138121
if (!handleCustomAttributes(D)) {
139122
Cancelled = true;
140123
return false;
@@ -220,12 +203,6 @@ bool SemaAnnotator::walkToDeclPreProper(Decl *D) {
220203
}
221204

222205
bool SemaAnnotator::walkToDeclPost(Decl *D) {
223-
bool Continue = walkToDeclPostProper(D);
224-
SEWalker.endBalancedASTOrderDeclVisit(D);
225-
return Continue;
226-
}
227-
228-
bool SemaAnnotator::walkToDeclPostProper(Decl *D) {
229206
if (isDone())
230207
return false;
231208

@@ -603,12 +580,6 @@ bool SemaAnnotator::walkToTypeReprPre(TypeRepr *T) {
603580
if (isDone())
604581
return false;
605582

606-
bool Continue = SEWalker.walkToTypeReprPre(T);
607-
if (!Continue) {
608-
Cancelled = true;
609-
return false;
610-
}
611-
612583
if (auto IdT = dyn_cast<ComponentIdentTypeRepr>(T)) {
613584
if (ValueDecl *VD = IdT->getBoundDecl()) {
614585
if (auto *ModD = dyn_cast<ModuleDecl>(VD)) {
@@ -620,19 +591,11 @@ bool SemaAnnotator::walkToTypeReprPre(TypeRepr *T) {
620591
ReferenceMetaData(SemaReferenceKind::TypeRef, None));
621592
}
622593
}
623-
624594
return true;
625595
}
626596

627597
bool SemaAnnotator::walkToTypeReprPost(TypeRepr *T) {
628-
if (isDone()) {
629-
return false;
630-
}
631-
632-
bool Continue = SEWalker.walkToTypeReprPost(T);
633-
if (!Continue)
634-
Cancelled = true;
635-
return Continue;
598+
return !isDone();
636599
}
637600

638601
std::pair<bool, Pattern *> SemaAnnotator::walkToPatternPre(Pattern *P) {

0 commit comments

Comments
 (0)