Skip to content

Commit

Permalink
Merge pull request #11 from SwingDev/task/improve-needsInjector-macro
Browse files Browse the repository at this point in the history
Append Injector even if class doesn't have Impl in name.
  • Loading branch information
ddanielczyk authored Jan 3, 2024
2 parents 072f3c6 + 70508ff commit dc73e46
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public struct NeedsInjectorMacro: MemberMacro {
}

let className = classDeclaration.name.text
let injectorProtocolType = className.replacingOccurrences(of: "Impl", with: "Injector")
let injectorProtocolType = className.replacingOccurrences(of: "Impl", with: "") + "Injector"

let noLet = declaration.memberBlock.members.first(where: { $0.decl.as(VariableDeclSyntax.self)?.bindings.first(where: { "\($0.pattern)" == "injector" }) != nil}) != nil
let noConstructor = declaration.memberBlock.members.first(where: { $0.decl.as(InitializerDeclSyntax.self) != nil})?.decl.as(InitializerDeclSyntax.self)!.signature.parameterClause.parameters.first?.firstName.text == "injector"
Expand Down

0 comments on commit dc73e46

Please sign in to comment.