diff options
author | John Hodge <tpg@mutabah.net> | 2016-08-09 23:17:00 +0800 |
---|---|---|
committer | John Hodge <tpg@mutabah.net> | 2016-08-09 23:17:00 +0800 |
commit | 12f999b58b452223b9cf58bc85be3d83bb661e7c (patch) | |
tree | 443b8fbd21e1dc9957387efec030c45a75e3ad47 /src/mir/mir.cpp | |
parent | 772cf236fe8e2634ca40f2399cf0eb31bc0c396a (diff) | |
download | mrust-12f999b58b452223b9cf58bc85be3d83bb661e7c.tar.gz |
MIR - Construction code completed, but untested (and some stubs)
Diffstat (limited to 'src/mir/mir.cpp')
-rw-r--r-- | src/mir/mir.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/mir/mir.cpp b/src/mir/mir.cpp new file mode 100644 index 00000000..28410c3c --- /dev/null +++ b/src/mir/mir.cpp @@ -0,0 +1,37 @@ +/* + * MRustC - Rust Compiler + * - By John Hodge (Mutabah/thePowersGang) + * + * mir/mir.cpp + * - MIR (Middle Intermediate Representation) definitions + */ +#include <mir/mir.hpp> + +::MIR::LValue MIR::LValue::clone() const +{ + TU_MATCHA( (*this), (e), + (Variable, return LValue(e); ), + (Temporary, return LValue(e); ), + (Argument, return LValue(e); ), + (Static, return LValue(e.clone()); ), + (Return, return LValue(e); ), + (Field, return LValue::make_Field({ + box$( e.val->clone() ), + e.field_index + }); ), + (Deref, return LValue::make_Deref({ + box$( e.val->clone() ) + }); ), + (Index, return LValue::make_Index({ + box$( e.val->clone() ), + box$( e.idx->clone() ) + }); ), + (Downcast, return LValue::make_Downcast({ + box$( e.val->clone() ), + e.variant_index + }); ) + ) + throw ""; +} + + |