@@ -59,19 +59,17 @@ public struct ArbitraryMacro: PeerMacro {
5959
6060 partialResult. append ( . init( name: name, type: type, isIgnored: variable. isIgnored, isNilable: variable. isNilable) )
6161 }
62- let arbitraryMethod : FunctionDeclSyntax
63-
64- switch arbitraryType {
62+ let arbitraryMethod : FunctionDeclSyntax = switch arbitraryType {
6563 case . mock:
66- arbitraryMethod = makeArbitraryMethodForMock (
64+ makeArbitraryMethodForMock (
6765 accessModifier: accessModifier,
6866 typeName: typeName,
6967 parameters: parameters,
7068 arbitraryConfig: arbitraryConfig,
7169 declMembers: declGroup. memberBlock. members
7270 )
7371 case . model:
74- arbitraryMethod = makeArbitraryMethodForModel (
72+ makeArbitraryMethodForModel (
7573 accessModifier: accessModifier,
7674 typeName: typeName,
7775 parameters: parameters,
@@ -148,29 +146,29 @@ public struct ArbitraryMacro: PeerMacro {
148146 ///
149147 static func getVariableType( _ type: TypeSyntax ) -> VariableType {
150148 if let optionalType = type. as ( OptionalTypeSyntax . self) , !optionalType. wrappedType. is ( MemberTypeSyntax . self) {
151- return . optional
149+ . optional
152150 } else if let optionalType = type. as ( OptionalTypeSyntax . self) , optionalType. wrappedType. is ( MemberTypeSyntax . self) {
153- return . nested( cleanType: optionalType. wrappedType)
151+ . nested( cleanType: optionalType. wrappedType)
154152 } else if isSwiftOrFoundationType ( type) {
155- return . foundation
153+ . foundation
156154 } else if type. is ( ArrayTypeSyntax . self) || type. as ( IdentifierTypeSyntax . self) ? . name. text == String . array {
157- return . array
155+ . array
158156 } else if let forceUnwrappedType = type. as ( ImplicitlyUnwrappedOptionalTypeSyntax . self) {
159- return getVariableType ( forceUnwrappedType. wrappedType)
157+ getVariableType ( forceUnwrappedType. wrappedType)
160158 } else if let functionType = type. findSyntaxInTree ( FunctionTypeSyntax . self) {
161- return . closure( cleanType: functionType)
159+ . closure( cleanType: functionType)
162160 } else if type. is ( TupleTypeSyntax . self) {
163- return . tuple
161+ . tuple
164162 } else if type. is ( DictionaryTypeSyntax . self) || type. as ( IdentifierTypeSyntax . self) ? . name. text == String . dictionary {
165- return . dictionary
163+ . dictionary
166164 } else if let type = type. as ( IdentifierTypeSyntax . self) ? . name. text, type == String . set {
167- return . set
165+ . set
168166 } else if type. is ( MemberTypeSyntax . self) {
169- return . nested( cleanType: type)
167+ . nested( cleanType: type)
170168 } else if let attributedType = type. as ( AttributedTypeSyntax . self) {
171- return getVariableType ( attributedType. baseType)
169+ getVariableType ( attributedType. baseType)
172170 } else {
173- return . custom
171+ . custom
174172 }
175173 }
176174
@@ -216,19 +214,19 @@ public struct ArbitraryMacro: PeerMacro {
216214 private static func getTypeNameFromDecl( _ decl: DeclGroupSyntax ) -> TokenSyntax ? {
217215 switch decl. kind {
218216 case . classDecl:
219- return decl. as ( ClassDeclSyntax . self) ? . name
217+ decl. as ( ClassDeclSyntax . self) ? . name
220218 case . structDecl:
221- return decl. as ( StructDeclSyntax . self) ? . name
219+ decl. as ( StructDeclSyntax . self) ? . name
222220 case . extensionDecl:
223- return decl. as ( ExtensionDeclSyntax . self) ? . extendedType. as ( IdentifierTypeSyntax . self) ? . name
221+ decl. as ( ExtensionDeclSyntax . self) ? . extendedType. as ( IdentifierTypeSyntax . self) ? . name
224222 case . actorDecl:
225- return decl. as ( ActorDeclSyntax . self) ? . name
223+ decl. as ( ActorDeclSyntax . self) ? . name
226224 case . enumDecl:
227- return decl. as ( EnumDeclSyntax . self) ? . name
225+ decl. as ( EnumDeclSyntax . self) ? . name
228226 case . protocolDecl:
229- return decl. as ( ProtocolDeclSyntax . self) ? . name
227+ decl. as ( ProtocolDeclSyntax . self) ? . name
230228 default :
231- return nil
229+ nil
232230 }
233231 }
234232}
0 commit comments