Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
MahdiBM committed Jul 19, 2024
1 parent 938094e commit 56f950e
Showing 1 changed file with 7 additions and 15 deletions.
22 changes: 7 additions & 15 deletions Sources/EnumeratorMacroImpl/Types/EParameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,34 +36,26 @@ extension EParameters: EMustacheTransformable {
func transform(_ name: String) -> Any? {
switch name {
case "names":
let names = self
.enumerated()
.map { idx, element in
element.name ?? "param\(idx + 1)"
}
let names = self.map(\.name)
let array = EArray(underlying: names)
return array
case "types":
let types = self.map(\.type)
let array = EArray(underlying: types)
return array
case "namesAndTypes":
let namesAndTypes = self
.enumerated()
.map { idx, element in
(element.name ?? "param\(idx + 1)") + ": " + element.type
}
let namesAndTypes = self.map { element in
element.name + ": " + element.type
}
let array = EArray(underlying: namesAndTypes)
return array
case "tupleValue":
if self.underlying.underlying.count == 1 {
return EArray(underlying: [underlying.underlying[0].type])
} else {
let namesAndTypes = self
.enumerated()
.map { idx, element in
(element.name ?? "param\(idx + 1)") + ": " + element.type
}
let namesAndTypes = self.map { element in
element.name + ": " + element.type
}
let array = EArray(underlying: namesAndTypes)
return array
}
Expand Down

0 comments on commit 56f950e

Please sign in to comment.