Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove workaround for unsupported Swift versions causing performance issues #796

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading