Skip to content

Commit

Permalink
Merge pull request #7 from pzmudzinski/fix-build-warnings-xcode-15
Browse files Browse the repository at this point in the history
Remove deprecated API so xcode 15 won't throw build warnings
  • Loading branch information
mkowalski87 authored Nov 9, 2023
2 parents 1a48bb4 + 12b44a3 commit 067b489
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ struct MacroDeclarationHelper {

/// Returns 'TokenSyntax' representing name of the input parameter.
var inputParamName: TokenSyntax? {
declaration.signature.input.parameterList.first?.secondName
declaration.signature.parameterClause.parameters.first?.secondName
}

/// Returns 'TypeSyntax' representing type of the input object.
var inputParamType: TypeSyntax? {
declaration.signature.input.parameterList.first?.type
declaration.signature.parameterClause.parameters.first?.type
}

var firstAttribute: AttributeSyntax? {
Expand All @@ -25,11 +25,11 @@ struct MacroDeclarationHelper {

var inputValues: ArrayElementListSyntax {
get throws {
guard let firstMacroArgument = firstAttribute?.argument?.as(TupleExprElementListSyntax.self) else {
guard let firstMacroArgument = firstAttribute?.arguments?.as(LabeledExprListSyntax.self) else {
throw ParametrizeMacroError.macroAttributeNotAnArray
}

guard let arrayOfValues = firstMacroArgument.first?.as(TupleExprElementSyntax.self)?.expression.as(ArrayExprSyntax.self)?.elements else {
guard let arrayOfValues = firstMacroArgument.first?.as(LabeledExprSyntax.self)?.expression.as(ArrayExprSyntax.self)?.elements else {
throw ParametrizeMacroError.macroAttributeNotAnArray
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public struct ParametrizeMacro: PeerMacro {

let macroDeclarationHelper = MacroDeclarationHelper(declaration)

let funcName = declaration.identifier
let funcName = declaration.name
guard let inputParamName = macroDeclarationHelper.inputParamName?.text else {
throw ParametrizeMacroError.functionInputParamSecondNameMissing
}
Expand Down

0 comments on commit 067b489

Please sign in to comment.