mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user