Skip to content

Commit d241c92

Browse files
authored
Fix cyclic dependencies core <-> frontend (#5915)
1 parent a713ff7 commit d241c92

12 files changed

+24
-13
lines changed

jscomp/core/dune

+1-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66
(run %{bin:cppo} %{env:CPPO_FLAGS=} %{input-file})))
77
(flags
88
(:standard -w +a-4-9-27-30-40-41-42-48-70))
9-
(libraries depends gentype js_parser outcome_printer))
9+
(libraries depends frontend gentype js_parser outcome_printer))
1010

1111
; There exist cyclic dependencies between core and frontend, therefore include frontend files here:
1212

13-
(copy_files# ../frontend/*.{ml,mli})
14-
1513
(copy_files# ../cmij/cmij_cache.{ml,mli})

jscomp/core/j.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ and for_ident = ident
7676
and for_direction = Js_op.direction_flag
7777
and property_map = (property_name * expression) list
7878
and length_object = Js_op.length_object
79-
and delim = | DNone | DStarJ | DJson
79+
and delim = External_arg_spec.delim = | DNone | DStarJ | DJson
8080

8181
and expression_desc =
8282
| Length of expression * length_object

jscomp/frontend/ast_attributes.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ let iter_process_bs_int_as (attrs : t) =
278278
| _ -> ());
279279
!st
280280

281-
type as_const_payload = Int of int | Str of string * J.delim
281+
type as_const_payload = Int of int | Str of string * External_arg_spec.delim
282282

283283
let iter_process_bs_string_or_int_as (attrs : Parsetree.attributes) =
284284
let st = ref None in

jscomp/frontend/ast_attributes.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ val has_bs_optional : t -> bool
5858

5959
val iter_process_bs_int_as : t -> int option
6060

61-
type as_const_payload = Int of int | Str of string * J.delim
61+
type as_const_payload = Int of int | Str of string * External_arg_spec.delim
6262
val iter_process_bs_string_or_int_as : t -> as_const_payload option
6363

6464
val process_derive_type : t -> derive_attr * t

jscomp/frontend/ast_utf8_string_interp.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ let to_string_ident : Longident.t = Ldot (Ldot (Lident "Js", "String2"), "make")
325325

326326
module Delim = struct
327327
let parse_processed = function
328-
| None -> Some J.DNone
328+
| None -> Some External_arg_spec.DNone
329329
| Some "json" -> Some DJson
330330
| Some "*j" -> Some DStarJ
331331
| _ -> None

jscomp/frontend/ast_utf8_string_interp.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,4 @@ val transform_test : string -> segment list
5858
val transform : Parsetree.expression -> string -> string -> Parsetree.expression
5959
val is_unicode_string : string -> bool
6060
val is_unescaped : string -> bool
61-
val parse_processed_delim : string option -> J.delim option
61+
val parse_processed_delim : string option -> External_arg_spec.delim option

jscomp/frontend/dune

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
(library
2+
(name frontend)
3+
(wrapped false)
4+
(preprocess
5+
(action
6+
(run %{bin:cppo} %{env:CPPO_FLAGS=} %{input-file})))
7+
(flags
8+
(:standard -w +a-4-9-40-42-70))
9+
(libraries common js_parser ml))

jscomp/frontend/external_arg_spec.ml

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,11 @@
2424

2525
(** type definitions for arguments to a function declared external *)
2626

27+
type delim = | DNone | DStarJ | DJson
28+
2729
type cst =
2830
| Arg_int_lit of int
29-
| Arg_string_lit of string * J.delim
31+
| Arg_string_lit of string * delim
3032

3133
type label_noname = Arg_label | Arg_empty | Arg_optional
3234

jscomp/frontend/external_arg_spec.mli

+4-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@
2222
* along with this program; if not, write to the Free Software
2323
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *)
2424

25+
type delim = | DNone | DStarJ | DJson
26+
2527
type cst = private
2628
| Arg_int_lit of int
27-
| Arg_string_lit of string * J.delim
29+
| Arg_string_lit of string * delim
2830

2931
type attr =
3032
| Poly_var_string of { descr : (string * string) list }
@@ -56,7 +58,7 @@ type params = param list
5658

5759
val cst_int : int -> cst
5860

59-
val cst_string : string -> J.delim -> cst
61+
val cst_string : string -> delim -> cst
6062

6163
val empty_label : label
6264

File renamed without changes.

jscomp/core/lam_constant.ml jscomp/frontend/lam_constant.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ type t =
4747
| Const_float of string
4848
| Const_int64 of int64
4949
| Const_pointer of string
50-
| Const_block of int * Lam_tag_info.t * t list
50+
| Const_block of int * Lambda.tag_info * t list
5151
| Const_float_array of string list
5252
| Const_some of t
5353
| Const_module_alias

jscomp/core/lam_constant.mli jscomp/frontend/lam_constant.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type t =
4343
| Const_float of string
4444
| Const_int64 of int64
4545
| Const_pointer of string
46-
| Const_block of int * Lam_tag_info.t * t list
46+
| Const_block of int * Lambda.tag_info * t list
4747
| Const_float_array of string list
4848
| Const_some of t
4949
(* eventually we can remove it, since we know

0 commit comments

Comments
 (0)