Skip to content

Commit cfd4eb9

Browse files
committed
Remove more "bs."
1 parent 2e68cb6 commit cfd4eb9

32 files changed

+51
-52
lines changed

jscomp/build_tests/cmd/input.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ var bsc_exe_path = require("../../../scripts/bin_path").bsc_exe;
77
var react = `
88
type u
99
10-
external a : u = "react" [@@bs.module]
10+
external a : u = "react" [@@module]
1111
12-
external b : unit -> int = "bool" [@@bs.module "react"]
12+
external b : unit -> int = "bool" [@@module "react"]
1313
1414
let v = a
1515
let h = b ()
@@ -19,9 +19,9 @@ var foo_react = `
1919
type bla
2020
2121
22-
external foo : bla = "foo.react" [@@bs.module]
22+
external foo : bla = "foo.react" [@@module]
2323
24-
external bar : unit -> bla = "bar" [@@bs.val] [@@bs.module "foo.react"]
24+
external bar : unit -> bla = "bar" [@@bs.val] [@@module "foo.react"]
2525
2626
let c = foo
2727

jscomp/frontend/ast_attributes.ml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ let process_attributes_rev (attrs : t) : attr_kind * t =
8888
(Uncurry attr, acc) (* TODO: warn unused/duplicated attribute *)
8989
| ("bs.this" | "this"), (Nothing | Meth_callback _) ->
9090
(Meth_callback attr, acc)
91-
| ("bs.meth" | "meth"), (Nothing | Method _) -> (Method attr, acc)
91+
| "meth", (Nothing | Method _) -> (Method attr, acc)
9292
| ("bs" | "bs.this" | "this"), _ ->
9393
Bs_syntaxerr.err loc Conflict_bs_bs_this_bs_meth
9494
| _, _ -> (st, attr :: acc))
@@ -154,8 +154,7 @@ let rs_externals (attrs : t) pval_prim =
154154
|| Ext_array.exists external_attrs (fun (x : string) -> txt = x))
155155
|| prims_to_be_encoded pval_prim
156156

157-
let is_inline : attr -> bool =
158-
fun ({txt}, _) -> txt = "bs.inline" || txt = "inline"
157+
let is_inline : attr -> bool = fun ({txt}, _) -> txt = "inline"
159158

160159
let has_inline_payload (attrs : t) = Ext_list.find_first attrs is_inline
161160

