From 12f999b58b452223b9cf58bc85be3d83bb661e7c Mon Sep 17 00:00:00 2001 From: John Hodge Date: Tue, 9 Aug 2016 23:17:00 +0800 Subject: MIR - Construction code completed, but untested (and some stubs) --- src/mir/mir.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/mir/mir.cpp (limited to 'src/mir/mir.cpp') 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::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 ""; +} + + -- cgit v1.2.3