File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -470,22 +470,15 @@ extension SyntaxProtocol {
470
470
/// configuration options `DEBUG` and `B` are provided, but `A` is not.
471
471
public func isActive( in configuration: some BuildConfiguration ) throws -> Bool {
472
472
var currentNode : Syntax = Syntax ( self )
473
- var currentClause = currentNode. as ( IfConfigClauseSyntax . self)
474
-
475
473
while let parent = currentNode. parent {
476
474
// If the parent is an `#if` configuration, check whether our current
477
475
// clause is active. If not, we're in an inactive region.
478
- if let parentIfConfig = parent. as ( IfConfigDeclSyntax . self) {
479
- if try currentClause != nil && parentIfConfig. activeClause ( in: configuration) != currentClause {
476
+ if let ifConfigClause = currentNode. as ( IfConfigClauseSyntax . self) ,
477
+ let ifConfigDecl = ifConfigClause. parent? . as ( IfConfigDeclSyntax . self)
478
+ {
479
+ if try ifConfigDecl. activeClause ( in: configuration) != ifConfigClause {
480
480
return false
481
481
}
482
-
483
- currentClause = nil
484
- }
485
-
486
- // If the parent node is an if configuration clause, store it.
487
- if let parentClause = parent. as ( IfConfigClauseSyntax . self) {
488
- currentClause = parentClause
489
482
}
490
483
491
484
currentNode = parent
You can’t perform that action at this time.
0 commit comments