@@ -223,8 +222,8 @@ let iter_process_bs_string_int_unwrap_uncurry (attrs : t) =
223222
Ext_list.iter attrs (fun (({txt; loc = _}, (payload : _)) as attr) ->
224223
match txt with
225224
| "bs.string" | "string" -> assign `String attr
226-
| "bs.int" | "int" -> assign `Int attr
227-
| "bs.ignore" | "ignore" -> assign `Ignore attr
225+
| "int" -> assign `Int attr
226+
| "ignore" -> assign `Ignore attr
228227
| "bs.unwrap" | "unwrap" -> assign `Unwrap attr
229228
| "bs.uncurry" | "uncurry" ->
230229
assign (`Uncurry (Ast_payload.is_single_int payload)) attr

jscomp/frontend/ast_external_process.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ let parse_external_attributes (no_arguments : bool) (prim_name_check : string)
266266
st with
267267
call_name = Some (name_from_payload_or_prim ~loc payload);
268268
}
269-
| "bs.module" | "module" -> (
269+
| "module" -> (
270270
match payload with
271271
| PStr
272272
[
@@ -391,7 +391,7 @@ let parse_external_attributes (no_arguments : bool) (prim_name_check : string)
391391
{st with set_name = Some (name_from_payload_or_prim ~loc payload)}
392392
| "get" ->
393393
{st with get_name = Some (name_from_payload_or_prim ~loc payload)}
394-
| "bs.new" | "new" ->
394+
| "new" ->
395395
{st with new_name = Some (name_from_payload_or_prim ~loc payload)}
396396
| "set_index" ->
397397
if String.length prim_name_check <> 0 then

jscomp/frontend/external_arg_spec.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type cst = private Arg_int_lit of int | Arg_string_lit of string * delim
2929
type attr =
3030
| Poly_var_string of {descr: (string * string) list}
3131
| Poly_var of {descr: (string * string) list option}
32-
| Int of (string * int) list (* ([`a | `b ] [@bs.int])*)
32+
| Int of (string * int) list (* ([`a | `b ] [@int])*)
3333
| Arg_cst of cst
3434
| Fn_uncurry_arity of
3535
int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)

jscomp/frontend/typemod_hide.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ let no_type_defined (x : Parsetree.structure_item) =
4646
generated code from:
4747
{[
4848
external %private x : int -> int = "x"
49-
[@@bs.module "./x"]
49+
[@@module "./x"]
5050
]}
5151
*)
5252
| _ -> false

jscomp/gentype/Annotation.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ let toString annotation =
2020
let tagIsGenType s = s = "genType" || s = "gentype"
2121
let tagIsGenTypeAs s = s = "genType.as" || s = "gentype.as"
2222
let tagIsAs s = s = "as"
23-
let tagIsInt s = s = "bs.int" || s = "int"
23+
let tagIsInt s = s = "int"
2424
let tagIsString s = s = "bs.string" || s = "string"
2525

2626
let tagIsTag s = s = "tag"

jscomp/gentype/TranslateStructure.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ and translateStructureItem ~config ~outputFileRelative ~resolver ~typeEnv
293293
|> Translation.combine
294294
| {
295295
str_desc =
296-
(* ReScript's encoding of bs.module: include with constraint. *)
296+
(* ReScript's encoding of @module: include with constraint. *)
297297
Tstr_include
298298
{
299299
incl_mod =

jscomp/gentype/Translation.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ let translateValue ~attributes ~config ~docString ~outputFileRelative ~resolver
112112

113113
(**
114114
[@genType]
115-
[@bs.module] external myBanner : ReasonReact.reactClass = "./MyBanner";
115+
[@module] external myBanner : ReasonReact.reactClass = "./MyBanner";
116116
*)
117117
let translatePrimitive ~config ~outputFileRelative ~resolver ~typeEnv
118118
(valueDescription : Typedtree.value_description) : t =

jscomp/ml/oprint.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ and print_simple_out_type ppf =
288288
Otyp_arrow ("", Otyp_constr (Oide_ident "unit", []),tyl)
289289
else tyl
290290
in
291-
fprintf ppf "@[<0>(%a@ [@bs.meth])@]" print_out_type_1 res
291+
fprintf ppf "@[<0>(%a@ [@meth])@]" print_out_type_1 res
292292
| Otyp_constr (Oide_dot (Oide_dot (Oide_ident "Js_OO", "Callback" ), _),
293293
[tyl])
294294
->

jscomp/runtime/caml_sys.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ let sys_time = () =>
6868

6969
/*
7070
type spawnResult
71-
external spawnSync : string -> spawnResult = "spawnSync" [@@bs.module "child_process"]
71+
external spawnSync : string -> spawnResult = "spawnSync" [@@module "child_process"]
7272
7373
external readAs : spawnResult ->
7474
<

jscomp/syntax/benchmarks/data/Napkinscript.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11476,7 +11476,7 @@ end
1147611476
module JsFfi = struct
1147711477
type scope =
1147811478
| Global
11479-
| Module of string (* bs.module("path") *)
11479+
| Module of string (* module("path") *)
1148011480
| Scope of Longident.t (* bs.scope(/"window", "location"/) *)
1148111481

1148211482
type label_declaration = {

jscomp/syntax/benchmarks/data/Napkinscript.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11843,7 +11843,7 @@ module Scanner = {
1184311843
module JsFfi = {
1184411844
type scope =
1184511845
| Global
11846-
| Module(string) /* bs.module("path") */
11846+
| Module(string) /* module("path") */
1184711847
| Scope(Longident.t) /* bs.scope(/"window", "location"/) */
1184811848

1184911849
type label_declaration = {

jscomp/syntax/tests/idempotency/genType/src/Runtime.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ module Mangle = {
176176
keywords |> Array.iter(x => Hashtbl.add(table, "_" ++ x, x))
177177

178178
/*
179-
Apply bucklescript's mangling rules for object field names:
179+
Apply ReScript's mangling rules for object field names:
180180
Remove trailing "__" if present.
181181
Otherwise remove leading "_" when followed by an uppercase letter, or keyword.
182182
*/

jscomp/syntax/tests/idempotency/genType/src/TranslateStructure.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ and translateStructureItem = (
347347
|> Translation.combine
348348

349349
| {
350-
/* Bucklescript's encoding of bs.module: include with constraint. */
350+
/* ReScript's encoding of @module: include with constraint. */
351351
Typedtree.str_desc: Tstr_include({
352352
incl_mod: {
353353
mod_desc: Tmod_constraint(

jscomp/syntax/tests/idempotency/genType/src/TranslateTypeExprFromTypes.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ and translateTypeExprFromTypes_ = (
552552
{dependencies: list{}, type_: type_}
553553

554554
| {noPayloads: list{}, payloads: list{(_label, t)}, unknowns: list{}} =>
555-
/* Handle bucklescript's "Arity_" encoding in first argument of Js.Internal.fn(_,_) for uncurried functions.
555+
/* Handle ReScript's "Arity_" encoding in first argument of Js.Internal.fn(_,_) for uncurried functions.
556556
Return the argument tuple. */
557557
t |> translateTypeExprFromTypes_(
558558
~config,

jscomp/syntax/tests/idempotency/genType/src/Translation.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ let translateComponent = (
276276

277277
@ocaml.doc("
278278
* [@genType]
279-
* [@bs.module] external myBanner : ReasonReact.reactClass = \"./MyBanner\";
279+
* [@module] external myBanner : ReasonReact.reactClass = \"./MyBanner\";
280280
")
281281
let translatePrimitive = (
282282
~config,

jscomp/syntax/tests/idempotency/wildcards-world-ui/BN.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ type t
1818
@new @module("bn.js") external new_: string => t = "default"
1919
@new @module("bn.js") external newInt_: int => t = "default"
2020

21-
// [@bs.module "@polkadot/util"] external tSqrt: (. t) => t = "tSqrt";
21+
// [@module "@polkadot/util"] external tSqrt: (. t) => t = "tSqrt";
2222

2323
// let test = tSqrt(. new_("50"));

jscomp/syntax/tests/idempotency/wildcards-world-ui/Web3.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ module Contract = {
4949

5050
type dai
5151

52-
// [@bs.send] [@bs.new] [@bs.scope "eth"]
52+
// [@bs.send] [@new] [@bs.scope "eth"]
5353
// external getContract: (t, abi, ethAddress) => contract = "Contract";
5454

5555
// Temporary code until I work out how to make the above binding work...

jscomp/syntax/tests/parsing/errors/typexpr/bsObjSugar.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ type state = {
2020
}
2121

2222
type state = {
23-
@bs.meth
23+
@meth
2424
"send": string =>
2525
}
2626

jscomp/syntax/tests/parsing/errors/typexpr/expected/bsObjSugar.res.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
Syntax error!
5454
tests/parsing/errors/typexpr/bsObjSugar.res:25:1
5555

56-
23 │ @bs.meth
56+
23 │ @meth
5757
24 │ "send": string =>
5858
25 │ }
5959
26 │
@@ -141,7 +141,7 @@ type nonrec state =
141141
< url: string ;protocols: [%rescript.typehole ] ;websocket: Websocket.t
142142
>
143143
type nonrec state = < url: string ;protocols: [%rescript.typehole ] >
144-
type nonrec state = < send: string -> [%rescript.typehole ] [@bs.meth ] >
144+
type nonrec state = < send: string -> [%rescript.typehole ] [@meth ] >
145145
type nonrec state = < age: [%rescript.typehole ] ;name: string >
146146
type nonrec state = < age: [%rescript.typehole ] [@set ] ;name: string >
147147
type nonrec state = < age: [%rescript.typehole ] ;.. >

jscomp/syntax/tests/parsing/errors/typexpr/expected/garbage.res.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
Syntax error!
33
tests/parsing/errors/typexpr/garbage.res:2:28
44

5-
1 │ @bs.module("moduleName")
5+
1 │ @module("moduleName")
66
2 │ external printName: (~name:?, unit) => unit = "printName"
77
3 │
88

99
I'm not sure what to parse here when looking at "?".
1010

1111
external printName : name:((unit)[@res.namedArgLoc ]) -> unit = "printName"
12-
[@@bs.module {js|moduleName|js}]
12+
[@@module {js|moduleName|js}]
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
@bs.module("moduleName")
1+
@module("moduleName")
22
external printName: (~name:?, unit) => unit = "printName"

jscomp/syntax/tests/parsing/grammar/structure/expected/externalDefinition.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ external attachShader :
77
[@@bs.send ]
88
external svg : unit -> React.element = "svg"
99
external svg : unit -> React.element = "svg"
10-
external createDate : unit -> unit -> date = "Date"[@@bs.new ]
10+
external createDate : unit -> unit -> date = "Date"[@@new ]
1111
let foobar = (createDate ()) ()

jscomp/syntax/tests/parsing/grammar/structure/externalDefinition.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ external svg: () => React.element = "svg";
1212
external svg: () => React.element = "svg"
1313

1414
// should not infinite loop
15-
@bs.new
15+
@new
1616
external createDate: (unit, unit) => date = "Date"
1717

1818
let foobar = createDate()()

jscomp/test/demo_page.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ type vdom
5353
/* FIXME: investigate
5454
cases:
5555
{[
56-
[@@bs.module "package1" "same_name"]
57-
[@@bs.module "package2" "same_name"]
56+
[@@module "package1" "same_name"]
57+
[@@module "package2" "same_name"]
5858
]}
5959
{[
60-
[@@bs.module "package" "name1"]
61-
[@@bs.module "package" "name2"]
60+
[@@module "package" "name1"]
61+
[@@module "package" "name2"]
6262
]}
6363
*/
6464
@send @variadic external h1: (vdom, ~attrs: attrs=?, array<component>) => component = "h1"

jscomp/test/ffi_splice_test.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type t
3838
@send external sum: (t, unit) => int = "sum"
3939

4040
/* compile error */
41-
/* external join : string -> string = "" [@@bs.module "path"] [@@bs.splice] */
41+
/* external join : string -> string = "" [@@module "path"] [@@bs.splice] */
4242
@module("path") @variadic external join: array<string> => string = "join"
4343

4444
@send @variadic external test: (t, array<string>) => t = "test" /* FIXME */

jscomp/test/gpr_441.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/* external new_rectangle : */
2-
/* unit -> int = "" [@@bs.new] [@@bs.module "@Rectangle"] */
2+
/* unit -> int = "" [@@new] [@@module "@Rectangle"] */
33

44
/* let rect = new_rectangle */

jscomp/test/hash_sugar_desugar.resi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let h3: {.."hi": (int, int) => 'a} => 'a
33
let g5: {..@set "hi": int} => unit
44
let h5: {..@set "hi": int} => unit
55
/* The inferred type is
6-
val h5 : < hi#= : (int -> unit [@bs.meth]); .. > -> unit
6+
val h5 : < hi#= : (int -> unit [@meth]); .. > -> unit
77
We should propose the rescript syntax:
88
{ mutable "hi" : int }
99
*/

jscomp/test/inline_const.resi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let hh: string
2323

2424
@inline(1) let f6: int
2525

26-
/* val f7 : bool [@@bs.inline 1L] */
26+
/* val f7 : bool [@@inline 1L] */
2727

2828
@inline(100L) let v: int64
2929
@inline(1L) let u: int64

jscomp/test/js_val.res

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@val @module(("x", "U")) external vvv: int = "vv"
66
@module(("x", "U")) external vvvv: int = "vvvv"
77

8-
/* TODO: unify all [bs.module] name, here ideally,
8+
/* TODO: unify all [module] name, here ideally,
99
we should have only one [require("x")] here */
1010
let h = u
1111
let hh = vv

jscomp/test/module_as_class_ffi.res

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ type t
44

55
let f = () => mk(3)
66

7-
/* external mk2 : int -> t = "xx/foo_class" [@@bs.new "x"] [@@bs.module]
7+
/* external mk2 : int -> t = "xx/foo_class" [@@new "x"] [@@module]
88
99
File "module_as_class_ffi.ml", line 9, characters 0-69:
10-
conflict attributes found: (bs.new should not carry payload here)
10+
conflict attributes found: (new should not carry payload here)
1111
*/
1212
/*
1313
TODO: more error checking
14-
1. [@@bs.module] can only be used once
15-
2. here [bs.new] should not have any payload
16-
3. consolidate all [bs.module]
14+
1. [@@module] can only be used once
15+
2. here [new] should not have any payload
16+
3. consolidate all [module]
1717
1818
1919
let ff () =

jscomp/test/test_react.res

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ type vdom
2323
/* FIXME: investigate
2424
cases:
2525
{[
26-
[@@bs.module "package1" "same_name"]
27-
[@@bs.module "package2" "same_name"]
26+
[@@module "package1" "same_name"]
27+
[@@module "package2" "same_name"]
2828
]}
2929
{[
30-
[@@bs.module "package" "name1"]
31-
[@@bs.module "package" "name2"]
30+
[@@module "package" "name1"]
31+
[@@module "package" "name2"]
3232
]}
3333
*/
3434
@send @variadic external h1: (vdom, ~attrs: attrs=?, array<component>) => component = "h1"

0 commit comments

Comments
 (0)