Skip to content

Commit 6590304

Browse files
Revert "fix(codegen): resolve top-level const refs in ExprVar (#73) (#98)" (#99)
This reverts commit fb34c66.
1 parent 09fe883 commit 6590304

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

lib/codegen.ml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -436,13 +436,7 @@ let rec gen_expr (ctx : context) (expr : expr) : (context * instr list) result =
436436
UnboundVariable even though the parser accepts it. *)
437437
begin match List.assoc_opt id.name ctx.variant_tags with
438438
| Some tag -> Ok (ctx, [I32Const (Int32.of_int tag)])
439-
| None ->
440-
(* Top-level const bindings are stored in func_indices with a
441-
negative sentinel: actual global index = -(k+1). *)
442-
begin match List.assoc_opt id.name ctx.func_indices with
443-
| Some k when k < 0 -> Ok (ctx, [GlobalGet (-(k + 1))])
444-
| _ -> Error (UnboundVariable id.name)
445-
end
439+
| None -> Error (UnboundVariable id.name)
446440
end
447441
end
448442

0 commit comments

Comments
 (0)