[meta] Legalization: emit typeof type variables for results in all the cases;
@@ -134,6 +134,21 @@ fn unwrap_inst(
.get(var_pool.get(def.defined_vars[0]).dst_def.unwrap())
.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;
} else {
// Boring case: Detach the result values, capture them in locals.
