Skip to content

Commit

Permalink
refactor: move j.ml{,i} (#844)
Browse files Browse the repository at this point in the history
* refactor: move `j.ml{,i}`

* refactor: make it clear we're parsing an interface
  • Loading branch information
anmonteiro authored Oct 27, 2023
1 parent 2a8fed8 commit aa895e1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions jscomp/core/dune
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(name melangelib)
(flags
(:standard -open Melange_compiler_libs))
(modules_without_implementation js_op)
(modules_without_implementation js_op j)
(libraries ext melange_compiler_libs melange_ffi ppxlib.ast dune-build-info))

(rule
Expand Down Expand Up @@ -37,23 +37,23 @@

(rule
(targets js_record_iter.ml)
(deps j.ml)
(deps j.mli)
(action
(with-stdout-to
%{targets}
(run ./gen/gen_traversal.exe --input %{deps} --mode record-iter))))

(rule
(targets js_record_map.ml)
(deps j.ml)
(deps j.mli)
(action
(with-stdout-to
%{targets}
(run ./gen/gen_traversal.exe --input %{deps} --mode record-map))))

(rule
(targets js_record_fold.ml)
(deps j.ml)
(deps j.mli)
(action
(with-stdout-to
%{targets}
Expand Down
2 changes: 1 addition & 1 deletion jscomp/core/gen/gen_traversal.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let parse fname =
end in
In_ch.with_file fname ~f:(fun ch ->
let lexbuf = Lexing.from_channel ch in
let ast = Parse.implementation lexbuf in
let ast = Parse.interface lexbuf in
ast)

let write_ast oc ~input_name ast =
Expand Down
8 changes: 4 additions & 4 deletions jscomp/core/gen/node_types.ml
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ let isSupported (def : Longident.t) names =
else `no
| _ -> `no

let get_type_defs (ast : Parsetree.structure) =
let get_type_defs (ast : Parsetree.signature) =
let types_with_deriving_definitions, deriving_attrs =
List.filter_map
~f:(fun { Parsetree.pstr_desc; _ } ->
match pstr_desc with
| Pstr_type (_, tdcls) -> (
~f:(fun { Parsetree.psig_desc; _ } ->
match psig_desc with
| Psig_type (_, tdcls) -> (
match List.rev tdcls with
| [] -> None
| { ptype_attributes = []; _ } :: _ -> None
Expand Down
File renamed without changes.

0 comments on commit aa895e1

Please sign in to comment.