@@ -25,12 +25,12 @@ public enum IfConfigRegionState {
25
25
case active
26
26
27
27
/// 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.
30
30
public static func evaluating(
31
31
_ condition: some ExprSyntaxProtocol ,
32
32
in configuration: some BuildConfiguration
33
- ) -> ( state: IfConfigRegionState , diagnostics: [ Diagnostic ] ) {
33
+ ) -> ( state: IfConfigRegionState , syntaxErrorsAllowed : Bool , diagnostics: [ Diagnostic ] ) {
34
34
// Apply operator folding for !/&&/||.
35
35
var foldingDiagnostics : [ Diagnostic ] = [ ]
36
36
let foldedCondition = OperatorTable . logicalOperators. foldAll ( condition) { error in
@@ -44,9 +44,9 @@ public enum IfConfigRegionState {
44
44
45
45
let diagnostics = foldingDiagnostics + evalDiagnostics
46
46
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)
50
50
}
51
51
}
52
52
}
0 commit comments