summaryrefslogtreecommitdiff
path: root/src/trans/monomorphise.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/trans/monomorphise.cpp')
-rw-r--r--src/trans/monomorphise.cpp40
1 files changed, 8 insertions, 32 deletions
diff --git a/src/trans/monomorphise.cpp b/src/trans/monomorphise.cpp
index 6c331d9c..b5099918 100644
--- a/src/trans/monomorphise.cpp
+++ b/src/trans/monomorphise.cpp
@@ -15,38 +15,14 @@
namespace {
::MIR::LValue monomorph_LValue(const ::StaticTraitResolve& resolve, const Trans_Params& params, const ::MIR::LValue& tpl)
{
- TU_MATCHA( (tpl), (e),
- (Return, return e; ),
- (Argument, return e; ),
- (Local, return e; ),
- (Static,
- return box$(params.monomorph(resolve, *e));
- ),
- (Field,
- return ::MIR::LValue::make_Field({
- box$(monomorph_LValue(resolve, params, *e.val)),
- e.field_index
- });
- ),
- (Deref,
- return ::MIR::LValue::make_Deref({
- box$(monomorph_LValue(resolve, params, *e.val))
- });
- ),
- (Index,
- return ::MIR::LValue::make_Index({
- box$(monomorph_LValue(resolve, params, *e.val)),
- box$(monomorph_LValue(resolve, params, *e.idx))
- });
- ),
- (Downcast,
- return ::MIR::LValue::make_Downcast({
- box$(monomorph_LValue(resolve, params, *e.val)),
- e.variant_index
- });
- )
- )
- throw "";
+ if( tpl.m_root.is_Static() )
+ {
+ return ::MIR::LValue( ::MIR::LValue::Storage::new_Static(params.monomorph(resolve, tpl.m_root.as_Static())), tpl.m_wrappers );
+ }
+ else
+ {
+ return tpl.clone();
+ }
}
::MIR::Constant monomorph_Constant(const ::StaticTraitResolve& resolve, const Trans_Params& params, const ::MIR::Constant& tpl)
{