Skip to content

Commit 429192b

Browse files
committed
Tweak
1 parent b4aa98b commit 429192b

File tree

2 files changed

+6
-34
lines changed

2 files changed

+6
-34
lines changed

jscomp/syntax/ast_attributes.ml

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -226,54 +226,26 @@ let iter_process_bs_string_int_unwrap_uncurry attrs =
226226
) attrs;
227227
!st
228228

229-
(* let process_bs_string_int_unwrap_uncurry attrs =
230-
List.fold_left
231-
(fun (st,attrs)
232-
(({txt ; loc}, (payload : _ ) ) as attr : attr) ->
233-
match txt, st with
234-
| "bs.string", (`Nothing | `String)
235-
-> `String, attrs
236-
| "bs.int", (`Nothing | `Int)
237-
-> `Int, attrs
238-
| "bs.ignore", (`Nothing | `Ignore)
239-
-> `Ignore, attrs
240-
| "bs.unwrap", (`Nothing | `Unwrap)
241-
-> `Unwrap, attrs
242-
| "bs.uncurry", `Nothing
243-
->
244-
`Uncurry (Ast_payload.is_single_int payload), attrs
245-
(* Don't allow duplicated [bs.uncurry] since
246-
it may introduce inconsistency in arity
247-
*)
248-
| "bs.int", _
249-
| "bs.string", _
250-
| "bs.ignore", _
251-
| "bs.unwrap", _
252-
->
253-
Bs_syntaxerr.err loc Conflict_attributes
254-
| _ , _ -> st, (attr :: attrs )
255-
) (`Nothing, []) attrs *)
256-
257229

258230
let iter_process_bs_string_as (attrs : t) : string option =
259231
let st = ref None in
260-
List.iter
232+
Ext_list.iter attrs
261233
(fun
262-
(({txt ; loc}, payload ) as attr : attr) ->
234+
(({txt ; loc}, payload ) as attr ) ->
263235
match txt with
264236
| "bs.as"
265237
->
266238
if !st = None then
267239
match Ast_payload.is_single_string payload with
268240
| None ->
269241
Bs_syntaxerr.err loc Expect_string_literal
270-
| Some (v,_dec) ->
242+
| Some (v,_dec) ->
271243
Bs_ast_invariant.mark_used_bs_attribute attr ;
272244
st:= Some v
273245
else
274246
Bs_syntaxerr.err loc Duplicated_bs_as
275247
| _ -> ()
276-
) attrs;
248+
) ;
277249
!st
278250

279251
let has_bs_optional (attrs : t) : bool =

jscomp/syntax/ast_polyvar.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ let map_row_fields_into_strings ptyp_loc
9797
Ext_list.fold_right row_fields (`Nothing, []) (fun tag (nullary, acc) ->
9898
match nullary, tag with
9999
| (`Nothing | `Null),
100-
Parsetree.Rtag (label, attrs, true, [])
100+
Rtag (label, attrs, true, [])
101101
->
102102
begin match Ast_attributes.iter_process_bs_string_as attrs with
103103
| Some name ->
@@ -106,7 +106,7 @@ let map_row_fields_into_strings ptyp_loc
106106
| None ->
107107
`Null, ((hash_label label, label_of_name label) :: acc )
108108
end
109-
| (`Nothing | `NonNull), Parsetree.Rtag(label, attrs, false, ([ _ ]))
109+
| (`Nothing | `NonNull), Rtag(label, attrs, false, ([ _ ]))
110110
->
111111
begin match Ast_attributes.iter_process_bs_string_as attrs with
112112
| Some name ->

0 commit comments

Comments
 (0)