diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-02-25 05:23:50 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-02-26 00:37:27 +0000 |
| commit | 07957ffb2eace00019c2bb07fe5fc03191a476c7 (patch) | |
| tree | d5e56c6fce8dc284331753a90d61b4d2ad2a5e72 /src | |
| parent | 8f32fdecfbc56b7ddd39a418632a1149792e9033 (diff) | |
| download | rust-07957ffb2eace00019c2bb07fe5fc03191a476c7.tar.gz rust-07957ffb2eace00019c2bb07fe5fc03191a476c7.zip | |
Refactor Module's field extern_crate_did: Option<DefId> to extern_crate_id: Option<NodeId>
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_resolve/build_reduced_graph.rs | 8 | ||||
| -rw-r--r-- | src/librustc_resolve/lib.rs | 14 |
2 files changed, 10 insertions, 12 deletions
diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index 385fae46cba..e59960ed4bd 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -293,10 +293,8 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { self.external_exports.insert(def_id); let parent_link = ModuleParentLink(parent, name); let def = Def::Mod(def_id); - let local_def_id = self.ast_map.local_def_id(item.id); - let external_module = - self.new_extern_crate_module(parent_link, def, is_public, local_def_id); - self.define(parent, name, TypeNS, (external_module, sp)); + let module = self.new_extern_crate_module(parent_link, def, is_public, item.id); + self.define(parent, name, TypeNS, (module, sp)); if is_public { let export = Export { name: name, def_id: def_id }; @@ -306,7 +304,7 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> { } } - self.build_reduced_graph_for_external_crate(external_module); + self.build_reduced_graph_for_external_crate(module); } parent } diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 2897714d574..47e4da53f33 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -807,9 +807,9 @@ pub struct ModuleS<'a> { def: Option<Def>, is_public: bool, - // If the module is an extern crate, `def` is root of the external crate and `extern_crate_did` - // is the DefId of the local `extern crate` item (otherwise, `extern_crate_did` is None). - extern_crate_did: Option<DefId>, + // If the module is an extern crate, `def` is root of the external crate and `extern_crate_id` + // is the NodeId of the local `extern crate` item (otherwise, `extern_crate_id` is None). + extern_crate_id: Option<NodeId>, resolutions: RefCell<HashMap<(Name, Namespace), NameResolution<'a>>>, unresolved_imports: RefCell<Vec<ImportDirective>>, @@ -856,7 +856,7 @@ impl<'a> ModuleS<'a> { parent_link: parent_link, def: def, is_public: is_public, - extern_crate_did: None, + extern_crate_id: None, resolutions: RefCell::new(HashMap::new()), unresolved_imports: RefCell::new(Vec::new()), module_children: RefCell::new(NodeMap()), @@ -1039,7 +1039,7 @@ impl<'a> NameBinding<'a> { } fn is_extern_crate(&self) -> bool { - self.module().and_then(|module| module.extern_crate_did).is_some() + self.module().and_then(|module| module.extern_crate_id).is_some() } fn is_import(&self) -> bool { @@ -1237,10 +1237,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> { parent_link: ParentLink<'a>, def: Def, is_public: bool, - local_def: DefId) + local_node_id: NodeId) -> Module<'a> { let mut module = ModuleS::new(parent_link, Some(def), false, is_public); - module.extern_crate_did = Some(local_def); + module.extern_crate_id = Some(local_node_id); self.arenas.modules.alloc(module) } |
