diff options
Diffstat (limited to 'src/hir/crate_post_load.cpp')
-rw-r--r-- | src/hir/crate_post_load.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
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 <hir/hir.hpp> +#include <macro_rules/macro_rules.hpp> // 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; + } + } +} + |