Skip to content

Commit

Permalink
chore(deps): upgrade swift-syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
EnesKaraosman committed Nov 12, 2024
1 parent fc60a28 commit e2353f8
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 22 deletions.
4 changes: 2 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-syntax.git",
"state" : {
"revision" : "cb53fa1bd3219b0b23ded7dfdd3b2baff266fd25",
"version" : "600.0.0"
"revision" : "0687f71944021d616d34d922343dcef086855920",
"version" : "600.0.1"
}
}
],
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ let package = Package(
],
dependencies: [
// Depend on the Swift 5.9 release of SwiftSyntax
.package(url: "https://github.com/apple/swift-syntax.git", from: "600.0.0"),
.package(url: "https://github.com/apple/swift-syntax.git", from: "600.0.1"),
.package(url: "https://github.com/vadymmarkov/Fakery", from: "5.1.0")
],
targets: [
Expand Down
13 changes: 3 additions & 10 deletions Sources/LoremSwiftifyMacros/LoremSwiftifyMacro.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ public enum LoremSwiftifyMacro: ExtensionMacro {
if !declaration.is(StructDeclSyntax.self)
&& !declaration.is(ClassDeclSyntax.self)
&& !declaration.is(EnumDeclSyntax.self) {

context.diagnose(.init(node: declaration, message: LoremSwiftifyMacroDiagnostic.unsupportedType))

return []
throw LoremSwiftifyMacroDiagnostic.unsupportedType
}

let extensionDecl = try ExtensionDeclSyntax(
Expand All @@ -45,18 +42,14 @@ public enum LoremSwiftifyMacro: ExtensionMacro {
in: context,
type: type
)
}

if let structDecl = declaration.as(StructDeclSyntax.self) {
} else if let structDecl = declaration.as(StructDeclSyntax.self) {
try LoremSwiftifyStruct.expansion(
of: node,
providingMembersOf: structDecl,
in: context,
type: type
)
}

if let enumDecl = declaration.as(EnumDeclSyntax.self) {
} else if let enumDecl = declaration.as(EnumDeclSyntax.self) {
try LoremSwiftifyEnum.expansion(
of: node,
providingMembersOf: enumDecl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class LoremSwiftifyClass {
type: some SwiftSyntax.TypeSyntaxProtocol
) throws -> DeclSyntax {
if declaration.memberBlock.members.isEmpty {
context.diagnose(.init(node: declaration, message: LoremSwiftifyMacroDiagnostic.noMemberToMock))

return ""
throw LoremSwiftifyMacroDiagnostic.noMemberToMock
}

return try LoremSwiftifyMacroParsingShared.handleClassOrStructDeclSyntax(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ class LoremSwiftifyEnum {
}

if cases.isEmpty {
context.diagnose(.init(node: declaration, message: LoremSwiftifyMacroDiagnostic.noEnumCase))

return ""
throw LoremSwiftifyMacroDiagnostic.noEnumCase
}

let caseExpr = generateEnumCreationFunctionBody(for: cases)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ class LoremSwiftifyStruct {
type: some SwiftSyntax.TypeSyntaxProtocol
) throws -> DeclSyntax {
if declaration.memberBlock.members.isEmpty {
context.diagnose(.init(node: declaration, message: LoremSwiftifyMacroDiagnostic.noMemberToMock))

return ""
throw LoremSwiftifyMacroDiagnostic.noMemberToMock
}

return try LoremSwiftifyMacroParsingShared.handleClassOrStructDeclSyntax(
Expand Down

0 comments on commit e2353f8

Please sign in to comment.