Skip to content

Commit

Permalink
Remove redundant public modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
andooown committed Oct 21, 2023
1 parent 524389a commit 4d50233
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion Sources/LexiconGenKit/Generator/Generator+Builders.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public extension Generator {
if let parameters = method.parameters {
try objectSyntax(
name: "Parameters",
modifiers: ["public"],
inheritances: ["XRPCRequestParametersConvertible"],
object: parameters
) {
Expand Down Expand Up @@ -111,6 +112,7 @@ public extension Generator {
case .object(let object):
try objectSyntax(
name: "Input",
modifiers: ["public"],
inheritances: ["Encodable"],
object: object
)
Expand All @@ -124,6 +126,7 @@ public extension Generator {
case .object(let object):
try objectSyntax(
name: "Output",
modifiers: ["public"],
inheritances: ["Decodable", "Hashable"],
object: object
)
Expand Down Expand Up @@ -175,13 +178,15 @@ public extension Generator {
@MemberBlockItemListBuilder
static func objectSyntax(
name: String,
modifiers: [String] = [],
inheritances: [String] = [],
object: LexiconObjectSchema<LexiconAbsoluteReference>,
@MemberBlockItemListBuilder additionalBody: () throws -> MemberBlockItemListSyntax = { MemberBlockItemListSyntax([]) }
) throws -> MemberBlockItemListSyntax {
let modifier = modifiers.isEmpty ? "" : modifiers.joined(separator: " ") + " "
let inherit = inheritances.isEmpty ? "" : ": " + inheritances.joined(separator: ", ")

try StructDeclSyntax("public struct \(raw: name)\(raw: inherit)") {
try StructDeclSyntax("\(raw: modifier)struct \(raw: name)\(raw: inherit)") {
try Generator.objectPropertiesSyntax(object.properties, required: object.required)
Generator.objectInitializerSyntax(object.properties, required: object.required)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ final class GeneratorBuildersTests: XCTestCase {
)
).formatted().description,
"""
public struct Foo: UnionCodable, Hashable {
struct Foo: UnionCodable, Hashable {
@Indirect
public var optionalValue: String?
@Indirect
Expand Down Expand Up @@ -216,7 +216,7 @@ final class GeneratorBuildersTests: XCTestCase {
)
).formatted().description,
"""
public struct Foo: UnionCodable, Hashable {
struct Foo: UnionCodable, Hashable {
@Indirect
public var optionalValue: String?
@Indirect
Expand Down Expand Up @@ -408,7 +408,7 @@ final class GeneratorBuildersTests: XCTestCase {
}
).formatted().description,
"""
public struct Object: Protocol1, Protocol2 {
struct Object: Protocol1, Protocol2 {
@Indirect
public var bar: Int?
@Indirect
Expand Down

0 comments on commit 4d50233

Please sign in to comment.