Skip to content

Commit 4a86e81

Browse files
committed
[sourcekitd] Fix registry assertion
1 parent b4409ff commit 4a86e81

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

Sources/SourceKitD/SourceKitDRegistry.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,20 @@ public final class SourceKitDRegistry {
6969
lock.withLock {
7070
let existing = active.removeValue(forKey: key)
7171
if let existing = existing {
72-
assert(self.cemetary[key] == nil)
72+
assert(self.cemetary[key]?.value == nil)
7373
cemetary[key] = WeakSourceKitD(value: existing)
7474
}
7575
return existing
7676
}
7777
}
78+
79+
/// Remove all SourceKitD instances, including weak ones.
80+
public func clear() {
81+
lock.withLock {
82+
active.removeAll()
83+
cemetary.removeAll()
84+
}
85+
}
7886
}
7987

8088
struct WeakSourceKitD {

0 commit comments

Comments
 (0)