diff options
author | Aleksey Kladov <[email protected]> | 2019-12-20 15:26:49 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-12-20 15:52:02 +0000 |
commit | e6b1194f2f33722f0cfed32465f778b256162626 (patch) | |
tree | 7b88847299a5f628a3677f0475a7e80b4afd9e9f /crates/ra_hir_def/src/nameres/collector.rs | |
parent | 4f9e3f3632f3c03d44a23daf0d9ce4966816af86 (diff) |
Move some code to scope
Diffstat (limited to 'crates/ra_hir_def/src/nameres/collector.rs')
-rw-r--r-- | crates/ra_hir_def/src/nameres/collector.rs | 28 |
1 files changed, 2 insertions, 26 deletions
diff --git a/crates/ra_hir_def/src/nameres/collector.rs b/crates/ra_hir_def/src/nameres/collector.rs index 17c7e691e..95c499ec9 100644 --- a/crates/ra_hir_def/src/nameres/collector.rs +++ b/crates/ra_hir_def/src/nameres/collector.rs | |||
@@ -467,34 +467,10 @@ where | |||
467 | // prevent stack overflows (but this shouldn't be possible) | 467 | // prevent stack overflows (but this shouldn't be possible) |
468 | panic!("infinite recursion in glob imports!"); | 468 | panic!("infinite recursion in glob imports!"); |
469 | } | 469 | } |
470 | let module_items = &mut self.def_map.modules[module_id].scope; | 470 | let scope = &mut self.def_map.modules[module_id].scope; |
471 | let mut changed = false; | 471 | let mut changed = false; |
472 | for (name, res) in resolutions { | 472 | for (name, res) in resolutions { |
473 | let existing = module_items.items.entry(name.clone()).or_default(); | 473 | changed |= scope.push_res(name.clone(), res, import); |
474 | |||
475 | if existing.def.types.is_none() && res.def.types.is_some() { | ||
476 | existing.def.types = res.def.types; | ||
477 | existing.import = import.or(res.import); | ||
478 | changed = true; | ||
479 | } | ||
480 | if existing.def.values.is_none() && res.def.values.is_some() { | ||
481 | existing.def.values = res.def.values; | ||
482 | existing.import = import.or(res.import); | ||
483 | changed = true; | ||
484 | } | ||
485 | if existing.def.macros.is_none() && res.def.macros.is_some() { | ||
486 | existing.def.macros = res.def.macros; | ||
487 | existing.import = import.or(res.import); | ||
488 | changed = true; | ||
489 | } | ||
490 | |||
491 | if existing.def.is_none() | ||
492 | && res.def.is_none() | ||
493 | && existing.import.is_none() | ||
494 | && res.import.is_some() | ||
495 | { | ||
496 | existing.import = res.import; | ||
497 | } | ||
498 | } | 474 | } |
499 | 475 | ||
500 | if !changed { | 476 | if !changed { |