diff options
author | John Hodge <tpg@mutabah.net> | 2016-12-03 08:35:33 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-12-03 08:35:33 +0800 |
commit | 3d4b0c406c11a2f98ea258e0762736fca119b76a (patch) | |
tree | f2d9a6e2af70e7821ea1ec3809559be704cf43ec /src/mir/from_hir.cpp | |
parent | 55bc4a9e019b1b5e51fec58030a30ea9146de45c (diff) | |
download | mrust-3d4b0c406c11a2f98ea258e0762736fca119b76a.tar.gz |
HIR/MIR - Vtable generation working well
Diffstat (limited to 'src/mir/from_hir.cpp')
-rw-r--r-- | src/mir/from_hir.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp index 7ded3cb4..a763b42c 100644 --- a/src/mir/from_hir.cpp +++ b/src/mir/from_hir.cpp @@ -1376,10 +1376,9 @@ namespace { const auto& trait = *te.m_trait.m_trait_ptr; // 1. Get the vtable index for this function - unsigned int vtable_idx = trait.m_values.at( pe.item ).vtable_ofs; - if( vtable_idx == ~0u ) { + if( trait.m_value_indexes.count(pe.item) == 0 ) BUG(sp, "Calling method '" << pe.item << "' of " << pe.trait << " which isn't in the vtable"); - } + unsigned int vtable_idx = trait.m_value_indexes.at( pe.item ); // 2. Load from the vtable auto vtable_rval = ::MIR::RValue::make_DstMeta({ |