Skip to content

Commit cf4bcbd

Browse files
simplify lookupIdentifier using allCases lookup
1 parent 82b137e commit cf4bcbd

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

Sources/SymbolKit/SymbolGraph/Symbol/Symbol+KindIdentifier.swift

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -68,28 +68,7 @@ extension SymbolGraph.Symbol {
6868
/// - Parameter identifier: The identifier string to check.
6969
/// - Returns: The matching `KindIdentifier` case, or `nil` if there was no match.
7070
private static func lookupIdentifier(identifier: String) -> KindIdentifier? {
71-
switch identifier {
72-
case "associatedtype": return .associatedtype
73-
case "class": return .class
74-
case "deinit": return .deinit
75-
case "enum": return .enum
76-
case "enum.case": return .case
77-
case "func": return .func
78-
case "func.op": return .operator
79-
case "init": return .`init`
80-
case "method": return .method
81-
case "property": return .property
82-
case "protocol": return .protocol
83-
case "struct": return .struct
84-
case "subscript": return .subscript
85-
case "type.method": return .typeMethod
86-
case "type.property": return .typeProperty
87-
case "type.subscript": return .typeSubscript
88-
case "typealias": return .typealias
89-
case "var": return .var
90-
case "module": return .module
91-
default: return nil
92-
}
71+
allCases.first(where: { $0.identifier == identifier })
9372
}
9473

9574
/// Compares the given identifier against the known default symbol kinds, and returns whether it matches one.

0 commit comments

Comments
 (0)