mirror of
https://github.com/CatalaLang/catala.git
synced 2024-11-08 07:51:43 +03:00
Fix building of plug-ins
This commit is contained in:
parent
f7672857a7
commit
9ca952b518
@ -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@[<hov 2>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 "@,@[<hov 2>%a =@ Js.wrap_callback@ %a@]@,"
|
||||
fmt_meth_name () format_var var)
|
||||
~init:() scopes
|
||||
scopes
|
||||
|
||||
let format_program
|
||||
(fmt : Format.formatter)
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user