Simplify naming of reason ast files

We don't need to preserve the .ml/.mli extension anymore.

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
This commit is contained in:
Jeremie Dimino 2018-07-11 15:38:47 +01:00 committed by Jérémie Dimino
parent b67f17bc22
commit b8679d2791
3 changed files with 6 additions and 20 deletions

View File

@ -28,23 +28,6 @@ module File = struct
{ name : string
; syntax : Syntax.t
}
let to_ocaml t =
match t.syntax with
| OCaml -> Exn.code_error "to_ocaml: can only convert reason Files"
["t.name", Sexp.To_sexp.string t.name]
| Reason ->
{ syntax = OCaml
; name =
let base, ext = Filename.split_extension t.name in
base ^ ".re" ^
(match Filename.extension t.name with
| ".re" -> ".ml"
| ".rei" -> ".mli"
| _ -> Exn.code_error "to_ocaml: unrecognized extension"
[ "name", Sexp.To_sexp.string t.name
; "ext", Sexp.To_sexp.string ext ])
}
end
type t =

View File

@ -28,8 +28,6 @@ module File : sig
{ name : string
; syntax: Syntax.t
}
val to_ocaml : t -> t
end
(** Representation of a module. It is guaranteed that at least one of

View File

@ -422,7 +422,12 @@ let setup_reason_rules sctx ~dir (m : Module.t) =
match f.syntax with
| OCaml -> f
| Reason ->
let ml = Module.File.to_ocaml f in
let ml =
{ Module.File.
syntax = OCaml
; name = f.name ^ ".ast"
}
in
SC.add_rule sctx (rule f.name ml.name);
ml)