summaryrefslogtreecommitdiff
path: root/src/hir/crate_post_load.cpp
blob: a0733987ceb1f815b98d8217de48e42486c60691 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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 RcString& 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;
        }
    }
}