@@ -199,41 +199,45 @@ let handle_typ
199
199
ptyp_desc = Ptyp_object ( methods, closed_flag) ;
200
200
ptyp_loc = loc
201
201
} ->
202
-
202
+ let (+>) attr (typ : Parsetree.core_type ) =
203
+ {typ with ptyp_attributes = attr :: typ .ptyp_attributes} in
203
204
let methods =
204
205
List. fold_right (fun (label , ptyp_attrs , core_type ) acc ->
205
- let (label,ptyp_attrs, core_type) =
206
- (match Ast_attributes. process_attributes_rev ptyp_attrs with
207
- | `Nothing , _ ->
208
- label, ptyp_attrs , self.typ self core_type
209
- | `Uncurry , ptyp_attrs ->
210
- label , ptyp_attrs,
211
- self.typ self
212
- { core_type with
213
- ptyp_attributes =
214
- Ast_attributes. bs :: core_type .ptyp_attributes}
215
- | `Method , ptyp_attrs
216
- ->
217
- label , ptyp_attrs,
218
- self.typ self
219
- { core_type with
220
- ptyp_attributes =
221
- Ast_attributes. bs_method :: core_type .ptyp_attributes}
222
- | `Meth_callback , ptyp_attrs
223
- ->
224
- label , ptyp_attrs,
225
- self.typ self
226
- { core_type with
227
- ptyp_attributes =
228
- Ast_attributes. bs_this :: core_type .ptyp_attributes}) in
229
206
let get ty name attrs =
230
- name , attrs, ty in
207
+ let attrs, core_type =
208
+ match Ast_attributes. process_attributes_rev attrs with
209
+ | `Nothing , attrs -> attrs, core_type
210
+ | `Uncurry , attrs ->
211
+ attrs, Ast_attributes. bs +> ty
212
+ | `Method , _
213
+ -> Location. raise_errorf " bs.get/set conflicts with bs.meth"
214
+ | `Meth_callback , attrs ->
215
+ attrs, Ast_attributes. bs_this +> ty
216
+ in
217
+ name , attrs, self.typ self core_type in
231
218
let set ty name attrs =
232
- name, attrs,
233
- Ast_util. to_method_type loc self " " ty
234
- (Ast_literal. type_unit ~loc () ) in
219
+ let attrs, core_type =
220
+ match Ast_attributes. process_attributes_rev attrs with
221
+ | `Nothing , attrs -> attrs, core_type
222
+ | `Uncurry , attrs ->
223
+ attrs, Ast_attributes. bs +> ty
224
+ | `Method , _
225
+ -> Location. raise_errorf " bs.get/set conflicts with bs.meth"
226
+ | `Meth_callback , attrs ->
227
+ attrs, Ast_attributes. bs_this +> ty
228
+ in
229
+ name, attrs, Ast_util. to_method_type loc self " " core_type (Ast_literal. type_unit ~loc () ) in
235
230
let no ty =
236
- label, ptyp_attrs, ty in
231
+ let attrs, core_type =
232
+ match Ast_attributes. process_attributes_rev ptyp_attrs with
233
+ | `Nothing , attrs -> attrs, ty
234
+ | `Uncurry , attrs ->
235
+ attrs, Ast_attributes. bs +> ty
236
+ | `Method , attrs ->
237
+ attrs, Ast_attributes. bs_method +> ty
238
+ | `Meth_callback , attrs ->
239
+ attrs, Ast_attributes. bs_this +> ty in
240
+ label, ptyp_attrs, self.typ self core_type in
237
241
process_getter_setter ~no ~get ~set
238
242
loc label ptyp_attrs core_type acc
239
243
) methods [] in
0 commit comments