Skip to content

Commit e4bbfb1

Browse files
committed
snapshot
1 parent 0fc3908 commit e4bbfb1

File tree

3 files changed

+68
-68
lines changed

3 files changed

+68
-68
lines changed

lib/4.06.1/unstable/js_compiler.ml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -84648,7 +84648,7 @@ type call_info =
8464884648
| Call_ml (* called by plain ocaml expression *)
8464984649
| Call_builtin_runtime (* built-in externals *)
8465084650
| Call_na
84651-
(* either from [@@bs.val] or not available,
84651+
(* either from [@@val] or not available,
8465284652
such calls does not follow such rules
8465384653
{[ fun x y -> f x y === f ]} when [f] is an atom
8465484654
*)
@@ -84706,7 +84706,7 @@ type call_info =
8470684706
| Call_ml (* called by plain ocaml expression *)
8470784707
| Call_builtin_runtime (* built-in externals *)
8470884708
| Call_na
84709-
(* either from [@@bs.val] or not available,
84709+
(* either from [@@val] or not available,
8471084710
such calls does not follow such rules
8471184711
{[ fun x y -> (f x y) === f ]} when [f] is an atom
8471284712

@@ -95167,16 +95167,16 @@ type external_spec =
9516795167
| Js_set { js_set_name = s} -> Printf.sprintf "[@@set %S]" s
9516895168
| Js_call v -> Printf.sprintf "[@@val %S]" v.name
9516995169
| Js_send v -> Printf.sprintf "[@@send %S]" v.name
95170-
| Js_module_as_fn v -> Printf.sprintf "[@@bs.val %S]" v.external_module_name.bundle
95170+
| Js_module_as_fn v -> Printf.sprintf "[@@val %S]" v.external_module_name.bundle
9517195171
| Js_new v -> Printf.sprintf "[@@new %S]" v.name
9517295172
| Js_module_as_class v
95173-
-> Printf.sprintf "[@@bs.module] %S " v.bundle
95173+
-> Printf.sprintf "[@@module] %S " v.bundle
9517495174
| Js_module_as_var v
9517595175
->
95176-
Printf.sprintf "[@@bs.module] %S " v.bundle
95177-
| Js_var v (* FIXME: could be [@@bs.module "xx"] as well *)
95176+
Printf.sprintf "[@@module] %S " v.bundle
95177+
| Js_var v (* FIXME: could be [@@module "xx"] as well *)
9517895178
->
95179-
Printf.sprintf "[@@bs.val] %S " v.name *)
95179+
Printf.sprintf "[@@val] %S " v.name *)
9518095180

9518195181
type return_wrapper =
9518295182
| Return_unset
@@ -108895,7 +108895,7 @@ let translate_scoped_module_val
108895108895
Ext_list.fold_left (Ext_list.append rest [fn]) start E.dot
108896108896
end
108897108897
| None ->
108898-
(* no [@@bs.module], assume it's global *)
108898+
(* no [@@module], assume it's global *)
108899108899
begin match scopes with
108900108900
| [] ->
108901108901
E.js_global fn
@@ -404765,19 +404765,19 @@ let get_opt_arg_type
404765404765

404766404766

404767404767
(**
404768-
[@@bs.module "react"]
404769-
[@@bs.module "react"]
404768+
[@@module "react"]
404769+
[@@module "react"]
404770404770
---
404771-
[@@bs.module "@" "react"]
404772-
[@@bs.module "@" "react"]
404771+
[@@module "@" "react"]
404772+
[@@module "@" "react"]
404773404773

404774404774
They should have the same module name
404775404775

404776404776
TODO: we should emit an warning if we bind
404777404777
two external files to the same module name
404778404778
*)
404779404779
type bundle_source =
404780-
[`Nm_payload of string (* from payload [@@bs.val "xx" ]*)
404780+
[`Nm_payload of string (* from payload [@@val "xx" ]*)
404781404781
|`Nm_external of string (* from "" in external *)
404782404782
| `Nm_val of string lazy_t (* from function name *)
404783404783
]
@@ -404866,7 +404866,7 @@ let parse_external_attributes
404866404866
match payload with
404867404867
| PStr [] ->
404868404868
(prim_name_or_pval_prim :> name_source)
404869-
(* It is okay to have [@@bs.val] without payload *)
404869+
(* It is okay to have [@@val] without payload *)
404870404870
| _ ->
404871404871
begin match Ast_payload.is_single_string payload with
404872404872
| Some (val_name, _) -> `Nm_payload val_name
@@ -404887,13 +404887,13 @@ let parse_external_attributes
404887404887
{st with external_module_name = Some { bundle; module_bind_name = Phint_nothing}}
404888404888
else
404889404889
let action () = begin match txt with
404890-
| "bs.val" ->
404890+
| "bs.val" | "val" ->
404891404891
if no_arguments then
404892404892
{st with val_name = name_from_payload_or_prim ~loc payload}
404893404893
else
404894404894
{st with call_name = name_from_payload_or_prim ~loc payload}
404895404895

404896-
| "bs.module" ->
404896+
| "bs.module" | "module" ->
404897404897
begin match Ast_payload.assert_strings loc payload with
404898404898
| [bundle] ->
404899404899
{st with external_module_name =
@@ -405215,7 +405215,7 @@ let external_desc_of_non_obj
405215405215
| [], `Nm_na, _ -> Js_module_as_var external_module_name
405216405216
| _, `Nm_na, _ -> Js_module_as_fn {splice; external_module_name }
405217405217
| _, #bundle_source, #bundle_source ->
405218-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with [@@bs.module].")
405218+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @@module.")
405219405219

405220405220
| _, (`Nm_val _ | `Nm_external _) , `Nm_na
405221405221
-> Js_module_as_class external_module_name
@@ -405225,7 +405225,7 @@ let external_desc_of_non_obj
405225405225
"Incorrect FFI attribute found: (@new should not carry a payload here)"
405226405226
end
405227405227
| {module_as_val = Some _; _} ->
405228-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with [@@bs.module].")
405228+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @@module.")
405229405229
| {call_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name) ;
405230405230
splice;
405231405231
scopes ;
@@ -405247,7 +405247,7 @@ let external_desc_of_non_obj
405247405247
Js_call {splice; name; external_module_name; scopes }
405248405248
| {call_name = #bundle_source ; _ }
405249405249
->
405250-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with [@@bs.val]")
405250+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @val")
405251405251
| {val_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name);
405252405252
external_module_name;
405253405253

@@ -405268,13 +405268,13 @@ let external_desc_of_non_obj
405268405268
-> (*
405269405269
if no_arguments -->
405270405270
{[
405271-
external ff : int = "" [@@bs.val]
405271+
external ff : int = "" [@@val]
405272405272
]}
405273405273
*)
405274405274
Js_var { name; external_module_name; scopes}
405275405275
| {val_name = #bundle_source ; _ }
405276405276
->
405277-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with [@@bs.val]")
405277+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @val")
405278405278

405279405279
| {splice ;
405280405280
scopes ;
@@ -405297,7 +405297,7 @@ let external_desc_of_non_obj
405297405297
if arg_type_specs_length = 0 then
405298405298
(*
405299405299
{[
405300-
external ff : int = "" [@@bs.module "xx"]
405300+
external ff : int = "" [@@module "xx"]
405301405301
]}
405302405302
*)
405303405303
Js_var { name; external_module_name; scopes}
@@ -405444,7 +405444,7 @@ let external_desc_of_non_obj
405444405444
return_wrapper = _;
405445405445

405446405446
}
405447-
-> Location.raise_errorf ~loc "Could not infer which FFI category it belongs to, maybe you forgot [%@%@bs.val]? "
405447+
-> Location.raise_errorf ~loc "Could not infer which FFI category it belongs to, maybe you forgot %@val? "
405448405448

405449405449
(** Note that the passed [type_annotation] is already processed by visitor pattern before*)
405450405450
let handle_attributes

lib/4.06.1/unstable/js_refmt_compiler.ml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84706,7 +84706,7 @@ type call_info =
8470684706
| Call_ml (* called by plain ocaml expression *)
8470784707
| Call_builtin_runtime (* built-in externals *)
8470884708
| Call_na
84709-
(* either from [@@bs.val] or not available,
84709+
(* either from [@@val] or not available,
8471084710
such calls does not follow such rules
8471184711
{[ fun x y -> (f x y) === f ]} when [f] is an atom
8471284712

@@ -95167,16 +95167,16 @@ type external_spec =
9516795167
| Js_set { js_set_name = s} -> Printf.sprintf "[@@set %S]" s
9516895168
| Js_call v -> Printf.sprintf "[@@val %S]" v.name
9516995169
| Js_send v -> Printf.sprintf "[@@send %S]" v.name
95170-
| Js_module_as_fn v -> Printf.sprintf "[@@bs.val %S]" v.external_module_name.bundle
95170+
| Js_module_as_fn v -> Printf.sprintf "[@@val %S]" v.external_module_name.bundle
9517195171
| Js_new v -> Printf.sprintf "[@@new %S]" v.name
9517295172
| Js_module_as_class v
95173-
-> Printf.sprintf "[@@bs.module] %S " v.bundle
95173+
-> Printf.sprintf "[@@module] %S " v.bundle
9517495174
| Js_module_as_var v
9517595175
->
95176-
Printf.sprintf "[@@bs.module] %S " v.bundle
95177-
| Js_var v (* FIXME: could be [@@bs.module "xx"] as well *)
95176+
Printf.sprintf "[@@module] %S " v.bundle
95177+
| Js_var v (* FIXME: could be [@@module "xx"] as well *)
9517895178
->
95179-
Printf.sprintf "[@@bs.val] %S " v.name *)
95179+
Printf.sprintf "[@@val] %S " v.name *)
9518095180

9518195181
type return_wrapper =
9518295182
| Return_unset
@@ -108895,7 +108895,7 @@ let translate_scoped_module_val
108895108895
Ext_list.fold_left (Ext_list.append rest [fn]) start E.dot
108896108896
end
108897108897
| None ->
108898-
(* no [@@bs.module], assume it's global *)
108898+
(* no [@@module], assume it's global *)
108899108899
begin match scopes with
108900108900
| [] ->
108901108901
E.js_global fn
@@ -404765,19 +404765,19 @@ let get_opt_arg_type
404765404765

404766404766

404767404767
(**
404768-
[@@bs.module "react"]
404769-
[@@bs.module "react"]
404768+
[@@module "react"]
404769+
[@@module "react"]
404770404770
---
404771-
[@@bs.module "@" "react"]
404772-
[@@bs.module "@" "react"]
404771+
[@@module "@" "react"]
404772+
[@@module "@" "react"]
404773404773

404774404774
They should have the same module name
404775404775

404776404776
TODO: we should emit an warning if we bind
404777404777
two external files to the same module name
404778404778
*)
404779404779
type bundle_source =
404780-
[`Nm_payload of string (* from payload [@@bs.val "xx" ]*)
404780+
[`Nm_payload of string (* from payload [@@val "xx" ]*)
404781404781
|`Nm_external of string (* from "" in external *)
404782404782
| `Nm_val of string lazy_t (* from function name *)
404783404783
]
@@ -404866,7 +404866,7 @@ let parse_external_attributes
404866404866
match payload with
404867404867
| PStr [] ->
404868404868
(prim_name_or_pval_prim :> name_source)
404869-
(* It is okay to have [@@bs.val] without payload *)
404869+
(* It is okay to have [@@val] without payload *)
404870404870
| _ ->
404871404871
begin match Ast_payload.is_single_string payload with
404872404872
| Some (val_name, _) -> `Nm_payload val_name
@@ -404887,13 +404887,13 @@ let parse_external_attributes
404887404887
{st with external_module_name = Some { bundle; module_bind_name = Phint_nothing}}
404888404888
else
404889404889
let action () = begin match txt with
404890-
| "bs.val" ->
404890+
| "bs.val" | "val" ->
404891404891
if no_arguments then
404892404892
{st with val_name = name_from_payload_or_prim ~loc payload}
404893404893
else
404894404894
{st with call_name = name_from_payload_or_prim ~loc payload}
404895404895

404896-
| "bs.module" ->
404896+
| "bs.module" | "module" ->
404897404897
begin match Ast_payload.assert_strings loc payload with
404898404898
| [bundle] ->
404899404899
{st with external_module_name =
@@ -405215,7 +405215,7 @@ let external_desc_of_non_obj
405215405215
| [], `Nm_na, _ -> Js_module_as_var external_module_name
405216405216
| _, `Nm_na, _ -> Js_module_as_fn {splice; external_module_name }
405217405217
| _, #bundle_source, #bundle_source ->
405218-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with [@@bs.module].")
405218+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @@module.")
405219405219

405220405220
| _, (`Nm_val _ | `Nm_external _) , `Nm_na
405221405221
-> Js_module_as_class external_module_name
@@ -405225,7 +405225,7 @@ let external_desc_of_non_obj
405225405225
"Incorrect FFI attribute found: (@new should not carry a payload here)"
405226405226
end
405227405227
| {module_as_val = Some _; _} ->
405228-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with [@@bs.module].")
405228+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @@module.")
405229405229
| {call_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name) ;
405230405230
splice;
405231405231
scopes ;
@@ -405247,7 +405247,7 @@ let external_desc_of_non_obj
405247405247
Js_call {splice; name; external_module_name; scopes }
405248405248
| {call_name = #bundle_source ; _ }
405249405249
->
405250-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with [@@bs.val]")
405250+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @val")
405251405251
| {val_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name);
405252405252
external_module_name;
405253405253

@@ -405268,13 +405268,13 @@ let external_desc_of_non_obj
405268405268
-> (*
405269405269
if no_arguments -->
405270405270
{[
405271-
external ff : int = "" [@@bs.val]
405271+
external ff : int = "" [@@val]
405272405272
]}
405273405273
*)
405274405274
Js_var { name; external_module_name; scopes}
405275405275
| {val_name = #bundle_source ; _ }
405276405276
->
405277-
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with [@@bs.val]")
405277+
Bs_syntaxerr.err loc (Conflict_ffi_attribute "Attribute found that conflicts with @val")
405278405278

405279405279
| {splice ;
405280405280
scopes ;
@@ -405297,7 +405297,7 @@ let external_desc_of_non_obj
405297405297
if arg_type_specs_length = 0 then
405298405298
(*
405299405299
{[
405300-
external ff : int = "" [@@bs.module "xx"]
405300+
external ff : int = "" [@@module "xx"]
405301405301
]}
405302405302
*)
405303405303
Js_var { name; external_module_name; scopes}
@@ -405444,7 +405444,7 @@ let external_desc_of_non_obj
405444405444
return_wrapper = _;
405445405445

405446405446
}
405447-
-> Location.raise_errorf ~loc "Could not infer which FFI category it belongs to, maybe you forgot [%@%@bs.val]? "
405447+
-> Location.raise_errorf ~loc "Could not infer which FFI category it belongs to, maybe you forgot %@val? "
405448405448

405449405449
(** Note that the passed [type_annotation] is already processed by visitor pattern before*)
405450405450
let handle_attributes

0 commit comments

Comments
 (0)