Skip to content

Commit b859160

Browse files
committed
Add doc comment to forEachSymbolOccurrence
1 parent a335a47 commit b859160

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Sources/IndexStoreDB/IndexStoreDB.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,18 @@ public final class IndexStoreDB {
153153
return indexstoredb_index_remove_unit_out_file_paths(impl, cPaths, cPaths.count, waitForProcessing)
154154
}
155155

156+
/// Invoke `body` with every occurrance of `usr` in one of the specified roles.
157+
///
158+
/// Stop iteration if `body` returns `false`.
159+
/// - Returns: `false` if iteration was terminated by `body` returning `true` or `true` if iteration finished.
156160
@discardableResult
157161
public func forEachSymbolOccurrence(byUSR usr: String, roles: SymbolRole, _ body: @escaping (SymbolOccurrence) -> Bool) -> Bool {
158162
return indexstoredb_index_symbol_occurrences_by_usr(impl, usr, roles.rawValue) { occur in
159163
return body(SymbolOccurrence(occur))
160164
}
161165
}
162166

167+
/// Returns all occurrences of `usr` in one of the specified roles.
163168
public func occurrences(ofUSR usr: String, roles: SymbolRole) -> [SymbolOccurrence] {
164169
var result: [SymbolOccurrence] = []
165170
forEachSymbolOccurrence(byUSR: usr, roles: roles) { occur in

0 commit comments

Comments
 (0)