diff options
author | John Hodge <tpg@mutabah.net> | 2016-08-29 16:47:26 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-08-29 16:47:26 +0800 |
commit | 52370f0a5abacb892b6a7bc24df9c1d232269b4c (patch) | |
tree | 7ac34fed7ad08a0cd9617ac18877d0b3d661ab82 /src/hir/crate_post_load.cpp | |
parent | bcbabdf4ef468bc7a45732354e32b1baf5d95eee (diff) | |
download | mrust-52370f0a5abacb892b6a7bc24df9c1d232269b4c.tar.gz |
HIR Deserialise - Hackily set crate names, clean up a little
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; + } + } +} + |