[AST] In IfConfigDecl/IfConfigStmt keep track of whether the IfBlock is active or not.

Swift SVN r15444
This commit is contained in:
Argyrios Kyrtzidis
2014-03-25 03:55:29 +00:00
parent 3064e04d47
commit 121bf14dd1
4 changed files with 26 additions and 20 deletions

View File

@@ -1276,6 +1276,7 @@ ParserResult<IfConfigDecl> Parser::parseDeclIfConfig(
}
IfConfigDecl *ICD = new (Context) IfConfigDecl(CurDeclContext,
ifBlockIsActive,
IfLoc,
ElseLoc,
EndLoc,
@@ -1284,15 +1285,11 @@ ParserResult<IfConfigDecl> Parser::parseDeclIfConfig(
ICD->setActiveMembers(Context.AllocateCopy(IfDecls));
} else {
ICD->setInactiveMembers(Context.AllocateCopy(IfDecls));
ICD->setInactiveSourceRange(SourceRange(IfLoc, ElseLoc.isValid() ?
ElseLoc :
EndLoc));
}
if (ElseLoc.isValid()) {
if (ifBlockIsActive) {
ICD->setInactiveMembers(Context.AllocateCopy(ElseDecls));
ICD->setInactiveSourceRange(SourceRange(IfLoc, EndLoc));
} else {
ICD->setActiveMembers(Context.AllocateCopy(ElseDecls));
}