Commits

camlspotter committed ca4f050

4.00.1 exposes the record fields of Ident.t

Comments (0)

Files changed (5)

     let must_be_empty, res = List.fold_left (fun (ids, res) sitem ->
       let addition sitem =
         List.map (fun (k,id) ->
-          Ident.unsafe_create_with_stamp (Ident0.name id) (-1), (k,id))
+          Ident.create_with_stamp (Ident0.name id) (-1), (k,id))
           (List.map ident_of_structure_item (T.signature_item sitem))
       in
       match sitem with
                     match kind with
                     | Kind.Value | Kind.Module | Kind.Class | Kind.Exception -> error id
                     | _ ->
-                        let gid = Ident.unsafe_create_with_stamp (Ident0.name id) (-1) in
+                        let gid = Ident.create_with_stamp (Ident0.name id) (-1) in
                         match Env.find env gid with
                         | Some (_, lazy v) -> v
                         | None -> error id
 let ident id = Ident.create_persistent (Ident.name id)
   
 let rec path = function
-    | Path.Pident id -> Path.Pident (ident id)
-    | Path.Pdot (t, name, pos) -> Path.Pdot (path t, Name.create name pos, pos)
-    | Path.Papply (t1, t2) -> Path.Papply (path t1, path t2)
+  | Path.Pident id -> Path.Pident (ident id)
+  | Path.Pdot (t, name, pos) -> Path.Pdot (path t, Name.create name pos, pos)
+  | Path.Papply (t1, t2) -> Path.Papply (path t1, path t2)
         
 module TypeTable = Hashtbl.Make(Types.TypeOps)
 open Types
   let binding_time = binding_time id in
   Name.create (name id) binding_time
       
-module Ident_internal : sig
-  val unsafe_create_with_stamp : ?flags: int -> string -> int -> Ident.t
-end= struct
-  (* Stamp is untouchable outside of ident.ml. A dirty
-     workaround *)
-  type t = { stamp: int; name: string; mutable flags: int }
-  let to_ident (id : t) = (Obj.magic id : Ident.t)
-    
-  (* It is dangerous operation! *)        
-    let unsafe_create_with_stamp ?(flags=0) name stamp =
-      to_ident { stamp = stamp; name = name; flags = flags }
-end
-    
-let unsafe_create_with_stamp = Ident_internal.unsafe_create_with_stamp
+let create_with_stamp ?(flags=0) name stamp =
+  { stamp = stamp; name = name; flags = flags }
 
 let format ppf id = Format.pp_print_string ppf (name id)
 
 let parse s =
   let s, pos = Name.parse s in
-  let id = unsafe_create_with_stamp s pos in
+  let id = create_with_stamp s pos in
   (* CR jfuruse: actually 0 is global and should be printed as 'G'
      Current 'G' means -1 *)
   if pos = 0 then make_global id;
 
 val name : t -> Name.t
 val format : Format.formatter -> t -> unit
-val unsafe_create_with_stamp : ?flags:int -> string -> int -> t
-  (** create an ident with given flags and stamp *)
+val create_with_stamp : ?flags:int -> string -> int -> t
 val parse : Name.t -> t
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.