diff options
author | Nick Roberts <nroberts02@gmail.com> | 2023-03-07 12:58:33 -0500 |
---|---|---|
committer | Nick roberts <nroberts@janestreet.com> | 2023-03-13 14:29:04 +0000 |
commit | c46f38908a6eb6fc802be9bc5a7d1fe0f3634a67 (patch) | |
tree | c48402664a6cc85c3c198f6c843519d8d97c4dae | |
parent | 4166b90e50276d0a21590a029e3a6f11e0ed954d (diff) | |
download | ocaml-c46f38908a6eb6fc802be9bc5a7d1fe0f3634a67.tar.gz |
Remove `Lev_module_definition`
-rw-r--r-- | bytecomp/bytegen.ml | 2 | ||||
-rw-r--r-- | lambda/lambda.ml | 1 | ||||
-rw-r--r-- | lambda/lambda.mli | 1 | ||||
-rw-r--r-- | lambda/printlambda.ml | 2 | ||||
-rw-r--r-- | lambda/translcore.ml | 9 | ||||
-rw-r--r-- | lambda/translmod.ml | 32 |
6 files changed, 10 insertions, 37 deletions
diff --git a/bytecomp/bytegen.ml b/bytecomp/bytegen.ml index 6ea0b0766f..234818fd03 100644 --- a/bytecomp/bytegen.ml +++ b/bytecomp/bytegen.ml @@ -1048,8 +1048,6 @@ let rec comp_expr stack_info env exp sz cont = let cont1 = add_event ev cont in comp_expr stack_info env lam sz cont1 end - | Lev_module_definition _ -> - comp_expr stack_info env lam sz cont end | Lifused (_, exp) -> comp_expr stack_info env exp sz cont diff --git a/lambda/lambda.ml b/lambda/lambda.ml index ce293c7f75..07a691e6b1 100644 --- a/lambda/lambda.ml +++ b/lambda/lambda.ml @@ -348,7 +348,6 @@ and lambda_event_kind = | Lev_after of Types.type_expr | Lev_function | Lev_pseudo - | Lev_module_definition of Ident.t type program = { module_ident : Ident.t; diff --git a/lambda/lambda.mli b/lambda/lambda.mli index be8f9bb642..f6c3d05c0f 100644 --- a/lambda/lambda.mli +++ b/lambda/lambda.mli @@ -339,7 +339,6 @@ and lambda_event_kind = | Lev_after of Types.type_expr | Lev_function | Lev_pseudo - | Lev_module_definition of Ident.t type program = { module_ident : Ident.t; diff --git a/lambda/printlambda.ml b/lambda/printlambda.ml index 0d8aff08f6..0abb4f1f7a 100644 --- a/lambda/printlambda.ml +++ b/lambda/printlambda.ml @@ -672,8 +672,6 @@ let rec lam ppf = function | Lev_after _ -> "after" | Lev_function -> "funct-body" | Lev_pseudo -> "pseudo" - | Lev_module_definition ident -> - Format.asprintf "module-defn(%a)" Ident.print ident in (* -dno-locations also hides the placement of debug events; this is good for the readability of the resulting output (usually diff --git a/lambda/translcore.ml b/lambda/translcore.ml index 0c95110779..dd3dcd8f75 100644 --- a/lambda/translcore.ml +++ b/lambda/translcore.ml @@ -529,15 +529,10 @@ and transl_exp0 ~in_new_scope ~scopes e = let lam = !transl_module ~scopes Tcoerce_none None modl in Lsequence(Lprim(Pignore, [lam], of_location ~scopes loc.loc), transl_exp ~scopes body) - | Texp_letmodule(Some id, loc, Mp_present, modl, body) -> + | Texp_letmodule(Some id, _loc, Mp_present, modl, body) -> let defining_expr = let mod_scopes = enter_module_definition ~scopes id in - Levent (!transl_module ~scopes:mod_scopes Tcoerce_none None modl, { - lev_loc = of_location ~scopes loc.loc; - lev_kind = Lev_module_definition id; - lev_repr = None; - lev_env = Env.empty; - }) + !transl_module ~scopes:mod_scopes Tcoerce_none None modl in Llet(Strict, Pgenval, id, defining_expr, transl_exp ~scopes body) | Texp_letmodule(_, _, Mp_absent, _, body) -> diff --git a/lambda/translmod.ml b/lambda/translmod.ml index e4aafc529f..93204eaa1a 100644 --- a/lambda/translmod.ml +++ b/lambda/translmod.ml @@ -406,7 +406,7 @@ let compile_recmodule ~scopes compile_rhs bindings cont = eval_rec_bindings (reorder_rec_bindings (List.map - (fun {mb_id=id; mb_name; mb_expr=modl; mb_loc=loc; _} -> + (fun {mb_id=id; mb_name; mb_expr=modl; _} -> let id_or_ignore_loc, shape = match id with | None -> @@ -414,7 +414,7 @@ let compile_recmodule ~scopes compile_rhs bindings cont = Ignore_loc loc, Result.Error Unnamed | Some id -> Id id, init_shape id modl in - (id_or_ignore_loc, modl.mod_loc, shape, compile_rhs id modl loc)) + (id_or_ignore_loc, modl.mod_loc, shape, compile_rhs id modl)) bindings)) cont @@ -667,14 +667,6 @@ and transl_structure ~scopes loc fields cc rootpath final_env = function of_location ~scopes mb.mb_name.loc), body), size | Some id -> - let module_body = - Levent (module_body, { - lev_loc = of_location ~scopes mb.mb_loc; - lev_kind = Lev_module_definition id; - lev_repr = None; - lev_env = Env.empty; - }) - in Llet(pure_module mb.mb_expr, Pgenval, id, module_body, body), size end | Tstr_module ({mb_presence=Mp_absent} as mb) -> @@ -692,21 +684,13 @@ and transl_structure ~scopes loc fields cc rootpath final_env = function transl_structure ~scopes loc ext_fields cc rootpath final_env rem in let lam = - compile_recmodule ~scopes (fun id modl loc -> + compile_recmodule ~scopes (fun id modl -> match id with | None -> transl_module ~scopes Tcoerce_none None modl | Some id -> - let module_body = - transl_module - ~scopes:(enter_module_definition ~scopes id) - Tcoerce_none (field_path rootpath id) modl - in - Levent (module_body, { - lev_loc = of_location ~scopes loc; - lev_kind = Lev_module_definition id; - lev_repr = None; - lev_env = Env.empty; - }) + transl_module + ~scopes:(enter_module_definition ~scopes id) + Tcoerce_none (field_path rootpath id) modl ) bindings body in lam, size @@ -1147,7 +1131,7 @@ let transl_store_structure ~scopes glob map prims aliases str = | Tstr_recmodule bindings -> let ids = List.filter_map (fun mb -> mb.mb_id) bindings in compile_recmodule ~scopes - (fun id modl _loc -> + (fun id modl -> Lambda.subst no_env_update subst (match id with | None -> @@ -1520,7 +1504,7 @@ let transl_toplevel_item ~scopes item = | Tstr_recmodule bindings -> let idents = List.filter_map (fun mb -> mb.mb_id) bindings in compile_recmodule ~scopes - (fun id modl _loc -> + (fun id modl -> match id with | None -> transl_module ~scopes Tcoerce_none None modl |