@@ -479,23 +479,6 @@ class ScopeCreator final {
479
479
}
480
480
481
481
public:
482
- // / When ASTScopes are enabled for code completion,
483
- // / IfConfigs will pose a challenge because we may need to field lookups into
484
- // / the inactive clauses, but the AST contains redundancy: the active clause's
485
- // / elements are present in the members or elements of an IterableTypeDecl or
486
- // / BraceStmt alongside of the IfConfigDecl. In addition there are two more
487
- // / complications:
488
- // /
489
- // / 1. The active clause's elements may be nested inside an init self
490
- // / rebinding decl (as in StringObject.self).
491
- // /
492
- // / 2. The active clause may be before or after the inactive ones
493
- // /
494
- // / So, when encountering an IfConfigDecl, we will expand the inactive
495
- // / elements. Also, always sort members or elements so that the child scopes
496
- // / are in source order (Just one of several reasons we need to sort.)
497
- // /
498
- static const bool includeInactiveIfConfigClauses = false ;
499
482
500
483
private:
501
484
static std::vector<ASTNode> expandIfConfigClauses (ArrayRef<ASTNode> input) {
@@ -526,9 +509,6 @@ class ScopeCreator final {
526
509
if (isa<IfConfigDecl>(d))
527
510
expandIfConfigClausesInto (expansion, {d}, true );
528
511
}
529
- } else if (includeInactiveIfConfigClauses) {
530
- expandIfConfigClausesInto (expansion, clause.Elements ,
531
- /* isInAnActiveNode=*/ false );
532
512
}
533
513
}
534
514
}
@@ -762,10 +742,6 @@ void ASTScope::
762
742
impl->buildEnoughOfTreeForTopLevelExpressionsButDontRequestGenericsOrExtendedNominals ();
763
743
}
764
744
765
- bool ASTScope::areInactiveIfConfigClausesSupported () {
766
- return ScopeCreator::includeInactiveIfConfigClauses;
767
- }
768
-
769
745
void ASTScope::expandFunctionBody (AbstractFunctionDecl *AFD) {
770
746
auto *const SF = AFD->getParentSourceFile ();
771
747
SF->getScope ().expandFunctionBodyImpl (AFD);
@@ -2083,10 +2059,8 @@ class LocalizableDeclContextCollector : public ASTWalker {
2083
2059
// catchForDebugging(D, "DictionaryBridging.swift", 694);
2084
2060
if (const auto *dc = dyn_cast<DeclContext>(D))
2085
2061
record (dc);
2086
- if (auto *icd = dyn_cast<IfConfigDecl>(D)) {
2087
- walkToClauses (icd);
2062
+ if (isa<IfConfigDecl>(D))
2088
2063
return false ;
2089
- }
2090
2064
if (auto *pd = dyn_cast<ParamDecl>(D))
2091
2065
record (pd->getDefaultArgumentInitContext ());
2092
2066
else if (auto *pbd = dyn_cast<PatternBindingDecl>(D))
@@ -2104,18 +2078,6 @@ class LocalizableDeclContextCollector : public ASTWalker {
2104
2078
}
2105
2079
2106
2080
private:
2107
- void walkToClauses (IfConfigDecl *icd) {
2108
- for (auto &clause : icd->getClauses ()) {
2109
- // Generate scopes for any closures in the condition
2110
- if (ScopeCreator::includeInactiveIfConfigClauses && clause.isActive ) {
2111
- if (clause.Cond )
2112
- clause.Cond ->walk (*this );
2113
- for (auto n : clause.Elements )
2114
- n.walk (*this );
2115
- }
2116
- }
2117
- }
2118
-
2119
2081
void recordInitializers (PatternBindingDecl *pbd) {
2120
2082
for (auto idx : range (pbd->getNumPatternEntries ()))
2121
2083
record (pbd->getInitContext (idx));
0 commit comments