diff options
author | Alain Frisch <alain@frisch> | 2020-09-10 10:09:28 +0200 |
---|---|---|
committer | Alain Frisch <alain@frisch> | 2020-12-01 15:57:16 +0100 |
commit | ee1a202acd257b6bfd6e1a1f8b5bf461c748326d (patch) | |
tree | 3a7903e2be128f76e0f1d5c5012bf936da87c83e | |
parent | 3f1c3bed3e93e0631c13c8f1fd3d9b2572042256 (diff) | |
download | ocaml-ee1a202acd257b6bfd6e1a1f8b5bf461c748326d.tar.gz |
Make Scoped_location.scopes abstract
-rw-r--r-- | lambda/debuginfo.ml | 2 | ||||
-rw-r--r-- | lambda/debuginfo.mli | 11 | ||||
-rw-r--r-- | lambda/translmod.ml | 8 |
3 files changed, 8 insertions, 13 deletions
diff --git a/lambda/debuginfo.ml b/lambda/debuginfo.ml index c1195d721c..bf6e99d1df 100644 --- a/lambda/debuginfo.ml +++ b/lambda/debuginfo.ml @@ -27,6 +27,8 @@ module Scoped_location = struct type scopes = scope_item list + let empty_scopes = [] + let add_parens_if_symbolic = function | "" -> "" | s -> diff --git a/lambda/debuginfo.mli b/lambda/debuginfo.mli index 4ce8d5f9c9..4d99ddf3d4 100644 --- a/lambda/debuginfo.mli +++ b/lambda/debuginfo.mli @@ -14,17 +14,10 @@ (**************************************************************************) module Scoped_location : sig - type scope_item = - | Sc_anonymous_function - | Sc_value_definition of string - | Sc_module_definition of string - | Sc_class_definition of string - | Sc_method_definition of string - - type scopes = scope_item list - val string_of_scope_item : scope_item -> string + type scopes val string_of_scopes : scopes -> string + val empty_scopes : scopes val enter_anonymous_function : scopes:scopes -> scopes val enter_value_definition : scopes:scopes -> Ident.t -> scopes val enter_module_definition : scopes:scopes -> Ident.t -> scopes diff --git a/lambda/translmod.ml b/lambda/translmod.ml index bce0d15f96..6188279b20 100644 --- a/lambda/translmod.ml +++ b/lambda/translmod.ml @@ -806,7 +806,7 @@ let transl_implementation_flambda module_name (str, cc) = primitive_declarations := []; Translprim.clear_used_primitives (); let module_id = Ident.create_persistent module_name in - let scopes = [Sc_module_definition module_name] in + let scopes = enter_module_definition ~scopes:empty_scopes module_id in let body, size = Translobj.transl_label_init (fun () -> transl_struct ~scopes Loc_unknown [] cc @@ -1383,14 +1383,14 @@ let transl_store_gen ~scopes module_name ({ str_items = str }, restr) topl = (*size, transl_label_init (transl_store_structure module_id map prims str)*) let transl_store_phrases module_name str = - let scopes = [Sc_module_definition module_name] in + let scopes = enter_module_definition ~scopes:empty_scopes (Ident.create_persistent module_name) in transl_store_gen ~scopes module_name (str,Tcoerce_none) true let transl_store_implementation module_name (str, restr) = let s = !transl_store_subst in transl_store_subst := Ident.Map.empty; let module_ident = Ident.create_persistent module_name in - let scopes = [Sc_module_definition module_name] in + let scopes = enter_module_definition ~scopes:empty_scopes module_ident in let (i, code) = transl_store_gen ~scopes module_name (str, restr) false in transl_store_subst := s; { Lambda.main_module_block_size = i; @@ -1566,7 +1566,7 @@ let transl_toplevel_item_and_close ~scopes itm = let transl_toplevel_definition str = reset_labels (); Translprim.clear_used_primitives (); - make_sequence (transl_toplevel_item_and_close ~scopes:[]) str.str_items + make_sequence (transl_toplevel_item_and_close ~scopes:empty_scopes) str.str_items (* Compile the initialization code for a packed library *) |