Skip to content

Commit f7a218b

Browse files
committed
tweak, remove compatiblity api
1 parent 4ef7501 commit f7a218b

File tree

4 files changed

+17
-23
lines changed

4 files changed

+17
-23
lines changed

jscomp/syntax/ast_compatible.ml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,6 @@ let object_field l attrs ty =
273273

274274

275275

276-
let hash_label (x : poly_var_label) : hash_label = x.txt
277-
let label_of_name (x : poly_var_label) : string = x.txt
278276

279277
type args =
280278
(Asttypes.arg_label * Parsetree.expression) list

jscomp/syntax/ast_compatible.mli

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -197,9 +197,6 @@ type object_field =
197197
val object_field : Asttypes.label Asttypes.loc -> attributes -> core_type -> object_field
198198

199199

200-
val hash_label : poly_var_label -> hash_label
201-
202-
val label_of_name : poly_var_label -> string
203200

204201
type args =
205202
(Asttypes.arg_label * Parsetree.expression) list

jscomp/syntax/ast_derive_js_mapper.ml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -246,16 +246,17 @@ let init () =
246246
| Some row_fields ->
247247
let expConstantArray =
248248
Exp.ident {loc; txt = Longident.Lident constantArray} in
249+
(* let has_bs_as = ref false in *)
249250
let result : _ list =
250251
Ext_list.map row_fields (fun tag ->
251252
match tag with
252-
| Rtag (label, attrs, _, []) ->
253-
(Ast_compatible.hash_label label,
253+
| Rtag ({txt}, attrs, _, []) ->
254+
(txt,
254255
match Ast_attributes.iter_process_bs_string_as_ast attrs with
255256
| Some name ->
256257
name
257258
| None ->
258-
Ast_compatible.const_exp_string(Ast_compatible.label_of_name label)
259+
Ast_compatible.const_exp_string txt
259260
)
260261
| _ -> assert false (* checked by [is_enum_polyvar] *)
261262
) in

jscomp/syntax/ast_polyvar.ml

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,14 @@ let map_row_fields_into_ints ptyp_loc
3030
Ext_list.fold_left row_fields (0, [])
3131
(fun (i,acc) rtag ->
3232
match rtag with
33-
| Rtag (label, attrs, true, [])
33+
| Rtag ({txt}, attrs, true, [])
3434
->
35-
begin match Ast_attributes.iter_process_bs_int_as attrs with
36-
| Some i ->
37-
i + 1,
38-
((Ast_compatible.hash_label label , i):: acc )
39-
| None ->
40-
i + 1 ,
41-
((Ast_compatible.hash_label label , i):: acc )
42-
end
35+
let i =
36+
match Ast_attributes.iter_process_bs_int_as attrs with
37+
| Some i -> i | None -> i
38+
in
39+
i + 1,
40+
((txt , i):: acc )
4341
| _ ->
4442
Bs_syntaxerr.err ptyp_loc Invalid_bs_int_type
4543
) in
@@ -89,22 +87,22 @@ let map_row_fields_into_strings ptyp_loc
8987
Ext_list.fold_right row_fields (`Nothing, []) (fun tag (nullary, acc) ->
9088
match nullary, tag with
9189
| (`Nothing | `Null),
92-
Rtag (label, attrs, true, [])
90+
Rtag ({txt}, attrs, true, [])
9391
->
9492
let name =
9593
match Ast_attributes.iter_process_bs_string_as attrs with
9694
| Some name ->
9795
has_bs_as := true; name
98-
| None -> label.txt
99-
in `Null, (label.txt, name) :: acc
100-
| (`Nothing | `NonNull), Rtag(label, attrs, false, ([ _ ]))
96+
| None -> txt
97+
in `Null, (txt, name) :: acc
98+
| (`Nothing | `NonNull), Rtag({txt}, attrs, false, ([ _ ]))
10199
->
102100
let name =
103101
match Ast_attributes.iter_process_bs_string_as attrs with
104102
| Some name ->
105103
has_bs_as := true; name
106-
| None -> label.txt
107-
in `NonNull, (label.txt, name) :: acc
104+
| None -> txt
105+
in `NonNull, (txt, name) :: acc
108106
| _ -> Bs_syntaxerr.err ptyp_loc Invalid_bs_string_type
109107

110108
) in

0 commit comments

Comments
 (0)