Skip to content

Commit

Permalink
Remove workaround for unsupported Swift versions causing performance …
Browse files Browse the repository at this point in the history
…issues (#796)
  • Loading branch information
ileitch authored Aug 20, 2024
1 parent a04e290 commit 35dfcdb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
18 changes: 0 additions & 18 deletions Sources/SourceGraph/Mutators/ExtensionReferenceBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,9 @@ final class ExtensionReferenceBuilder: SourceGraphMutator {
guard let extendedDeclaration = graph.explicitDeclaration(withUsr: extendedTypeReference.usr) else {
// This is an extension on an external type and cannot be folded.
graph.markRetained(extensionDeclaration)
referenceExtendedTypeAliases(of: extendedTypeReference, from: extensionDeclaration)
continue
}

referenceExtendedTypeAliases(of: extendedTypeReference, from: extendedDeclaration)

// Don't fold protocol extensions as they must be treated differently.
guard kind != .extensionProtocol else { continue }

Expand All @@ -48,19 +45,4 @@ final class ExtensionReferenceBuilder: SourceGraphMutator {
graph.remove(extensionDeclaration)
}
}

private func referenceExtendedTypeAliases(of extendedTypeReference: Reference, from extensionDeclaration: Declaration) {
// Extensions on type aliases reference the existing type, not the alias.
// We need to find the typealias and build a reference to it.
let extendedTypeReferences = graph.allReferencesByUsr[extendedTypeReference.usr, default: []]

for reference in extendedTypeReferences {
guard let aliasDecl = reference.parent, aliasDecl.kind == .typealias else { continue }
for usr in aliasDecl.usrs {
let aliasReference = Reference(kind: .typealias, usr: usr, location: extensionDeclaration.location)
aliasReference.name = aliasDecl.name
graph.add(aliasReference, from: extensionDeclaration)
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// periphery:ignore:all

import Foundation
import SourceGraph

final class SourceGraphDebugger {
private let graph: SourceGraph
Expand Down

0 comments on commit 35dfcdb

Please sign in to comment.