Skip to content

Commit bdcd582

Browse files
committed
Eliminate redundant precondition checking
Thanks to Rintaro for pointing this out.
1 parent 4b4a2ca commit bdcd582

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

Sources/SwiftCompilerPluginMessageHandling/Macros.swift

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,7 @@ extension CompilerPluginMessageHandler {
4949

5050
let macroRole: MacroRole
5151
if let pluginMacroRole {
52-
switch pluginMacroRole {
53-
case .expression: macroRole = .expression
54-
case .declaration: macroRole = .declaration
55-
case .codeItem: macroRole = .codeItem
56-
57-
case .accessor, .conformance, .member, .memberAttribute, .peer:
58-
throw MacroExpansionError.invalidMacroRole(pluginMacroRole)
59-
}
52+
macroRole = MacroRole(messageMacroRole: pluginMacroRole)
6053
} else {
6154
macroRole = try inferFreestandingMacroRole(definition: macroDefinition)
6255
}

0 commit comments

Comments
 (0)