package MlFront_Core

  1. Overview
  2. Docs

Source file QualifiedModuleName.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
type t = { standard_module_id : StandardModuleId.t; fixedlength : bool }

let pp ppf { standard_module_id; fixedlength } =
  Format.fprintf ppf "qualified@ (%a |fixedlen=%b)" StandardModuleId.pp_dot
    standard_module_id fixedlength

let compare { standard_module_id = s1; fixedlength = f1 }
    { standard_module_id = s2; fixedlength = f2 } =
  match StandardModuleId.compare s1 s2 with 0 -> Bool.compare f1 f2 | c -> c

let create ~fixedlength standard_module_id = { fixedlength; standard_module_id }
let standard_module_id { standard_module_id; _ } = standard_module_id

let short_name { fixedlength; standard_module_id } =
  if fixedlength then
    LibraryId.full_name standard_module_id.library_id
    ^ "__"
    ^ Squish.fixlen_name
        (StandardModuleId.show_dot_except_library_id standard_module_id)
  else StandardModuleId.show_double_underscore standard_module_id

let full_name module_id = StandardModuleId.show_double_underscore module_id