@@ -79,6 +79,15 @@ let obj_type_as_js_obj_type = ref false
79
79
let uncurry_type = ref false
80
80
let obj_type_auto_uncurry = ref false
81
81
let non_export = ref false
82
+
83
+ let reset () =
84
+ record_as_js_object := None ;
85
+ obj_type_as_js_obj_type := false ;
86
+ uncurry_type := false ;
87
+ obj_type_auto_uncurry := false ;
88
+ non_export := false
89
+
90
+
82
91
let lift_js_type ~loc x = Typ. constr ~loc {txt = js_obj_type_id () ; loc} [x]
83
92
let lift_curry_type ~loc x = Typ. constr ~loc {txt = curry_type_id () ; loc} [x]
84
93
@@ -666,37 +675,40 @@ let make_call_back table ((x : Longident.t Asttypes.loc) , y) =
666
675
667
676
let rewrite_signature : (Parsetree.signature -> Parsetree.signature) ref =
668
677
ref (fun x ->
669
- match (x : Parsetree.signature ) with
670
- | {psig_desc = Psig_attribute ({txt = " bs.config" ; loc}, payload); _} :: rest
671
- ->
672
- begin
673
- Ast_payload. as_record_and_process loc payload
674
- (make_call_back signature_config_table) ;
675
- unsafe_mapper.signature unsafe_mapper rest
676
- end
677
- | _ ->
678
- unsafe_mapper.signature unsafe_mapper x
679
- )
678
+ let result =
679
+ match (x : Parsetree.signature ) with
680
+ | {psig_desc = Psig_attribute ({txt = " bs.config" ; loc}, payload); _} :: rest
681
+ ->
682
+ begin
683
+ Ast_payload. as_record_and_process loc payload
684
+ (make_call_back signature_config_table) ;
685
+ unsafe_mapper.signature unsafe_mapper rest
686
+ end
687
+ | _ ->
688
+ unsafe_mapper.signature unsafe_mapper x in
689
+ reset () ; result
690
+ )
680
691
681
692
let rewrite_implementation : (Parsetree.structure -> Parsetree.structure) ref =
682
693
ref (fun (x : Parsetree.structure ) ->
683
- match x with
684
- | {pstr_desc = Pstr_attribute ({txt = " bs.config" ; loc}, payload); _} :: rest
685
- ->
686
- begin
687
- Ast_payload. as_record_and_process loc payload
688
- (make_call_back structural_config_table) ;
689
- let rest = unsafe_mapper.structure unsafe_mapper rest in
690
- if ! non_export then
691
- [Str. include_ ~loc
692
- (Incl. mk ~loc
693
- (Mod. constraint_ ~loc
694
- (Mod. structure ~loc rest )
695
- (Mty. signature ~loc [] )
696
- ))]
697
- else rest
698
-
699
- end
700
- | _ ->
701
- unsafe_mapper.structure unsafe_mapper x )
694
+ let result =
695
+ match x with
696
+ | {pstr_desc = Pstr_attribute ({txt = " bs.config" ; loc}, payload); _} :: rest
697
+ ->
698
+ begin
699
+ Ast_payload. as_record_and_process loc payload
700
+ (make_call_back structural_config_table) ;
701
+ let rest = unsafe_mapper.structure unsafe_mapper rest in
702
+ if ! non_export then
703
+ [Str. include_ ~loc
704
+ (Incl. mk ~loc
705
+ (Mod. constraint_ ~loc
706
+ (Mod. structure ~loc rest )
707
+ (Mty. signature ~loc [] )
708
+ ))]
709
+ else rest
710
+ end
711
+ | _ ->
712
+ unsafe_mapper.structure unsafe_mapper x in
713
+ reset () ; result )
702
714
0 commit comments