Skip to content

Commit 91fd2ba

Browse files
Fix some warnings
1 parent 5ee55d3 commit 91fd2ba

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

Sources/SpyableMacro/Extensions/TypeSyntax+Extensions.swift

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,17 @@ extension GenericArgumentClauseSyntax: TypeSyntaxSupportingGenerics {
131131
newArgument = type.erasingGenericTypes(genericTypes)
132132
default: continue
133133
}
134+
let newArgumentElement = GenericArgumentSyntax(
135+
argument: .type(newArgument),
136+
trailingComma: argumentElement.trailingComma
137+
)
134138
#else
135139
let newArgument: TypeSyntax = argumentElement.argument.erasingGenericTypes(genericTypes)
140+
let newArgumentElement = GenericArgumentSyntax(
141+
argument: newArgument,
142+
trailingComma: argumentElement.trailingComma
143+
)
136144
#endif
137-
let newArgumentElement = GenericArgumentSyntax(
138-
argument: newArgument,
139-
trailingComma: argumentElement.trailingComma
140-
)
141145
newArgumentElements.append(newArgumentElement)
142146
}
143147

Sources/SpyableMacro/Factories/ClosureFactory.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ struct ClosureFactory {
4848
},
4949
effectSpecifiers: TypeEffectSpecifiersSyntax(
5050
asyncSpecifier: functionSignature.effectSpecifiers?.asyncSpecifier,
51-
throwsSpecifier: functionSignature.effectSpecifiers?.throwsSpecifier
51+
throwsClause: functionSignature.effectSpecifiers?.throwsClause
5252
),
5353
returnClause: returnClause
5454
)
@@ -166,7 +166,7 @@ struct ClosureFactory {
166166
expression = AwaitExprSyntax(expression: expression)
167167
}
168168

169-
if functionSignature.effectSpecifiers?.throwsSpecifier != nil {
169+
if functionSignature.effectSpecifiers?.throwsClause?.throwsSpecifier != nil {
170170
expression = TryExprSyntax(expression: expression)
171171
}
172172

@@ -189,7 +189,7 @@ struct ClosureFactory {
189189
extension FunctionParameterListSyntax.Element {
190190
fileprivate var isInoutParameter: Bool {
191191
if let attributedType = self.type.as(AttributedTypeSyntax.self),
192-
attributedType.specifier?.text == TokenSyntax.keyword(.inout).text
192+
attributedType.specifiers.first?.firstToken(viewMode: .all)?.text == TokenSyntax.keyword(.inout).text
193193
{
194194
return true
195195
} else {

Sources/SpyableMacro/Factories/FunctionImplementationFactory.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ struct FunctionImplementationFactory {
8787
)
8888
}
8989

90-
if protocolFunctionDeclaration.signature.effectSpecifiers?.throwsSpecifier != nil {
90+
if protocolFunctionDeclaration.signature.effectSpecifiers?.throwsClause?.throwsSpecifier != nil {
9191
throwableErrorFactory.throwErrorExpression(variablePrefix: variablePrefix)
9292
}
9393

Sources/SpyableMacro/Factories/SpyFactory.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ struct SpyFactory {
158158
)
159159
}
160160

161-
if functionDeclaration.signature.effectSpecifiers?.throwsSpecifier != nil {
161+
if functionDeclaration.signature.effectSpecifiers?.throwsClause?.throwsSpecifier != nil {
162162
try throwableErrorFactory.variableDeclaration(variablePrefix: variablePrefix)
163163
}
164164

0 commit comments

Comments
 (0)