Skip to content

Commit deff89f

Browse files
committed
first round of clean up over Js.t
1. unsafe_downgrade is not needed
1 parent ee283b0 commit deff89f

File tree

9 files changed

+301
-340
lines changed

9 files changed

+301
-340
lines changed

jscomp/frontend/ast_comb.ml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,11 @@ let tuple_type_pair ?loc kind arity =
6262

6363

6464

65-
let js_obj_type_id =
66-
Ast_literal.Lid.js_obj
65+
6766

6867
let re_id =
6968
Ast_literal.Lid.js_re_id
7069

71-
let to_js_type loc x =
72-
Typ.constr ~loc {txt = js_obj_type_id; loc} [x]
7370

7471
let to_js_re_type loc =
7572
Typ.constr ~loc { txt = re_id ; loc} []

jscomp/frontend/ast_comb.mli

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ val tuple_type_pair :
4040
[< `Make | `Run ] ->
4141
int -> Parsetree.core_type * Parsetree.core_type list * Parsetree.core_type
4242

43-
val to_js_type :
44-
Location.t -> Parsetree.core_type -> Parsetree.core_type
45-
46-
4743

4844
val to_undefined_type :
4945
Location.t -> Parsetree.core_type -> Parsetree.core_type

jscomp/frontend/ast_core_type.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ let from_labels ~loc arity labels
116116
((Ext_list.init arity (fun i ->
117117
Typ.var ~loc ("a" ^ string_of_int i)))) in
118118
let result_type =
119-
Ast_comb.to_js_type loc
119+
120120
(Typ.object_ ~loc
121121
(Ext_list.map2 labels tyvars
122122
(fun x y -> Parsetree.Otag (x ,[], y))) Closed)
@@ -128,7 +128,6 @@ let from_labels ~loc arity labels
128128

129129

130130
let make_obj ~loc xs =
131-
Ast_comb.to_js_type loc
132131
(Typ.object_ ~loc xs Closed)
133132

134133

jscomp/frontend/ast_derive_js_mapper.ml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,6 @@ let init () =
432432
| Ptype_record label_declarations ->
433433

434434
let objType flag =
435-
Ast_comb.to_js_type loc @@
436435
Typ.object_
437436
(Ext_list.map label_declarations
438437
(fun {pld_name ; pld_type } ->

jscomp/frontend/ast_literal.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ module Lid = struct
5757
Ldot (js_oo , "Meth")
5858
let js_meth_callback : t =
5959
Ldot (js_oo, "Callback")
60-
let js_obj : t = Ldot (Lident "Js", "t")
60+
6161
let ignore_id : t = Ldot (Lident "Pervasives", "ignore")
6262
let hidden_field n : t = Lident ("I" ^ n)
6363
let js_null : t = Ldot (Lident "Js", "null")

jscomp/frontend/ast_literal.mli

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ module Lid : sig
4040
val js_oo : t
4141
val js_meth : t
4242
val js_meth_callback : t
43-
val js_obj : t
4443
val hidden_field : string -> t
4544
val ignore_id : t
4645
val js_null : t

jscomp/outcome_printer/tweaked_reason_oprint.cppo.ml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,6 @@ and print_simple_out_type ppf =
326326
fprintf ppf "@[<0>(%a)@ [%@this]@]" (print_out_type_1 ~uncurried:false) res
327327

328328
(* also ReScript-specific. Turns Js.t({. foo: bar}) into {. "foo": bar} *)
329-
| Otyp_constr (
330-
(Oide_dot ((Oide_ident "Js"), "t")),
331-
[Otyp_object (fields, rest)]
332-
) ->
333-
let dot = match rest with
334-
Some non_gen -> (if non_gen then "_" else "") ^ ".."
335-
| None -> "."
336-
in
337-
fprintf ppf "@[<2>{%s %a}@]" dot (print_object_fields ~quote_fields:true) fields
338329

339330
| Otyp_constr (id, tyl) ->
340331
pp_open_box ppf 0;

0 commit comments

Comments
 (0)