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:
parent
b67f17bc22
commit
b8679d2791
|
@ -28,23 +28,6 @@ module File = struct
|
||||||
{ name : string
|
{ name : string
|
||||||
; syntax : Syntax.t
|
; 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
|
end
|
||||||
|
|
||||||
type t =
|
type t =
|
||||||
|
|
|
@ -28,8 +28,6 @@ module File : sig
|
||||||
{ name : string
|
{ name : string
|
||||||
; syntax: Syntax.t
|
; syntax: Syntax.t
|
||||||
}
|
}
|
||||||
|
|
||||||
val to_ocaml : t -> t
|
|
||||||
end
|
end
|
||||||
|
|
||||||
(** Representation of a module. It is guaranteed that at least one of
|
(** Representation of a module. It is guaranteed that at least one of
|
||||||
|
|
|
@ -422,7 +422,12 @@ let setup_reason_rules sctx ~dir (m : Module.t) =
|
||||||
match f.syntax with
|
match f.syntax with
|
||||||
| OCaml -> f
|
| OCaml -> f
|
||||||
| Reason ->
|
| 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);
|
SC.add_rule sctx (rule f.name ml.name);
|
||||||
ml)
|
ml)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue