@@ -97,7 +97,7 @@ func evaluateIfConfig(
97
97
98
98
// Declaration references are for custom compilation flags.
99
99
if let identExpr = condition. as ( DeclReferenceExprSyntax . self) ,
100
- let ident = identExpr. simpleIdentifier
100
+ let ident = identExpr. simpleIdentifier? . name
101
101
{
102
102
// Evaluate the custom condition. If the build configuration cannot answer this query, fail.
103
103
return checkConfiguration ( at: identExpr) {
@@ -214,7 +214,7 @@ func evaluateIfConfig(
214
214
215
215
// Call syntax is for operations.
216
216
if let call = condition. as ( FunctionCallExprSyntax . self) ,
217
- let fnName = call. calledExpression. simpleIdentifierExpr,
217
+ let fnName = call. calledExpression. simpleIdentifierExpr? . name ,
218
218
let fn = IfConfigFunctions ( rawValue: fnName)
219
219
{
220
220
/// Perform a check for an operation that takes a single identifier argument.
@@ -224,7 +224,7 @@ func evaluateIfConfig(
224
224
) -> ( active: Bool , syntaxErrorsAllowed: Bool , diagnostics: [ Diagnostic ] ) {
225
225
// Ensure that we have a single argument that is a simple identifier.
226
226
guard let argExpr = call. arguments. singleUnlabeledExpression,
227
- var arg = argExpr. simpleIdentifierExpr
227
+ var arg = argExpr. simpleIdentifierExpr? . name
228
228
else {
229
229
return recordError (
230
230
. requiresUnlabeledArgument( name: fnName, role: role, syntax: ExprSyntax ( call) )
@@ -316,7 +316,7 @@ func evaluateIfConfig(
316
316
case . _endian:
317
317
// Ensure that we have a single argument that is a simple identifier.
318
318
guard let argExpr = call. arguments. singleUnlabeledExpression,
319
- let arg = argExpr. simpleIdentifierExpr
319
+ let arg = argExpr. simpleIdentifierExpr? . name
320
320
else {
321
321
return recordError (
322
322
. requiresUnlabeledArgument(
@@ -352,7 +352,7 @@ func evaluateIfConfig(
352
352
// Ensure that we have a single argument that is a simple identifier, which
353
353
// is an underscore followed by an integer.
354
354
guard let argExpr = call. arguments. singleUnlabeledExpression,
355
- let arg = argExpr. simpleIdentifierExpr,
355
+ let arg = argExpr. simpleIdentifierExpr? . name ,
356
356
let argFirst = arg. first,
357
357
argFirst == " _ " ,
358
358
let expectedBitWidth = Int ( arg. dropFirst ( ) )
@@ -530,14 +530,14 @@ private func extractImportPath(_ expression: some ExprSyntaxProtocol) throws ->
530
530
// Member access.
531
531
if let memberAccess = expression. as ( MemberAccessExprSyntax . self) ,
532
532
let base = memberAccess. base,
533
- let memberName = memberAccess. declName. simpleIdentifier
533
+ let memberName = memberAccess. declName. simpleIdentifier? . name
534
534
{
535
535
return try extractImportPath ( base) + [ memberName]
536
536
}
537
537
538
538
// Declaration reference.
539
539
if let declRef = expression. as ( DeclReferenceExprSyntax . self) ,
540
- let name = declRef. simpleIdentifier
540
+ let name = declRef. simpleIdentifier? . name
541
541
{
542
542
return [ name]
543
543
}
@@ -574,11 +574,11 @@ private func isConditionDisjunction(
574
574
// If we have a call to this function, check whether the argument is one of
575
575
// the acceptable values.
576
576
if let call = condition. as ( FunctionCallExprSyntax . self) ,
577
- let fnName = call. calledExpression. simpleIdentifierExpr,
577
+ let fnName = call. calledExpression. simpleIdentifierExpr? . name ,
578
578
let callFn = IfConfigFunctions ( rawValue: fnName) ,
579
579
callFn == function,
580
580
let argExpr = call. arguments. singleUnlabeledExpression,
581
- let arg = argExpr. simpleIdentifierExpr
581
+ let arg = argExpr. simpleIdentifierExpr? . name
582
582
{
583
583
return values. contains ( arg)
584
584
}
@@ -705,7 +705,7 @@ extension ExprSyntaxProtocol {
705
705
706
706
// Call syntax is for operations.
707
707
if let call = self . as ( FunctionCallExprSyntax . self) ,
708
- let fnName = call. calledExpression. simpleIdentifierExpr,
708
+ let fnName = call. calledExpression. simpleIdentifierExpr? . name ,
709
709
let fn = IfConfigFunctions ( rawValue: fnName)
710
710
{
711
711
return fn. syntaxErrorsAllowed
0 commit comments