Skip to content

Commit

Permalink
Prevent unintended side-effects from the previous fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ileitch committed Dec 22, 2023
1 parent e0647b2 commit d8f4204
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Sources/PeripheryKit/Indexer/SwiftIndexer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,11 @@ public final class SwiftIndexer: Indexer {
if let sameLineCandidateDecls {
candidateDecls = sameLineCandidateDecls
} else {
// No matching declarations on the same line, default to the nearest preceding
// declaration.
// Enum case parameters are not associated with case elements. For parameters
// that exist on a line below the case statement we need to find the nearest
// preceding case.
if let line = sortedDeclLines.first(where: { $0 < ref.location.line }) {
candidateDecls = declsByLine[line] ?? []
candidateDecls = declsByLine[line]?.filter { $0.kind == .enumelement } ?? []
}
}

Expand Down

0 comments on commit d8f4204

Please sign in to comment.