Skip to content

Commit 6ab595d

Browse files
committed
Redo removal method
1 parent 2848a80 commit 6ab595d

File tree

5 files changed

+3
-30
lines changed

5 files changed

+3
-30
lines changed

.mcp.json

Lines changed: 0 additions & 15 deletions
This file was deleted.

compiler/frontend/ast_attributes.ml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,12 @@ let process_method_attributes_rev (attrs : t) =
7474
({st with set = Some result}, acc)
7575
| _ -> (st, attr :: acc))
7676

77-
type attr_kind = Nothing | Meth_callback of attr | Method of attr
77+
type attr_kind = Nothing | Meth_callback of attr
7878

7979
let process_attributes_rev (attrs : t) : attr_kind * t =
80-
Ext_list.fold_left attrs (Nothing, [])
81-
(fun (st, acc) (({txt; loc}, _) as attr) ->
80+
Ext_list.fold_left attrs (Nothing, []) (fun (st, acc) (({txt}, _) as attr) ->
8281
match (txt, st) with
8382
| "this", (Nothing | Meth_callback _) -> (Meth_callback attr, acc)
84-
| "meth", (Nothing | Method _) -> (Method attr, acc)
85-
| "this", _ -> Bs_syntaxerr.err loc Conflict_bs_bs_this_bs_meth
8683
| _, _ -> (st, attr :: acc))
8784

8885
let external_attrs =

compiler/frontend/ast_attributes.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type ('a, 'b) st = {get: 'a option; set: 'b option}
2929

3030
val process_method_attributes_rev : t -> (bool * bool, [`Get | `No_get]) st * t
3131

32-
type attr_kind = Nothing | Meth_callback of attr | Method of attr
32+
type attr_kind = Nothing | Meth_callback of attr
3333

3434
val process_attributes_rev : t -> attr_kind * t
3535

compiler/frontend/ast_core_type_class_type.ml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
7575
match fst (Ast_attributes.process_attributes_rev ty.ptyp_attributes) with
7676
| Meth_callback _ ->
7777
Ast_typ_uncurry.to_method_callback_type loc self ~arity ty
78-
| Method _ -> Bs_ast_mapper.default_mapper.typ self ty
7978
| Nothing -> Bs_ast_mapper.default_mapper.typ self ty)
8079
| Ptyp_object (methods, closed_flag) ->
8180
let ( +> ) attr (typ : Parsetree.core_type) =
@@ -90,8 +89,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
9089
let attrs, core_type =
9190
match Ast_attributes.process_attributes_rev attrs with
9291
| Nothing, attrs -> (attrs, ty) (* #1678 *)
93-
| Method _, _ ->
94-
Location.raise_errorf ~loc "%@get/set conflicts with %@meth"
9592
| Meth_callback attr, attrs -> (attrs, attr +> ty)
9693
in
9794
Ast_compatible.object_field name attrs (self.typ self core_type)
@@ -100,8 +97,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
10097
let attrs, core_type =
10198
match Ast_attributes.process_attributes_rev attrs with
10299
| Nothing, attrs -> (attrs, ty)
103-
| Method _, _ ->
104-
Location.raise_errorf ~loc "%@get/set conflicts with %@meth"
105100
| Meth_callback attr, attrs -> (attrs, attr +> ty)
106101
in
107102
Ast_compatible.object_field name attrs
@@ -113,7 +108,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
113108
let attrs, core_type =
114109
match Ast_attributes.process_attributes_rev ptyp_attrs with
115110
| Nothing, attrs -> (attrs, ty)
116-
| Method attr, attrs -> (attrs, attr +> ty)
117111
| Meth_callback attr, attrs -> (attrs, attr +> ty)
118112
in
119113
Ast_compatible.object_field label attrs (self.typ self core_type)

compiler/frontend/bs_builtin_ppx.ml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ let expr_mapper ~async_context ~in_function_def (self : mapper)
102102
async_context := (old_in_function_def && !async_context) || async;
103103
in_function_def := true;
104104
Ast_async.make_function_async ~async (default_expr_mapper self e)
105-
| Method _, _ ->
106-
Location.raise_errorf ~loc:e.pexp_loc
107-
"%@meth is not supported in function expression"
108105
| Meth_callback _, pexp_attributes ->
109106
(* FIXME: does it make sense to have a label for [this] ? *)
110107
async_context := false;

0 commit comments

Comments
 (0)