Skip to content

Commit

Permalink
Apply latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
voodoos committed Oct 15, 2024
1 parent 563316a commit 02cf198
Show file tree
Hide file tree
Showing 10 changed files with 254 additions and 165 deletions.
9 changes: 4 additions & 5 deletions src/ocaml/parsing/unit_info.mli
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ val normalize: string -> string

(** [lax_modname_from_source filename] is [modulize stem] where [stem] is the
basename of the filename [filename] stripped from all its extensions.
For instance, [lax_modname_from_source "/pa.th/x.ml.pp"] is ["X"]. *)
For instance, [modname_from_source "/pa.th/x.ml.pp"] is ["X"]. *)
val lax_modname_from_source: filename -> modname

(** Same as {!lax_modname_from_source} but raises an {!error.Invalid_encoding}
Expand Down Expand Up @@ -84,8 +84,8 @@ val kind: t -> intf_or_impl
val check_unit_name : t -> unit

(** [make ~check ~source_file kind prefix] associates both the
[source_file] and the module name {!lax_modname_from_source}[ target_prefix]
to the prefix filesystem path [prefix].
[source_file] and the module name {!modname_from_source}[ target_prefix] to
the prefix filesystem path [prefix].
If [check_modname=true], this function emits a warning if the derived module
name is not valid according to {!check_unit_name}.
Expand Down Expand Up @@ -116,8 +116,7 @@ module Artifact: sig
val modname: t -> modname

(** [from_filename filename] reconstructs the module name
[lax_modname_from_source filename] associated to the artifact
[filename]. *)
[modname_from_source filename] associated to the artifact [filename]. *)
val from_filename: filename -> t

end
Expand Down
18 changes: 8 additions & 10 deletions src/ocaml/typing/cmt_format.ml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ and binary_part =
| Partial_signature_item of signature_item
| Partial_module_type of module_type

type dependency_kind = Definition_to_declaration | Declaration_to_declaration
type cmt_infos = {
cmt_modname : string;
cmt_annots : binary_annots;
cmt_value_dependencies :
(Types.value_description * Types.value_description) list;
cmt_declaration_dependencies : (dependency_kind * Uid.t * Uid.t) list;
cmt_comments : (string * Location.t) list;
cmt_args : string array;
cmt_sourcefile : string option;
Expand Down Expand Up @@ -444,21 +444,19 @@ let read_cmi filename =
| Some cmi, _ -> cmi

let saved_types = ref []
let value_deps = ref []
let uids_deps : (dependency_kind * Uid.t * Uid.t) list ref = ref []

let clear () =
saved_types := [];
value_deps := []
uids_deps := []

let add_saved_type b = saved_types := b :: !saved_types
let get_saved_types () = !saved_types
let set_saved_types l = saved_types := l

(*let record_value_dependency vd1 vd2 =
if vd1.Types.val_loc <> vd2.Types.val_loc then
value_deps := (vd1, vd2) :: !value_deps*)

let record_value_dependency _vd1 _vd2 = ()
let record_declaration_dependency (rk, uid1, uid2) =
if not (Uid.equal uid1 uid2) then
uids_deps := (rk, uid1, uid2) :: !uids_deps

let save_cmt target binary_annots initial_env cmi shape =
if !Clflags.binary_annotations && not !Clflags.print_types then begin
Expand All @@ -483,7 +481,7 @@ let save_cmt target binary_annots initial_env cmi shape =
let cmt = {
cmt_modname = Unit_info.Artifact.modname target;
cmt_annots;
cmt_value_dependencies = !value_deps;
cmt_declaration_dependencies = !uids_deps;
cmt_comments = [];
cmt_args = Sys.argv;
cmt_sourcefile = sourcefile;
Expand Down
7 changes: 3 additions & 4 deletions src/ocaml/typing/cmt_format.mli
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ and binary_part =
| Partial_signature_item of signature_item
| Partial_module_type of module_type

type dependency_kind = Definition_to_declaration | Declaration_to_declaration
type cmt_infos = {
cmt_modname : modname;
cmt_annots : binary_annots;
cmt_value_dependencies :
(Types.value_description * Types.value_description) list;
cmt_declaration_dependencies : (dependency_kind * Uid.t * Uid.t) list;
cmt_comments : (string * Location.t) list;
cmt_args : string array;
cmt_sourcefile : string option;
Expand Down Expand Up @@ -109,8 +109,7 @@ val add_saved_type : binary_part -> unit
val get_saved_types : unit -> binary_part list
val set_saved_types : binary_part list -> unit

val record_value_dependency:
Types.value_description -> Types.value_description -> unit
val record_declaration_dependency: dependency_kind * Uid.t * Uid.t -> unit

(*
Expand Down
2 changes: 1 addition & 1 deletion src/ocaml/typing/includeclass.ml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ let report_error_doc mode ppf = function
List.iter (fun err -> fprintf ppf "@ %a" (include_err mode) err) errs in
fprintf ppf "@[<v>%a%a@]" (include_err mode) err print_errs errs

let report_error mode = Format_doc.compat (report_error_doc mode)
let report_error = Format_doc.compat1 report_error_doc
Loading

0 comments on commit 02cf198

Please sign in to comment.