@@ -52,6 +52,12 @@ const objcByCandidateSwiftBase: WeakMap<
5252 Map < string , Node [ ] >
5353> = new WeakMap ( ) ;
5454
55+ function methodNodes ( context : ResolutionContext ) : Iterable < Node > {
56+ return context . iterateNodesByKind
57+ ? context . iterateNodesByKind ( 'method' )
58+ : context . getNodesByKind ( 'method' ) ;
59+ }
60+
5561/**
5662 * Build the reverse-bridge map: for every ObjC method node in the graph,
5763 * compute the Swift base names that would auto-bridge to its selector and
@@ -118,10 +124,8 @@ function buildObjcMap(context: ResolutionContext): Map<string, Node[]> {
118124 if ( cached ) return cached ;
119125
120126 const map = new Map < string , Node [ ] > ( ) ;
121- const objcMethods = context
122- . getNodesByKind ( 'method' )
123- . filter ( ( n ) => n . language === 'objc' ) ;
124- for ( const node of objcMethods ) {
127+ for ( const node of methodNodes ( context ) ) {
128+ if ( node . language !== 'objc' ) continue ;
125129 const candidates = swiftBaseNamesForObjcSelector ( node . name ) ;
126130 for ( const c of candidates ) {
127131 // Skip the trivial case where the Swift base name equals the ObjC
@@ -227,9 +231,15 @@ function resolveObjcCallToSwift(
227231
228232 const candidates = swiftBaseNamesForObjcSelector ( rawSelector ) ;
229233 for ( const candidate of candidates ) {
230- const matches = context
231- . getNodesByName ( candidate )
232- . filter ( ( n ) => n . language === 'swift' && ( n . kind === 'method' || n . kind === 'function' ) ) ;
234+ const matches = context . getNodesByNameFiltered
235+ ? context . getNodesByNameFiltered ( candidate , {
236+ language : 'swift' ,
237+ kinds : [ 'method' , 'function' ] ,
238+ limit : 2000 ,
239+ } )
240+ : context
241+ . getNodesByName ( candidate )
242+ . filter ( ( n ) => n . language === 'swift' && ( n . kind === 'method' || n . kind === 'function' ) ) ;
233243 for ( const match of matches ) {
234244 const window = declarationSourceWindow ( match , context ) ;
235245 if ( isObjcExposed ( window ) ) {
0 commit comments