@@ -25,12 +25,12 @@ public enum IfConfigRegionState {
2525 case active
2626
2727 /// Evaluate the given `#if` condition using the given build configuration
28- /// to determine its state and identify any problems encountered along the
29- /// way.
28+ /// to determine its state, whether syntax errors in inactive conditions are
29+ /// permitted, and to identify any problems encountered along the way.
3030 public static func evaluating(
3131 _ condition: some ExprSyntaxProtocol ,
3232 in configuration: some BuildConfiguration
33- ) -> ( state: IfConfigRegionState , diagnostics: [ Diagnostic ] ) {
33+ ) -> ( state: IfConfigRegionState , syntaxErrorsAllowed : Bool , diagnostics: [ Diagnostic ] ) {
3434 // Apply operator folding for !/&&/||.
3535 var foldingDiagnostics : [ Diagnostic ] = [ ]
3636 let foldedCondition = OperatorTable . logicalOperators. foldAll ( condition) { error in
@@ -44,9 +44,9 @@ public enum IfConfigRegionState {
4444
4545 let diagnostics = foldingDiagnostics + evalDiagnostics
4646 switch ( active, syntaxErrorsAllowed) {
47- case ( true , _) : return ( . active, diagnostics)
48- case ( false , false ) : return ( . inactive, diagnostics)
49- case ( false , true ) : return ( . unparsed, diagnostics)
47+ case ( true , _) : return ( . active, syntaxErrorsAllowed , diagnostics)
48+ case ( false , false ) : return ( . inactive, syntaxErrorsAllowed , diagnostics)
49+ case ( false , true ) : return ( . unparsed, syntaxErrorsAllowed , diagnostics)
5050 }
5151 }
5252}
0 commit comments