File tree Expand file tree Collapse file tree 6 files changed +19
-16
lines changed Expand file tree Collapse file tree 6 files changed +19
-16
lines changed Original file line number Diff line number Diff line change 12
12
13
13
# 10.1.4
14
14
15
+ #### :bug : Bug Fix
16
+ - Fix implementation of directives
17
+
15
18
# 10.1.3
16
19
17
20
#### :rocket : New Feature
Original file line number Diff line number Diff line change @@ -127,7 +127,15 @@ let no_export (rest : Parsetree.structure) : Parsetree.structure =
127
127
]
128
128
| _ -> rest
129
129
130
+ let process_attributes items =
131
+ items |> List. iter(fun (item : Parsetree.structure_item ) -> match item.pstr_desc with
132
+ | Pstr_attribute ({ txt = " directive" },
133
+ PStr [ { pstr_desc = Pstr_eval ({ pexp_desc = Pexp_constant (Pconst_string (d, _)) }, _) } ]) ->
134
+ Js_config. directives := ! Js_config. directives @ [d]
135
+ | _ -> () )
136
+
130
137
let after_parsing_impl ppf outputprefix (ast : Parsetree.structure ) =
138
+ process_attributes ast;
131
139
if ! Clflags. only_parse = false then (
132
140
Js_config. all_module_aliases :=
133
141
! Clflags. assume_no_mli = Mli_non_exists && all_module_alias ast;
Original file line number Diff line number Diff line change @@ -475,10 +475,6 @@ let structure_item_mapper (self : mapper) (str : Parsetree.structure_item) :
475
475
[ { pvb_pat; pvb_expr; pvb_attributes; pvb_loc } ] );
476
476
})
477
477
| Pstr_attribute ({ txt = "bs.config" | "config" } , _ ) -> str
478
- | Pstr_attribute ({ txt = " directive" },
479
- PStr [ { pstr_desc = Pstr_eval ({ pexp_desc = Pexp_constant (Pconst_string (d, _)) }, _) } ]) ->
480
- Js_config. directives := d :: ! Js_config. directives;
481
- str
482
478
| _ -> default_mapper.structure_item self str
483
479
484
480
let local_module_name =
Original file line number Diff line number Diff line change @@ -273363,10 +273363,6 @@ let structure_item_mapper (self : mapper) (str : Parsetree.structure_item) :
273363
273363
[ { pvb_pat; pvb_expr; pvb_attributes; pvb_loc } ] );
273364
273364
})
273365
273365
| Pstr_attribute ({ txt = "bs.config" | "config" }, _) -> str
273366
- | Pstr_attribute ({ txt = "directive" },
273367
- PStr [ { pstr_desc = Pstr_eval ({ pexp_desc = Pexp_constant (Pconst_string (d, _)) }, _) } ]) ->
273368
- Js_config.directives := d :: !Js_config.directives;
273369
- str
273370
273366
| _ -> default_mapper.structure_item self str
273371
273367
273372
273368
let local_module_name =
Original file line number Diff line number Diff line change @@ -273363,10 +273363,6 @@ let structure_item_mapper (self : mapper) (str : Parsetree.structure_item) :
273363
273363
[ { pvb_pat; pvb_expr; pvb_attributes; pvb_loc } ] );
273364
273364
})
273365
273365
| Pstr_attribute ({ txt = "bs.config" | "config" }, _) -> str
273366
- | Pstr_attribute ({ txt = "directive" },
273367
- PStr [ { pstr_desc = Pstr_eval ({ pexp_desc = Pexp_constant (Pconst_string (d, _)) }, _) } ]) ->
273368
- Js_config.directives := d :: !Js_config.directives;
273369
- str
273370
273366
| _ -> default_mapper.structure_item self str
273371
273367
273372
273368
let local_module_name =
Original file line number Diff line number Diff line change @@ -283760,10 +283760,6 @@ let structure_item_mapper (self : mapper) (str : Parsetree.structure_item) :
283760
283760
[ { pvb_pat; pvb_expr; pvb_attributes; pvb_loc } ] );
283761
283761
})
283762
283762
| Pstr_attribute ({ txt = "bs.config" | "config" }, _) -> str
283763
- | Pstr_attribute ({ txt = "directive" },
283764
- PStr [ { pstr_desc = Pstr_eval ({ pexp_desc = Pexp_constant (Pconst_string (d, _)) }, _) } ]) ->
283765
- Js_config.directives := d :: !Js_config.directives;
283766
- str
283767
283763
| _ -> default_mapper.structure_item self str
283768
283764
283769
283765
let local_module_name =
@@ -294305,7 +294301,15 @@ let no_export (rest : Parsetree.structure) : Parsetree.structure =
294305
294301
]
294306
294302
| _ -> rest
294307
294303
294304
+ let process_attributes items =
294305
+ items |> List.iter(fun (item : Parsetree.structure_item) -> match item.pstr_desc with
294306
+ | Pstr_attribute ({ txt = "directive" },
294307
+ PStr [ { pstr_desc = Pstr_eval ({ pexp_desc = Pexp_constant (Pconst_string (d, _)) }, _) } ]) ->
294308
+ Js_config.directives := !Js_config.directives @ [d]
294309
+ | _ -> ())
294310
+
294308
294311
let after_parsing_impl ppf outputprefix (ast : Parsetree.structure) =
294312
+ process_attributes ast;
294309
294313
if !Clflags.only_parse = false then (
294310
294314
Js_config.all_module_aliases :=
294311
294315
!Clflags.assume_no_mli = Mli_non_exists && all_module_alias ast;
You can’t perform that action at this time.
0 commit comments