Skip to content

Commit 2a605c4

Browse files
committed
feat: do not hardcode allocation type
1 parent 0c2aad6 commit 2a605c4

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

compiler/src/middle_end/matchcomp.re

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,7 @@ module MatchTreeCompiler = {
13521352
[BLet(match_jmp_name, match_mapped_cond, Nonglobal)],
13531353
);
13541354
};
1355+
let allocation_type = ref(Unmanaged(WasmI32));
13551356
let cases =
13561357
List.map(
13571358
((tag, tree)) => {
@@ -1366,15 +1367,16 @@ module MatchTreeCompiler = {
13661367
helpI,
13671368
helpConst,
13681369
);
1370+
allocation_type := tree_ans.comp_allocation_type;
13691371
(tag - min, fold_tree(tree_setup, tree_ans));
13701372
},
13711373
cases,
13721374
);
1375+
assert(List.length(cases) != 0);
13731376
let switch_body =
13741377
Comp.switch_(
13751378
~loc=Location.dummy_loc,
1376-
// TODO: We should probably grab this from ~allocation_type=tree_ans.comp_allocation_type,
1377-
~allocation_type=Unmanaged(WasmI32),
1379+
~allocation_type=allocation_type^,
13781380
match_cond_id,
13791381
cases,
13801382
Total,

0 commit comments

Comments
 (0)