Remove IfConfigDecl from the AST

The swift-syntax tree retains information about the parsed #if
regions. Drop it from the semantic AST.
This commit is contained in:
Doug Gregor
2024-09-18 20:46:57 -07:00
parent d762dd53f8
commit 5b2520e379
38 changed files with 16 additions and 476 deletions

View File

@@ -265,12 +265,9 @@ static bool isViableElement(ASTNode element,
ConstraintSystem &cs) {
if (auto *decl = element.dyn_cast<Decl *>()) {
// - Ignore variable declarations, they are handled by pattern bindings;
// - Ignore #if, the chosen children should appear in the
// surrounding context;
// - Skip #warning and #error, they are handled during solution
// application.
if (isa<VarDecl>(decl) || isa<IfConfigDecl>(decl) ||
isa<PoundDiagnosticDecl>(decl))
if (isa<VarDecl>(decl) || isa<PoundDiagnosticDecl>(decl))
return false;
}
@@ -836,12 +833,6 @@ private:
}
}
// Just ignore #if; the chosen children should appear in the
// surrounding context. This isn't good for source tools but it
// at least works.
if (isa<IfConfigDecl>(decl))
return;
// Skip #warning/#error; we'll handle them when applying the closure.
if (isa<PoundDiagnosticDecl>(decl))
return;
@@ -1740,9 +1731,6 @@ private:
}
void visitDecl(Decl *decl) {
if (isa<IfConfigDecl>(decl))
return;
if (auto *PBD = dyn_cast<PatternBindingDecl>(decl)) {
if (visitPatternBindingDecl(PBD)) {
hadError = true;