@@ -146,9 +146,9 @@ func evaluateIfConfig(
146
146
outermostCondition: false
147
147
)
148
148
149
- // Short-circuit evaluation if we know the answer . We still recurse into
150
- // the right-hand side, but with a dummy configuration that won't have
151
- // side effects, so we only get validation-related errors .
149
+ // Determine whether we already know the result . We might short-circuit the
150
+ // evaluation, depending on whether we need to produce validation
151
+ // diagnostics for the right-hand side .
152
152
let shortCircuitResult : Bool ?
153
153
switch ( lhsActive, op. operator. text) {
154
154
case ( true , " || " ) : shortCircuitResult = true
@@ -157,8 +157,8 @@ func evaluateIfConfig(
157
157
}
158
158
159
159
// If we are supposed to short-circuit and the left-hand side of this
160
- // operator with inactive && , stop now: we shouldn't evaluate the right-
161
- // hand side at all.
160
+ // operator permits syntax errors when it fails , stop now: we shouldn't
161
+ // process the right- hand side at all.
162
162
if let isActive = shortCircuitResult, lhsSyntaxErrorsAllowed {
163
163
return (
164
164
active: isActive,
@@ -167,7 +167,9 @@ func evaluateIfConfig(
167
167
)
168
168
}
169
169
170
- // Evaluate the right-hand side.
170
+ // Process the right-hand side. If we already know the answer, then
171
+ // avoid performing any build configuration queries that might cause
172
+ // side effects.
171
173
let rhsActive : Bool
172
174
let rhsSyntaxErrorsAllowed : Bool
173
175
let rhsDiagnostics : [ Diagnostic ]
0 commit comments