From 52370f0a5abacb892b6a7bc24df9c1d232269b4c Mon Sep 17 00:00:00 2001 From: John Hodge Date: Mon, 29 Aug 2016 16:47:26 +0800 Subject: HIR Deserialise - Hackily set crate names, clean up a little --- src/hir/crate_post_load.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/hir/crate_post_load.cpp (limited to 'src/hir/crate_post_load.cpp') diff --git a/src/hir/crate_post_load.cpp b/src/hir/crate_post_load.cpp new file mode 100644 index 00000000..81c5b029 --- /dev/null +++ b/src/hir/crate_post_load.cpp @@ -0,0 +1,26 @@ +/* + * MRustC - Rust Compiler + * - By John Hodge (Mutabah/thePowersGang) + * + * hir/crate_post_load.cpp + * - Updates the crate after deserialising + */ +#include +#include // Used to update the crate name + + +void HIR::Crate::post_load_update(const ::std::string& name) +{ + // TODO: Do a pass across m_hir that + // 1. Updates all absolute paths with the crate name + // 2. Sets binding pointers where required + // 3. Updates macros with the crate name + for(auto& mac : m_exported_macros) + { + if( mac.second->m_source_crate == "" ) + { + mac.second->m_source_crate = name; + } + } +} + -- cgit v1.2.3