summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-08-24 18:35:33 +0800
committerJohn Hodge <tpg@mutabah.net>2016-08-24 18:35:33 +0800
commitc4e63ec4901e5083e78cb8a2c0839a4040fa041a (patch)
treebb600ef7afcb61da030ef17bfb8c7a5d8d880615 /src
parent79b77632259914f80a96df166bb3bef2cf7ecf55 (diff)
downloadmrust-c4e63ec4901e5083e78cb8a2c0839a4040fa041a.tar.gz
MIR Gen - Handle StructConstant and StructConstructor items
Diffstat (limited to 'src')
-rw-r--r--src/mir/from_hir.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/mir/from_hir.cpp b/src/mir/from_hir.cpp
index 07fb2ade..ede4ba88 100644
--- a/src/mir/from_hir.cpp
+++ b/src/mir/from_hir.cpp
@@ -1193,7 +1193,11 @@ namespace {
m_builder.set_result( node.span(), ::MIR::LValue::make_Static(node.m_path.clone()) );
),
(StructConstant,
- BUG(sp, "StructConstant as PathValue");
+ // TODO: Why is this still a PathValue?
+ m_builder.set_result( node.span(), ::MIR::RValue::make_Struct({
+ pe.clone(),
+ {}
+ }) );
),
(Function,
// TODO: Obtain function type for this function (i.e. a type that is specifically for this function)
@@ -1213,7 +1217,10 @@ namespace {
m_builder.set_result( sp, mv$(tmp) );
),
(StructConstructor,
- BUG(sp, "StructConstructor as PathValue");
+ // TODO: Ideally, the creation of the wrapper function would happen somewhere before this?
+ auto tmp = m_builder.new_temporary( node.m_res_type );
+ m_builder.push_stmt_assign( sp, tmp.clone(), ::MIR::Constant::make_ItemAddr(node.m_path.clone()) );
+ m_builder.set_result( sp, mv$(tmp) );
)
)
),