[meta] Legalization: emit typeof type variables for results in all the cases;

This commit is contained in:
Benjamin Bouvier
2019-07-02 18:30:04 +02:00
parent 3545363006
commit f1222dce10

View File

@@ -134,6 +134,21 @@ fn unwrap_inst(
.get(var_pool.get(def.defined_vars[0]).dst_def.unwrap()) .get(var_pool.get(def.defined_vars[0]).dst_def.unwrap())
.to_comment_string(var_pool) .to_comment_string(var_pool)
)); ));
fmt.line("let results = pos.func.dfg.inst_results(inst);");
for (i, &var_index) in def.defined_vars.iter().enumerate() {
let var = var_pool.get(var_index);
fmtln!(fmt, "let {} = &results[{}];", var.name, i);
if var.has_free_typevar() {
fmtln!(
fmt,
"let typeof_{} = pos.func.dfg.value_type(*{});",
var.name,
var.name
);
}
}
replace_inst = true; replace_inst = true;
} else { } else {
// Boring case: Detach the result values, capture them in locals. // Boring case: Detach the result values, capture them in locals.