summaryrefslogtreecommitdiff
path: root/src/trans/monomorphise.cpp
diff options
context:
space:
mode:
authorJohn Hodge (bugs) <tpg@mutabah.net>2017-07-06 17:41:10 +0800
committerJohn Hodge (bugs) <tpg@mutabah.net>2017-07-06 17:41:10 +0800
commit48e2c4973d5401c9f7d0ee2bac22ac6015744961 (patch)
treeb93fb21b85343633e2d0c00c42ea7a388bb6f883 /src/trans/monomorphise.cpp
parentce3d36a90b9efd11c94f9084b5e727d65b6509a7 (diff)
parentc4e88b3c49736e71534c918a83956885c052beb8 (diff)
downloadmrust-48e2c4973d5401c9f7d0ee2bac22ac6015744961.tar.gz
Merge branch 'master' of https://github.com/thepowersgang/mrustc
# Conflicts: # src/trans/codegen_c.cpp
Diffstat (limited to 'src/trans/monomorphise.cpp')
-rw-r--r--src/trans/monomorphise.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/trans/monomorphise.cpp b/src/trans/monomorphise.cpp
index 3ac2ee09..b752a5bc 100644
--- a/src/trans/monomorphise.cpp
+++ b/src/trans/monomorphise.cpp
@@ -13,10 +13,9 @@ namespace {
::MIR::LValue monomorph_LValue(const ::StaticTraitResolve& resolve, const Trans_Params& params, const ::MIR::LValue& tpl)
{
TU_MATCHA( (tpl), (e),
- (Variable, return e; ),
- (Temporary, return e; ),
- (Argument, return e; ),
(Return, return e; ),
+ (Argument, return e; ),
+ (Local, return e; ),
(Static,
return params.monomorph(resolve, e);
),
@@ -120,17 +119,11 @@ namespace {
::MIR::Function output;
// 1. Monomorphise locals and temporaries
- output.named_variables.reserve( tpl->named_variables.size() );
- for(const auto& var : tpl->named_variables)
- {
- DEBUG("- var" << output.named_variables.size());
- output.named_variables.push_back( params.monomorph(resolve, var) );
- }
- output.temporaries.reserve( tpl->temporaries.size() );
- for(const auto& ty : tpl->temporaries)
+ output.locals.reserve( tpl->locals.size() );
+ for(const auto& var : tpl->locals)
{
- DEBUG("- tmp" << output.temporaries.size());
- output.temporaries.push_back( params.monomorph(resolve, ty) );
+ DEBUG("- _" << output.locals.size());
+ output.locals.push_back( params.monomorph(resolve, var) );
}
output.drop_flags = tpl->drop_flags;
@@ -302,6 +295,14 @@ namespace {
e.targets
});
),
+ (SwitchValue,
+ terminator = ::MIR::Terminator::make_SwitchValue({
+ monomorph_LValue(resolve, params, e.val),
+ e.def_target,
+ e.targets,
+ e.values.clone()
+ });
+ ),
(Call,
struct H {
static ::MIR::CallTarget monomorph_calltarget(const ::StaticTraitResolve& resolve, const Trans_Params& params, const ::MIR::CallTarget& ct) {