Skip to content

Commit

Permalink
feat: do not hardcode allocation type
Browse files Browse the repository at this point in the history
  • Loading branch information
spotandjake committed Nov 19, 2024
1 parent db89ce3 commit 2b43706
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler/src/middle_end/matchcomp.re
Original file line number Diff line number Diff line change
Expand Up @@ -1352,6 +1352,7 @@ module MatchTreeCompiler = {
[BLet(match_jmp_name, match_mapped_cond, Nonglobal)],
);
};
let allocation_type = ref(Unmanaged(WasmI32));
let cases =
List.map(
((tag, tree)) => {
Expand All @@ -1366,15 +1367,16 @@ module MatchTreeCompiler = {
helpI,
helpConst,
);
allocation_type := tree_ans.comp_allocation_type;
(tag - min, fold_tree(tree_setup, tree_ans));
},
cases,
);
assert(List.length(cases) != 0);
let switch_body =
Comp.switch_(
~loc=Location.dummy_loc,
// TODO: We should probably grab this from ~allocation_type=tree_ans.comp_allocation_type,
~allocation_type=Unmanaged(WasmI32),
~allocation_type=allocation_type^,
match_cond_id,
cases,
Total,
Expand Down

0 comments on commit 2b43706

Please sign in to comment.