diff --git a/src/main/compile/of_simplified.ml b/src/main/compile/of_simplified.ml index 0e1fac16c..59df4d647 100644 --- a/src/main/compile/of_simplified.ml +++ b/src/main/compile/of_simplified.ml @@ -5,9 +5,11 @@ let compile (program : Ast_simplified.program) : (Ast_typed.program * Typer.Solv let () = Typer.Solver.discard_state state in ok @@ (prog_typed, state) -(* let apply (program : Ast_simplified.program) (entry_point : string) (param : Ast_simplified.expression) : Ast_simplified.expression result = *) +let compile_expression ?(env = Ast_typed.Environment.full_empty) ~(state : Typer.Solver.state) (ae : Ast_simplified.expression) + : (Ast_typed.value * Typer.Solver.state) result = + Typer.type_expression env state ae + let apply (entry_point : string) (param : Ast_simplified.expression) : Ast_simplified.expression result = - (* let%bind (exp,_) = Ast_simplified.Misc.get_entry program entry_point in *) let name = Var.of_name entry_point in let entry_point_var : Ast_simplified.expression = { expression = Ast_simplified.E_variable name ; @@ -16,6 +18,3 @@ let apply (entry_point : string) (param : Ast_simplified.expression) : Ast_simpl { expression = Ast_simplified.E_application (entry_point_var, param) ; location = Virtual "generated application" } in ok applied - -let compile_expression ?(env = Ast_typed.Environment.full_empty) ~(state : Typer.Solver.state) (ae : Ast_simplified.expression) : (Ast_typed.value * Typer.Solver.state) result = - Typer.type_expression env state ae \ No newline at end of file diff --git a/src/stages/mini_c/misc.ml b/src/stages/mini_c/misc.ml index cb1f68716..5cae24799 100644 --- a/src/stages/mini_c/misc.ml +++ b/src/stages/mini_c/misc.ml @@ -157,13 +157,9 @@ let aggregate_entry (lst : program) (form : form_t) : expression result = match (entry_expression.content) with | (E_closure l) -> ( let l' = { l with body = wrapper l.body } in - let%bind t' = - let%bind (input_ty , output_ty) = get_t_function entry_expression.type_value in - ok (t_function input_ty output_ty) - in let e' = { content = E_closure l' ; - type_value = t' ; + type_value = entry_expression.type_value ; } in ok e' )