@@ -97,7 +97,7 @@ func evaluateIfConfig(
9797
9898 // Declaration references are for custom compilation flags.
9999 if let identExpr = condition. as ( DeclReferenceExprSyntax . self) ,
100- let ident = identExpr. simpleIdentifier
100+ let ident = identExpr. simpleIdentifier? . name
101101 {
102102 // Evaluate the custom condition. If the build configuration cannot answer this query, fail.
103103 return checkConfiguration ( at: identExpr) {
@@ -214,7 +214,7 @@ func evaluateIfConfig(
214214
215215 // Call syntax is for operations.
216216 if let call = condition. as ( FunctionCallExprSyntax . self) ,
217- let fnName = call. calledExpression. simpleIdentifierExpr,
217+ let fnName = call. calledExpression. simpleIdentifierExpr? . name ,
218218 let fn = IfConfigFunctions ( rawValue: fnName)
219219 {
220220 /// Perform a check for an operation that takes a single identifier argument.
@@ -224,7 +224,7 @@ func evaluateIfConfig(
224224 ) -> ( active: Bool , syntaxErrorsAllowed: Bool , diagnostics: [ Diagnostic ] ) {
225225 // Ensure that we have a single argument that is a simple identifier.
226226 guard let argExpr = call. arguments. singleUnlabeledExpression,
227- var arg = argExpr. simpleIdentifierExpr
227+ var arg = argExpr. simpleIdentifierExpr? . name
228228 else {
229229 return recordError (
230230 . requiresUnlabeledArgument( name: fnName, role: role, syntax: ExprSyntax ( call) )
@@ -316,7 +316,7 @@ func evaluateIfConfig(
316316 case . _endian:
317317 // Ensure that we have a single argument that is a simple identifier.
318318 guard let argExpr = call. arguments. singleUnlabeledExpression,
319- let arg = argExpr. simpleIdentifierExpr
319+ let arg = argExpr. simpleIdentifierExpr? . name
320320 else {
321321 return recordError (
322322 . requiresUnlabeledArgument(
@@ -352,7 +352,7 @@ func evaluateIfConfig(
352352 // Ensure that we have a single argument that is a simple identifier, which
353353 // is an underscore followed by an integer.
354354 guard let argExpr = call. arguments. singleUnlabeledExpression,
355- let arg = argExpr. simpleIdentifierExpr,
355+ let arg = argExpr. simpleIdentifierExpr? . name ,
356356 let argFirst = arg. first,
357357 argFirst == " _ " ,
358358 let expectedBitWidth = Int ( arg. dropFirst ( ) )
@@ -530,14 +530,14 @@ private func extractImportPath(_ expression: some ExprSyntaxProtocol) throws ->
530530 // Member access.
531531 if let memberAccess = expression. as ( MemberAccessExprSyntax . self) ,
532532 let base = memberAccess. base,
533- let memberName = memberAccess. declName. simpleIdentifier
533+ let memberName = memberAccess. declName. simpleIdentifier? . name
534534 {
535535 return try extractImportPath ( base) + [ memberName]
536536 }
537537
538538 // Declaration reference.
539539 if let declRef = expression. as ( DeclReferenceExprSyntax . self) ,
540- let name = declRef. simpleIdentifier
540+ let name = declRef. simpleIdentifier? . name
541541 {
542542 return [ name]
543543 }
@@ -574,11 +574,11 @@ private func isConditionDisjunction(
574574 // If we have a call to this function, check whether the argument is one of
575575 // the acceptable values.
576576 if let call = condition. as ( FunctionCallExprSyntax . self) ,
577- let fnName = call. calledExpression. simpleIdentifierExpr,
577+ let fnName = call. calledExpression. simpleIdentifierExpr? . name ,
578578 let callFn = IfConfigFunctions ( rawValue: fnName) ,
579579 callFn == function,
580580 let argExpr = call. arguments. singleUnlabeledExpression,
581- let arg = argExpr. simpleIdentifierExpr
581+ let arg = argExpr. simpleIdentifierExpr? . name
582582 {
583583 return values. contains ( arg)
584584 }
@@ -705,7 +705,7 @@ extension ExprSyntaxProtocol {
705705
706706 // Call syntax is for operations.
707707 if let call = self . as ( FunctionCallExprSyntax . self) ,
708- let fnName = call. calledExpression. simpleIdentifierExpr,
708+ let fnName = call. calledExpression. simpleIdentifierExpr? . name ,
709709 let fn = IfConfigFunctions ( rawValue: fnName)
710710 {
711711 return fn. syntaxErrorsAllowed
0 commit comments