Permalink
Browse files

Make the gen_ident function a bit more generic to be usable as a libr…

…ary function.
  • Loading branch information...
1 parent faba201 commit 83bd5e4332baec090ea140ef95aa842eb35e33d3 @samoht committed Nov 3, 2010
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/p4_type.ml
View
@@ -36,10 +36,10 @@ let split str sep =
end in
split_rec 0
-let ident_type_of _loc t =
+let gen_ident _loc gen t =
match List.rev (split t '.') with
| [] -> assert false
- | [m] -> <:expr< $lid:type_of m$ >>
+ | [m] -> <:expr< $lid:gen m$ >>
| last :: rev_rest ->
let id_last = type_of last in
let id_rev_rest = List.map (fun x -> <:ident< $uid:x$ >>) rev_rest in
@@ -124,7 +124,7 @@ let gen tds =
let freev = free_vars t in
let rec aux = function
| Var v when List.mem v freev
- -> <:expr< $ident_type_of _loc v$ >>
+ -> <:expr< $gen_ident _loc type_of v$ >>
| Var v -> <:expr< T.Var $str:v$ >>
| Rec (v, t) -> <:expr< T.Rec $str:v$ $aux t$ >>
| Ext (v, t) -> <:expr< T.Ext $str:v$ $aux t$ >>

0 comments on commit 83bd5e4

Please sign in to comment.