resolve: factor out resolve imports to its own module
This commit is contained in:
parent
432011d143
commit
2df1ceb001
src/librustc_resolve
@ -14,16 +14,17 @@
|
||||
//! any imports resolved.
|
||||
|
||||
use {DefModifiers, PUBLIC, IMPORTABLE};
|
||||
use ImportDirective;
|
||||
use ImportDirectiveSubclass::{self, SingleImport, GlobImport};
|
||||
use ImportResolution;
|
||||
use resolve_imports::ImportDirective;
|
||||
use resolve_imports::ImportDirectiveSubclass::{self, SingleImport, GlobImport};
|
||||
use resolve_imports::ImportResolution;
|
||||
use Module;
|
||||
use ModuleKind::*;
|
||||
use Namespace::{TypeNS, ValueNS};
|
||||
use NameBindings;
|
||||
use {names_to_string, module_to_string};
|
||||
use ParentLink::{self, ModuleParentLink, BlockParentLink};
|
||||
use Resolver;
|
||||
use Shadowable;
|
||||
use resolve_imports::Shadowable;
|
||||
use TypeNsDef;
|
||||
|
||||
use self::DuplicateCheckingMode::*;
|
||||
@ -381,7 +382,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
|
||||
false,
|
||||
true));
|
||||
debug!("(build reduced graph for item) found extern `{}`",
|
||||
self.module_to_string(&*external_module));
|
||||
module_to_string(&*external_module));
|
||||
self.check_for_conflicts_between_external_crates(&**parent, name, sp);
|
||||
parent.external_module_children.borrow_mut()
|
||||
.insert(name, external_module.clone());
|
||||
@ -836,7 +837,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
|
||||
/// Builds the reduced graph rooted at the given external module.
|
||||
fn populate_external_module(&mut self, module: &Rc<Module>) {
|
||||
debug!("(populating external module) attempting to populate {}",
|
||||
self.module_to_string(&**module));
|
||||
module_to_string(&**module));
|
||||
|
||||
let def_id = match module.def_id.get() {
|
||||
None => {
|
||||
@ -903,7 +904,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
|
||||
match subclass {
|
||||
SingleImport(target, _) => {
|
||||
debug!("(building import directive) building import directive: {}::{}",
|
||||
self.names_to_string(&module_.imports.borrow().last().unwrap().module_path),
|
||||
names_to_string(&module_.imports.borrow().last().unwrap().module_path),
|
||||
token::get_name(target));
|
||||
|
||||
let mut import_resolutions = module_.import_resolutions.borrow_mut();
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -22,6 +22,7 @@ use {Module, NameBindings, Resolver};
|
||||
use Namespace::{self, TypeNS, ValueNS};
|
||||
|
||||
use build_reduced_graph;
|
||||
use module_to_string;
|
||||
|
||||
use rustc::middle::def::Export;
|
||||
use syntax::ast;
|
||||
@ -60,19 +61,19 @@ impl<'a, 'b, 'tcx> ExportRecorder<'a, 'b, 'tcx> {
|
||||
// OK. Continue.
|
||||
debug!("(recording exports for module subtree) recording \
|
||||
exports for local module `{}`",
|
||||
self.module_to_string(&*module_));
|
||||
module_to_string(&*module_));
|
||||
}
|
||||
None => {
|
||||
// Record exports for the root module.
|
||||
debug!("(recording exports for module subtree) recording \
|
||||
exports for root module `{}`",
|
||||
self.module_to_string(&*module_));
|
||||
module_to_string(&*module_));
|
||||
}
|
||||
Some(_) => {
|
||||
// Bail out.
|
||||
debug!("(recording exports for module subtree) not recording \
|
||||
exports for `{}`",
|
||||
self.module_to_string(&*module_));
|
||||
module_to_string(&*module_));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
1021
src/librustc_resolve/resolve_imports.rs
Normal file
1021
src/librustc_resolve/resolve_imports.rs
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user