1 (**************************************************************************)
2 (* *)
3 (* OCaml *)
4 (* *)
5 (* Pierre Chambart, OCamlPro *)
6 (* Mark Shinwell and Leo White, Jane Street Europe *)
7 (* *)
8 (* Copyright 2013--2016 OCamlPro SAS *)
9 (* Copyright 2014--2016 Jane Street Group LLC *)
10 (* *)
11 (* All rights reserved. This file is distributed under the terms of *)
12 (* the GNU Lesser General Public License version 2.1, with the *)
13 (* special exception on linking described in the file LICENSE. *)
14 (* *)
15 (**************************************************************************)
16
17 [@@@ocaml.warning "+a-4-9-30-40-41-42"]
18
19 (** [Variable.t] is the equivalent of a non-persistent [Ident.t] in
20 the [Flambda] tree. It wraps an [Ident.t] together with its source
21 [compilation_unit]. As such, it is unique within a whole program,
22 not just one compilation unit.
23
24 Introducing a new type helps in tracing the source of identifiers
25 when debugging the inliner. It also avoids Ident renaming when
26 importing cmx files.
27 *)
28
29 include Identifiable.S
30
31 val create
32 : ?current_compilation_unit:Compilation_unit.t
33 -> Internal_variable_names.t
34 -> t
35 val create_with_same_name_as_ident : Ident.t -> t
36
37 val rename
38 : ?current_compilation_unit:Compilation_unit.t
39 -> t
40 -> t
41
42 val in_compilation_unit : t -> Compilation_unit.t -> bool
43
44 val name : t -> string
45
46 val unique_name : t -> string
47
48 val get_compilation_unit : t -> Compilation_unit.t
49
50 val print_list : Format.formatter -> t list -> unit
51 val print_opt : Format.formatter -> t option -> unit
52
53 (** If the given variable has the given stamp, call the user-supplied
54 function. For debugging purposes only. *)
55 val debug_when_stamp_matches : t -> stamp:int -> f:(unit -> unit) -> unit
56
57 type pair = t * t
58 module Pair : Identifiable.S with type t := pair
59
60 val compare_lists : t list -> t list -> int
61
62 val output_full : out_channel -> t -> unit
63 (** Unlike [output], [output_full] includes the compilation unit. *)
64