Skip to content
Merged
Prev Previous commit
Next Next commit
@bs.this -> @this
  • Loading branch information
cknitt committed Feb 20, 2024
commit 64324222e258c56847605c5683ed48573f4cc6e6
6 changes: 2 additions & 4 deletions jscomp/frontend/ast_attributes.ml
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,9 @@ let process_attributes_rev (attrs : t) : attr_kind * t =
match (txt, st) with
| "bs", (Nothing | Uncurry _) ->
(Uncurry attr, acc) (* TODO: warn unused/duplicated attribute *)
| ("bs.this" | "this"), (Nothing | Meth_callback _) ->
(Meth_callback attr, acc)
| "this", (Nothing | Meth_callback _) -> (Meth_callback attr, acc)
| "meth", (Nothing | Method _) -> (Method attr, acc)
| ("bs" | "bs.this" | "this"), _ ->
Bs_syntaxerr.err loc Conflict_bs_bs_this_bs_meth
| ("bs" | "this"), _ -> Bs_syntaxerr.err loc Conflict_bs_bs_this_bs_meth
| _, _ -> (st, attr :: acc))

let process_bs (attrs : t) =
Expand Down
2 changes: 1 addition & 1 deletion jscomp/frontend/ast_typ_uncurry.mli
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ val to_uncurry_type : uncurry_type_gen

val to_method_callback_type : uncurry_type_gen
(** syntax:
{[ 'obj -> int -> int [@bs.this] ]}
{[ 'obj -> int -> int [@this] ]}
*)
2 changes: 1 addition & 1 deletion jscomp/frontend/ast_uncurry_gen.mli
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,5 @@ val to_method_callback :
Parsetree.expression ->
Parsetree.expression_desc
(** syntax:
{[fun [@bs.this] obj pat pat1 -> body]}
{[fun [@this] obj pat pat1 -> body]}
*)
2 changes: 1 addition & 1 deletion jscomp/ml/oprint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ and print_simple_out_type ppf =
| Otyp_constr (Oide_dot (Oide_dot (Oide_ident "Js_OO", "Callback" ), _),
[tyl])
->
fprintf ppf "@[<0>(%a@ [@bs.this])@]" print_out_type_1 tyl
fprintf ppf "@[<0>(%a@ [@this])@]" print_out_type_1 tyl
| Otyp_constr (id, tyl) ->
pp_open_box ppf 0;
print_typargs ppf tyl;
Expand Down
4 changes: 2 additions & 2 deletions jscomp/ounit_tests/ounit_cmd_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,15 @@ external ff :
(* #1510 *)
__LOC__ >:: begin fun _ ->
let should_err = bsc_check_eval {|
let should_fail = fun [@bs.this] (Some x) y u -> y + u
let should_fail = fun [@this] (Some x) y u -> y + u
|} in
OUnit.assert_bool __LOC__
(Ext_string.contain_substring should_err.stderr "simple")
end;

__LOC__ >:: begin fun _ ->
let should_err = bsc_check_eval {|
let should_fail = fun [@bs.this] (Some x as v) y u -> y + u
let should_fail = fun [@this] (Some x as v) y u -> y + u
|} in
(* Ounit_cmd_util.debug_output should_err; *)
OUnit.assert_bool __LOC__
Expand Down