@@ -1005,13 +1005,14 @@ and copy_module_type :
10051005 Ast_504.Parsetree. pmty_loc;
10061006 Ast_504.Parsetree. pmty_attributes;
10071007 } ->
1008+ let loc = copy_location pmty_loc in
10081009 {
1009- Ast_505.Parsetree. pmty_desc = copy_module_type_desc pmty_desc;
1010- Ast_505.Parsetree. pmty_loc = copy_location pmty_loc ;
1010+ Ast_505.Parsetree. pmty_desc = copy_module_type_desc_with_loc ~loc pmty_desc;
1011+ Ast_505.Parsetree. pmty_loc = loc ;
10111012 Ast_505.Parsetree. pmty_attributes = copy_attributes pmty_attributes;
10121013 }
10131014
1014- and copy_module_type_desc :
1015+ and copy_module_type_desc_with_loc ~ loc :
10151016 Ast_504.Parsetree. module_type_desc -> Ast_505.Parsetree. module_type_desc =
10161017 function
10171018 | Ast_504.Parsetree. Pmty_ident x0 ->
@@ -1031,6 +1032,9 @@ and copy_module_type_desc :
10311032 | Ast_504.Parsetree. Pmty_alias x0 ->
10321033 Ast_505.Parsetree. Pmty_alias (copy_loc copy_longident x0)
10331034
1035+ and copy_module_type_desc mty_desc =
1036+ copy_module_type_desc_with_loc ~loc: Location. none mty_desc
1037+
10341038and copy_functor_parameter :
10351039 Ast_504.Parsetree. functor_parameter -> Ast_505.Parsetree. functor_parameter =
10361040 function
@@ -1046,12 +1050,14 @@ and copy_signature : Ast_504.Parsetree.signature -> Ast_505.Parsetree.signature
10461050and copy_signature_item :
10471051 Ast_504.Parsetree. signature_item -> Ast_505.Parsetree. signature_item =
10481052 fun { Ast_504.Parsetree. psig_desc; Ast_504.Parsetree. psig_loc } ->
1053+ let loc = copy_location psig_loc in
10491054 {
1050- Ast_505.Parsetree. psig_desc = copy_signature_item_desc psig_desc;
1051- Ast_505.Parsetree. psig_loc = copy_location psig_loc;
1055+ Ast_505.Parsetree. psig_desc =
1056+ copy_signature_item_desc_with_loc ~loc psig_desc;
1057+ Ast_505.Parsetree. psig_loc = loc;
10521058 }
10531059
1054- and copy_signature_item_desc :
1060+ and copy_signature_item_desc_with_loc ~ loc :
10551061 Ast_504.Parsetree. signature_item_desc ->
10561062 Ast_505.Parsetree. signature_item_desc = function
10571063 | Ast_504.Parsetree. Psig_value x0 ->
@@ -1086,9 +1092,16 @@ and copy_signature_item_desc :
10861092 (List. map copy_class_type_declaration x0)
10871093 | Ast_504.Parsetree. Psig_attribute x0 ->
10881094 Ast_505.Parsetree. Psig_attribute (copy_attribute x0)
1095+ | Ast_504.Parsetree. Psig_extension (({ txt; _ }, payload), attr)
1096+ when String. equal txt Encoding_505.Ext_name. external_psig ->
1097+ let desc = Encoding_505.To_504. decode_external_psig ~loc payload attr in
1098+ copy_signature_item_desc_with_loc ~loc desc
10891099 | Ast_504.Parsetree. Psig_extension (x0 , x1 ) ->
10901100 Ast_505.Parsetree. Psig_extension (copy_extension x0, copy_attributes x1)
10911101
1102+ and copy_signature_item_desc sigi_desc =
1103+ copy_signature_item_desc_with_loc ~loc: Location. none sigi_desc
1104+
10921105and copy_module_declaration :
10931106 Ast_504.Parsetree. module_declaration -> Ast_505.Parsetree. module_declaration
10941107 =
@@ -1255,12 +1268,14 @@ and copy_structure : Ast_504.Parsetree.structure -> Ast_505.Parsetree.structure
12551268and copy_structure_item :
12561269 Ast_504.Parsetree. structure_item -> Ast_505.Parsetree. structure_item =
12571270 fun { Ast_504.Parsetree. pstr_desc; Ast_504.Parsetree. pstr_loc } ->
1271+ let loc = copy_location pstr_loc in
12581272 {
1259- Ast_505.Parsetree. pstr_desc = copy_structure_item_desc pstr_desc;
1260- Ast_505.Parsetree. pstr_loc = copy_location pstr_loc;
1273+ Ast_505.Parsetree. pstr_desc =
1274+ copy_structure_item_desc_with_loc ~loc pstr_desc;
1275+ Ast_505.Parsetree. pstr_loc = loc;
12611276 }
12621277
1263- and copy_structure_item_desc :
1278+ and copy_structure_item_desc_with_loc ~ loc :
12641279 Ast_504.Parsetree. structure_item_desc ->
12651280 Ast_505.Parsetree. structure_item_desc = function
12661281 | Ast_504.Parsetree. Pstr_eval (x0 , x1 ) ->
@@ -1294,9 +1309,18 @@ and copy_structure_item_desc :
12941309 Ast_505.Parsetree. Pstr_include (copy_include_declaration x0)
12951310 | Ast_504.Parsetree. Pstr_attribute x0 ->
12961311 Ast_505.Parsetree. Pstr_attribute (copy_attribute x0)
1312+ | Ast_504.Parsetree. Pstr_extension (({ txt; _ }, payload), attr)
1313+ when String. equal txt Encoding_505.Ext_name. external_pstr_type ->
1314+ let desc =
1315+ Encoding_505.To_504. decode_external_pstr_type ~loc payload attr
1316+ in
1317+ copy_structure_item_desc_with_loc ~loc desc
12971318 | Ast_504.Parsetree. Pstr_extension (x0 , x1 ) ->
12981319 Ast_505.Parsetree. Pstr_extension (copy_extension x0, copy_attributes x1)
12991320
1321+ and copy_structure_item_desc stri_desc =
1322+ copy_structure_item_desc_with_loc ~loc: Location. none stri_desc
1323+
13001324and copy_value_constraint :
13011325 Ast_504.Parsetree. value_constraint -> Ast_505.Parsetree. value_constraint =
13021326 function
0 commit comments