@@ -180556,9 +180556,9 @@ val add_structure : string -> (Parsetree.expression option -> unit) -> unit
180556
180556
180557
180557
val add_signature : string -> (Parsetree.expression option -> unit) -> unit
180558
180558
180559
- val iter_on_bs_config_stru : Parsetree.structure -> unit
180559
+ val process_str : Parsetree.structure -> unit
180560
180560
180561
- val iter_on_bs_config_sigi : Parsetree.signature -> unit
180561
+ val process_sig : Parsetree.signature -> unit
180562
180562
180563
180563
end = struct
180564
180564
#1 "ast_config.ml"
@@ -180602,7 +180602,15 @@ let signature_config_table : action_table ref = ref Map_string.empty
180602
180602
let add_signature k v =
180603
180603
signature_config_table := Map_string.add !signature_config_table k v
180604
180604
180605
- let rec iter_on_bs_config_stru (x : Parsetree.structure) =
180605
+ let process_directives str =
180606
+ Js_config.directives := []; (* Restt: multiple calls possible e.g. with bsc from the command-line *)
180607
+ str |> List.iter(fun (item : Parsetree.structure_item) -> match item.pstr_desc with
180608
+ | Pstr_attribute ({ txt = "directive" },
180609
+ PStr [ { pstr_desc = Pstr_eval ({ pexp_desc = Pexp_constant (Pconst_string (d, _)) }, _) } ]) ->
180610
+ Js_config.directives := !Js_config.directives @ [d]
180611
+ | _ -> ())
180612
+
180613
+ let rec iter_on_bs_config_str (x : Parsetree.structure) =
180606
180614
match x with
180607
180615
| [] -> ()
180608
180616
| {
@@ -180615,10 +180623,14 @@ let rec iter_on_bs_config_stru (x : Parsetree.structure) =
180615
180623
Ext_list.iter
180616
180624
(Ast_payload.ident_or_record_as_config loc payload)
180617
180625
(Ast_payload.table_dispatch !structural_config_table)
180618
- | { pstr_desc = Pstr_attribute _ } :: rest -> iter_on_bs_config_stru rest
180626
+ | { pstr_desc = Pstr_attribute _ } :: rest -> iter_on_bs_config_str rest
180619
180627
| _ :: _ -> ()
180620
180628
180621
- let rec iter_on_bs_config_sigi (x : Parsetree.signature) =
180629
+ let process_str str =
180630
+ iter_on_bs_config_str str;
180631
+ process_directives str
180632
+
180633
+ let rec iter_on_bs_config_sig (x : Parsetree.signature) =
180622
180634
match x with
180623
180635
| [] -> ()
180624
180636
| {
@@ -180631,9 +180643,10 @@ let rec iter_on_bs_config_sigi (x : Parsetree.signature) =
180631
180643
Ext_list.iter
180632
180644
(Ast_payload.ident_or_record_as_config loc payload)
180633
180645
(Ast_payload.table_dispatch !signature_config_table)
180634
- | { psig_desc = Psig_attribute _ } :: rest -> iter_on_bs_config_sigi rest
180646
+ | { psig_desc = Psig_attribute _ } :: rest -> iter_on_bs_config_sig rest
180635
180647
| _ :: _ -> ()
180636
180648
180649
+ let process_sig s = iter_on_bs_config_sig s
180637
180650
end
180638
180651
module Ccomp : sig
180639
180652
#1 "ccomp.mli"
@@ -286751,7 +286764,7 @@ let unsafe_mapper = Bs_builtin_ppx.mapper
286751
286764
286752
286765
let rewrite_signature (ast : Parsetree.signature) : Parsetree.signature =
286753
286766
Bs_ast_invariant.iter_warnings_on_sigi ast;
286754
- Ast_config.iter_on_bs_config_sigi ast;
286767
+ Ast_config.process_sig ast;
286755
286768
let ast =
286756
286769
match !Js_config.jsx_version with
286757
286770
| None -> ast
@@ -286771,7 +286784,7 @@ let rewrite_signature (ast : Parsetree.signature) : Parsetree.signature =
286771
286784
286772
286785
let rewrite_implementation (ast : Parsetree.structure) : Parsetree.structure =
286773
286786
Bs_ast_invariant.iter_warnings_on_stru ast;
286774
- Ast_config.iter_on_bs_config_stru ast;
286787
+ Ast_config.process_str ast;
286775
286788
let ast =
286776
286789
match !Js_config.jsx_version with
286777
286790
| None -> ast
@@ -294220,7 +294233,7 @@ let process_with_gentype cmt_file =
294220
294233
294221
294234
let after_parsing_sig ppf outputprefix ast =
294222
294235
if !Clflags.only_parse = false then (
294223
- Ast_config.iter_on_bs_config_sigi ast;
294236
+ Ast_config.process_sig ast;
294224
294237
if !Js_config.modules then
294225
294238
output_deps_set !Location.input_name
294226
294239
(Ast_extract.read_parse_and_extract Mli ast);
@@ -294313,7 +294326,7 @@ let after_parsing_impl ppf outputprefix (ast : Parsetree.structure) =
294313
294326
if !Clflags.only_parse = false then (
294314
294327
Js_config.all_module_aliases :=
294315
294328
!Clflags.assume_no_mli = Mli_non_exists && all_module_alias ast;
294316
- Ast_config.iter_on_bs_config_stru ast;
294329
+ Ast_config.process_str ast;
294317
294330
let ast = if !Js_config.no_export then no_export ast else ast in
294318
294331
if !Js_config.modules then
294319
294332
output_deps_set !Location.input_name
0 commit comments