@@ -291,7 +291,7 @@ impl Module {
291
291
self . current_lexical_scope_id = parent_scope_id. unwrap ( ) ; // panics if pops do not match pushes
292
292
}
293
293
294
- pub fn walk_scope_chain < T > (
294
+ pub fn walk_scope_chain_early_return < T > (
295
295
& self ,
296
296
mut f : impl FnMut ( & LexicalScope ) -> Result < Option < T > , ErrorEmitted > ,
297
297
) -> Result < Option < T > , ErrorEmitted > {
@@ -310,23 +310,16 @@ impl Module {
310
310
Ok ( None )
311
311
}
312
312
313
- pub fn walk_scope_chain_mut < T > (
314
- & mut self ,
315
- mut f : impl FnMut ( & mut LexicalScope ) -> Result < Option < T > , ErrorEmitted > ,
316
- ) -> Result < Option < T > , ErrorEmitted > {
317
- let mut lexical_scope_opt = Some ( self . current_lexical_scope_mut ( ) ) ;
313
+ pub fn walk_scope_chain ( & self , mut f : impl FnMut ( & LexicalScope ) ) {
314
+ let mut lexical_scope_opt = Some ( self . current_lexical_scope ( ) ) ;
318
315
while let Some ( lexical_scope) = lexical_scope_opt {
319
- let result = f ( lexical_scope) ?;
320
- if let Some ( result) = result {
321
- return Ok ( Some ( result) ) ;
322
- }
316
+ f ( lexical_scope) ;
323
317
if let Some ( parent_scope_id) = lexical_scope. parent {
324
- lexical_scope_opt = self . get_lexical_scope_mut ( parent_scope_id) ;
318
+ lexical_scope_opt = self . get_lexical_scope ( parent_scope_id) ;
325
319
} else {
326
320
lexical_scope_opt = None ;
327
321
}
328
322
}
329
- Ok ( None )
330
323
}
331
324
332
325
pub fn get_items_for_type (
@@ -344,7 +337,7 @@ impl Module {
344
337
symbol : & Ident ,
345
338
) -> Result < ( ResolvedDeclaration , ModulePathBuf ) , ErrorEmitted > {
346
339
let mut last_handler = Handler :: default ( ) ;
347
- let ret = self . walk_scope_chain ( |lexical_scope| {
340
+ let ret = self . walk_scope_chain_early_return ( |lexical_scope| {
348
341
last_handler = Handler :: default ( ) ;
349
342
Ok ( lexical_scope
350
343
. items
0 commit comments