Simplify code using Module.dir

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-08-31 17:52:44 +03:00
parent 28b311cf95
commit 18abaa7def
1 changed files with 5 additions and 15 deletions

View File

@ -169,22 +169,12 @@ let wrapped_compat t =
intf = None
; impl =
Some (
let path =
match t.intf, t.impl with
| Some _, Some impl
| None, Some impl -> impl.path
| Some intf, _ -> intf.path
| None, None -> assert false
in
let path =
Path.L.relative (Path.parent_exn path)
[ ".wrapped_compat"
; Path.basename path
]
in
let (base, _) = Path.split_extension path in
{ syntax = OCaml
; path = Path.extend_basename base ~suffix:".ml-gen"
; path =
Path.L.relative (dir t)
[ ".wrapped_compat"
; Name.to_string t.name ^ ".ml-gen"
]
}
)
}