diff --git a/compiler/plugins/api_web.ml b/compiler/plugins/api_web.ml index 7092bfc7..eb1a72ed 100644 --- a/compiler/plugins/api_web.ml +++ b/compiler/plugins/api_web.ml @@ -351,8 +351,8 @@ module To_jsoo = struct (_ctx : decl_ctx) (fmt : Format.formatter) (scopes : 'e code_item_list) = - Scope.fold_left - ~f:(fun () code_item var -> + BoundList.iter + ~f:(fun var code_item -> match code_item with | Topdef _ -> () | ScopeDef (_name, body) -> @@ -367,14 +367,14 @@ module To_jsoo = struct "@\n@\n@[let %a@ (%a : %a Js.t)@ : %a Js.t =@\n%a@]@\n" format_var var fmt_input_struct_name body fmt_input_struct_name body fmt_output_struct_name body fmt_fun_call ()) - ~init:() scopes + scopes let format_scopes_to_callbacks (_ctx : decl_ctx) (fmt : Format.formatter) (scopes : 'e code_item_list) : unit = - Scope.fold_left - ~f:(fun () code_item var -> + BoundList.iter + ~f:(fun var code_item -> match code_item with | Topdef _ -> () | ScopeDef (_name, body) -> @@ -385,7 +385,7 @@ module To_jsoo = struct in Format.fprintf fmt "@,@[%a =@ Js.wrap_callback@ %a@]@," fmt_meth_name () format_var var) - ~init:() scopes + scopes let format_program (fmt : Format.formatter) diff --git a/compiler/plugins/explain.ml b/compiler/plugins/explain.ml index 4ba39acd..28223f38 100644 --- a/compiler/plugins/explain.ml +++ b/compiler/plugins/explain.ml @@ -415,12 +415,12 @@ let result_level base_vars = let interpret_program (prg : ('dcalc, 'm) gexpr program) (scope : ScopeName.t) : ('t, 'm) gexpr * Env.t = let ctx = prg.decl_ctx in - let all_env, scopes = - Scope.fold_left prg.code_items ~init:(Env.empty, ScopeName.Map.empty) + let (all_env, scopes), () = + BoundList.fold_left prg.code_items ~init:(Env.empty, ScopeName.Map.empty) ~f:(fun (env, scopes) item v -> match item with | ScopeDef (name, body) -> - let e = Scope.to_expr ctx body (Scope.get_body_mark body) in + let e = Scope.to_expr ctx body in let e = Expr.remove_logging_calls (Expr.unbox e) in ( Env.add v (Expr.unbox e) env env, ScopeName.Map.add name (v, body.scope_body_input_struct) scopes ) @@ -589,12 +589,12 @@ let program_to_graph Expr.map_marks ~f:(fun m -> Custom { pos = Expr.mark_pos m; custom = { conditions = [] } }) in - let all_env, scopes = - Scope.fold_left prg.code_items ~init:(Env.empty, ScopeName.Map.empty) + let (all_env, scopes), () = + BoundList.fold_left prg.code_items ~init:(Env.empty, ScopeName.Map.empty) ~f:(fun (env, scopes) item v -> match item with | ScopeDef (name, body) -> - let e = Scope.to_expr ctx body (Scope.get_body_mark body) in + let e = Scope.to_expr ctx body in let e = customize (Expr.unbox e) in let e = Expr.remove_logging_calls (Expr.unbox e) in let e = Expr.rename_vars (Expr.unbox e) in diff --git a/compiler/plugins/lazy_interp.ml b/compiler/plugins/lazy_interp.ml index 5a78dd0e..ab002398 100644 --- a/compiler/plugins/lazy_interp.ml +++ b/compiler/plugins/lazy_interp.ml @@ -227,12 +227,12 @@ let rec lazy_eval : let interpret_program (prg : ('dcalc, 'm) gexpr program) (scope : ScopeName.t) : ('t, 'm) gexpr * 'm Env.t = let ctx = prg.decl_ctx in - let all_env, scopes = - Scope.fold_left prg.code_items ~init:(Env.empty, ScopeName.Map.empty) + let (all_env, scopes), () = + BoundList.fold_left prg.code_items ~init:(Env.empty, ScopeName.Map.empty) ~f:(fun (env, scopes) item v -> match item with | ScopeDef (name, body) -> - let e = Scope.to_expr ctx body (Scope.get_body_mark body) in + let e = Scope.to_expr ctx body in ( Env.add v (Expr.unbox e) env env, ScopeName.Map.add name (v, body.scope_body_input_struct) scopes ) | Topdef (_, _, e) -> Env.add v e env env, scopes)