summaryrefslogtreecommitdiff
path: root/src/mir/mir.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mir/mir.cpp')
-rw-r--r--src/mir/mir.cpp37
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 "";
+}
+
+