@@ -1037,60 +1037,47 @@ and apply_sig_map_sg s (sg : Component.Signature.t) =
1037
1037
let items, removed, dont_recompile = apply_sig_map s sg.items sg.removed in
1038
1038
{ sg with items; removed; compiled = sg.compiled && dont_recompile }
1039
1039
1040
- and apply_sig_map s items removed =
1040
+ and apply_sig_map_item s item =
1041
1041
let open Component.Signature in
1042
- let rec inner items acc =
1043
- match items with
1044
- | [] -> List. rev acc
1045
- | Module (id , r , m ) :: rest ->
1046
- inner rest
1047
- (Module
1048
- ( id,
1049
- r,
1050
- Component.Delayed. put (fun () ->
1051
- module_ s (Component.Delayed. get m)) )
1052
- :: acc)
1053
- | ModuleSubstitution (id , m ) :: rest ->
1054
- inner rest (ModuleSubstitution (id, module_substitution s m) :: acc)
1055
- | ModuleType (id , mt ) :: rest ->
1056
- inner rest
1057
- (ModuleType
1058
- ( id,
1059
- Component.Delayed. put (fun () ->
1060
- module_type s (Component.Delayed. get mt)) )
1061
- :: acc)
1062
- | ModuleTypeSubstitution (id , mt ) :: rest ->
1063
- inner rest
1064
- (ModuleTypeSubstitution (id, module_type_substitution s mt) :: acc)
1065
- | Type (id , r , t ) :: rest ->
1066
- inner rest
1067
- (Type
1068
- ( id,
1069
- r,
1070
- Component.Delayed. put (fun () ->
1071
- type_ s (Component.Delayed. get t)) )
1072
- :: acc)
1073
- | TypeSubstitution (id , t ) :: rest ->
1074
- inner rest (TypeSubstitution (id, type_ s t) :: acc)
1075
- | Exception (id , e ) :: rest ->
1076
- inner rest (Exception (id, exception_ s e) :: acc)
1077
- | TypExt e :: rest -> inner rest (TypExt (extension s e) :: acc)
1078
- | Value (id , v ) :: rest ->
1079
- inner rest
1080
- (Value
1081
- ( id,
1082
- Component.Delayed. put (fun () ->
1083
- value s (Component.Delayed. get v)) )
1084
- :: acc)
1085
- | Class (id , r , c ) :: rest -> inner rest (Class (id, r, class_ s c) :: acc)
1086
- | ClassType (id , r , c ) :: rest ->
1087
- inner rest (ClassType (id, r, class_type s c) :: acc)
1088
- | Include i :: rest -> inner rest (Include (include_ s i) :: acc)
1089
- | Open o :: rest -> inner rest (Open (open_ s o) :: acc)
1090
- | Comment c :: rest -> inner rest (Comment c :: acc)
1091
- in
1042
+ match item with
1043
+ | Module (id , r , m ) ->
1044
+ Module
1045
+ ( id,
1046
+ r,
1047
+ Component.Delayed. put (fun () -> module_ s (Component.Delayed. get m))
1048
+ )
1049
+ | ModuleSubstitution (id , m ) ->
1050
+ ModuleSubstitution (id, module_substitution s m)
1051
+ | ModuleType (id , mt ) ->
1052
+ ModuleType
1053
+ ( id,
1054
+ Component.Delayed. put (fun () ->
1055
+ module_type s (Component.Delayed. get mt)) )
1056
+ | ModuleTypeSubstitution (id , mt ) ->
1057
+ ModuleTypeSubstitution (id, module_type_substitution s mt)
1058
+ | Type (id , r , t ) ->
1059
+ Type
1060
+ ( id,
1061
+ r,
1062
+ Component.Delayed. put (fun () -> type_ s (Component.Delayed. get t)) )
1063
+ | TypeSubstitution (id , t ) -> TypeSubstitution (id, type_ s t)
1064
+ | Exception (id , e ) -> Exception (id, exception_ s e)
1065
+ | TypExt e -> TypExt (extension s e)
1066
+ | Value (id , v ) ->
1067
+ Value
1068
+ (id, Component.Delayed. put (fun () -> value s (Component.Delayed. get v)))
1069
+ | Class (id , r , c ) -> Class (id, r, class_ s c)
1070
+ | ClassType (id , r , c ) -> ClassType (id, r, class_type s c)
1071
+ | Include i -> Include (include_ s i)
1072
+ | Open o -> Open (open_ s o)
1073
+ | Comment c -> Comment c
1074
+
1075
+ and apply_sig_map_items s items =
1076
+ List. rev_map (apply_sig_map_item s) items |> List. rev
1077
+
1078
+ and apply_sig_map s items removed =
1092
1079
let dont_recompile =
1093
1080
List. length s.path_invalidating_modules = 0
1094
1081
&& List. length s.module_type_of_invalidating_modules = 0
1095
1082
in
1096
- (inner items [] , removed_items s removed, dont_recompile)
1083
+ (apply_sig_map_items s items , removed_items s removed, dont_recompile)
0 commit comments