Skip to content

Commit c9b2846

Browse files
committed
Fix remaining bugs in CPS transform and effect handling
1 parent bd6f227 commit c9b2846

File tree

7 files changed

+433
-263
lines changed

7 files changed

+433
-263
lines changed

compiler/lib/code.ml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ module Var : sig
106106

107107
val set : 'a t -> key -> 'a -> unit
108108

109+
val length : 'a t -> int
110+
109111
val make : size -> 'a -> 'a t
110112

111113
val iter : (key -> 'a -> unit) -> 'a t -> unit
@@ -152,7 +154,8 @@ end = struct
152154

153155
let to_string ?origin i = Var_printer.to_string printer ?origin i
154156

155-
let print f x = Format.fprintf f "v%d" x
157+
(*let print f x = Format.fprintf f "v%d" x*)
158+
let print f x = Format.fprintf f "%s" (to_string x)
156159

157160
(* Format.fprintf f "%s" (to_string x) *)
158161

@@ -212,6 +215,8 @@ end = struct
212215

213216
let set t x v = t.(x) <- v
214217

218+
let length t = Array.length t
219+
215220
let make () v = Array.make (count ()) v
216221

217222
let iter f t =

compiler/lib/code.mli

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ module Var : sig
9999

100100
val set : 'a t -> key -> 'a -> unit
101101

102+
val length : 'a t -> int
103+
102104
val make : size -> 'a -> 'a t
103105

104106
val iter : (key -> 'a -> unit) -> 'a t -> unit

0 commit comments

Comments
 (0)