Skip to content

Commit 91c465c

Browse files
committed
WIP
1 parent 249cb40 commit 91c465c

File tree

6 files changed

+3
-24
lines changed

6 files changed

+3
-24
lines changed

analysis/examples/larger-project/src/res_printer.res

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ let convertBsExternalAttribute = x =>
2828
| "bs.ignore" => "ignore"
2929
| "bs.inline" => "inline"
3030
| "bs.int" => "int"
31-
| "bs.meth" => "meth"
3231
| "bs.module" => "module"
3332
| "bs.new" => "new"
3433
| "bs.obj" => "obj"

analysis/src/CompletionDecorators.ml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,6 @@ could potentially raise.
117117

118118
Hint: Did you know you can run an interactive code analysis in your project by running the command `> ReScript: Start Code Analyzer`? Try it!|};
119119
] );
120-
( "meth",
121-
None,
122-
[
123-
{|The `@meth` decorator is used to call a function on a JavaScript object, and avoid issues with currying.
124-
125-
[Read more and see examples in the documentation](https://rescript-lang.org/syntax-lookup#meth-decorator).|};
126-
] );
127120
( "module",
128121
Some "module(\"$0\")",
129122
[

compiler/frontend/ast_attributes.ml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,13 @@ 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 =
8080
Ext_list.fold_left attrs (Nothing, [])
81-
(fun (st, acc) (({txt; loc}, _) as attr) ->
81+
(fun (st, acc) (({txt}, _) as attr) ->
8282
match (txt, st) with
8383
| "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
8684
| _, _ -> (st, attr :: acc))
8785

8886
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 & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +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 arg.lbl arg.typ body
78-
| Method _ ->
79-
(* Treat @meth as making the type uncurried, for backwards compatibility *)
80-
Ast_typ_uncurry.to_uncurry_type loc self arg.lbl arg.typ body
8178
| Nothing -> Bs_ast_mapper.default_mapper.typ self ty)
8279
| Ptyp_object (methods, closed_flag) ->
8380
let ( +> ) attr (typ : Parsetree.core_type) =
@@ -92,8 +89,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
9289
let attrs, core_type =
9390
match Ast_attributes.process_attributes_rev attrs with
9491
| Nothing, attrs -> (attrs, ty) (* #1678 *)
95-
| Method _, _ ->
96-
Location.raise_errorf ~loc "%@get/set conflicts with %@meth"
9792
| Meth_callback attr, attrs -> (attrs, attr +> ty)
9893
in
9994
Ast_compatible.object_field name attrs (self.typ self core_type)
@@ -102,8 +97,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
10297
let attrs, core_type =
10398
match Ast_attributes.process_attributes_rev attrs with
10499
| Nothing, attrs -> (attrs, ty)
105-
| Method _, _ ->
106-
Location.raise_errorf ~loc "%@get/set conflicts with %@meth"
107100
| Meth_callback attr, attrs -> (attrs, attr +> ty)
108101
in
109102
Ast_compatible.object_field name attrs
@@ -114,7 +107,6 @@ let typ_mapper (self : Bs_ast_mapper.mapper) (ty : Parsetree.core_type) =
114107
let attrs, core_type =
115108
match Ast_attributes.process_attributes_rev ptyp_attrs with
116109
| Nothing, attrs -> (attrs, ty)
117-
| Method attr, attrs -> (attrs, attr +> ty)
118110
| Meth_callback attr, attrs -> (attrs, attr +> ty)
119111
in
120112
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)