@@ -384,7 +384,7 @@ type expr =
384
384
}
385
385
| Block of int * Var .t array * array_or_not * mutability
386
386
| Field of Var .t * int * field_type
387
- | Closure of Var .t list * cont
387
+ | Closure of Var .t list * cont * Parse_info .t option
388
388
| Constant of constant
389
389
| Prim of prim * prim_arg list
390
390
| Special of special
@@ -538,7 +538,7 @@ module Print = struct
538
538
Format. fprintf f " }"
539
539
| Field (x , i , Non_float) -> Format. fprintf f " %a[%d]" Var. print x i
540
540
| Field (x , i , Float) -> Format. fprintf f " FLOAT{%a[%d]}" Var. print x i
541
- | Closure (l , c ) -> Format. fprintf f " fun(%a){%a}" var_list l cont c
541
+ | Closure (l , c , _ ) -> Format. fprintf f " fun(%a){%a}" var_list l cont c
542
542
| Constant c -> Format. fprintf f " CONST{%a}" constant c
543
543
| Prim (p , l ) -> prim f p l
544
544
| Special s -> special f s
@@ -597,10 +597,10 @@ let fold_closures p f accu =
597
597
(fun _ block accu ->
598
598
List. fold_left block.body ~init: accu ~f: (fun accu i ->
599
599
match i with
600
- | Let (x , Closure (params , cont )) -> f (Some x) params cont accu
600
+ | Let (x , Closure (params , cont , cloc )) -> f (Some x) params cont cloc accu
601
601
| _ -> accu))
602
602
p.blocks
603
- (f None [] (p.start, [] ) accu)
603
+ (f None [] (p.start, [] ) None accu)
604
604
605
605
(* ***)
606
606
@@ -756,16 +756,16 @@ let fold_closures_innermost_first { start; blocks; _ } f accu =
756
756
let block = Addr.Map. find pc blocks in
757
757
List. fold_left block.body ~init: accu ~f: (fun accu i ->
758
758
match i with
759
- | Let (x , Closure (params , cont )) ->
759
+ | Let (x , Closure (params , cont , cloc )) ->
760
760
let accu = visit blocks (fst cont) f accu in
761
- f (Some x) params cont accu
761
+ f (Some x) params cont cloc accu
762
762
| _ -> accu))
763
763
pc
764
764
blocks
765
765
accu
766
766
in
767
767
let accu = visit blocks start f accu in
768
- f None [] (start, [] ) accu
768
+ f None [] (start, [] ) None accu
769
769
770
770
let fold_closures_outermost_first { start; blocks; _ } f accu =
771
771
let rec visit blocks pc f accu =
@@ -775,15 +775,15 @@ let fold_closures_outermost_first { start; blocks; _ } f accu =
775
775
let block = Addr.Map. find pc blocks in
776
776
List. fold_left block.body ~init: accu ~f: (fun accu i ->
777
777
match i with
778
- | Let (x , Closure (params , cont )) ->
779
- let accu = f (Some x) params cont accu in
778
+ | Let (x , Closure (params , cont , cloc )) ->
779
+ let accu = f (Some x) params cont cloc accu in
780
780
visit blocks (fst cont) f accu
781
781
| _ -> accu))
782
782
pc
783
783
blocks
784
784
accu
785
785
in
786
- let accu = f None [] (start, [] ) accu in
786
+ let accu = f None [] (start, [] ) None accu in
787
787
visit blocks start f accu
788
788
789
789
let eq p1 p2 =
@@ -819,7 +819,7 @@ let invariant { blocks; start; _ } =
819
819
| Apply _ -> ()
820
820
| Block (_ , _ , _ , _ ) -> ()
821
821
| Field (_ , _ , _ ) -> ()
822
- | Closure (l , cont ) ->
822
+ | Closure (l , cont , _ ) ->
823
823
List. iter l ~f: define;
824
824
check_cont cont
825
825
| Constant _ -> ()
0 commit comments