@@ -167,19 +167,19 @@ let get_opt_arg_type
167
167
168
168
169
169
(* *
170
- [@@bs. module "react"]
171
- [@@bs. module "react"]
170
+ [@@module "react"]
171
+ [@@module "react"]
172
172
---
173
- [@@bs. module "@" "react"]
174
- [@@bs. module "@" "react"]
173
+ [@@module "@" "react"]
174
+ [@@module "@" "react"]
175
175
176
176
They should have the same module name
177
177
178
178
TODO: we should emit an warning if we bind
179
179
two external files to the same module name
180
180
*)
181
181
type bundle_source =
182
- [`Nm_payload of string (* from payload [@@bs. val "xx" ]*)
182
+ [`Nm_payload of string (* from payload [@@val "xx" ]*)
183
183
|`Nm_external of string (* from "" in external *)
184
184
| `Nm_val of string lazy_t (* from function name *)
185
185
]
@@ -268,7 +268,7 @@ let parse_external_attributes
268
268
match payload with
269
269
| PStr [] ->
270
270
(prim_name_or_pval_prim :> name_source )
271
- (* It is okay to have [@@bs. val] without payload *)
271
+ (* It is okay to have [@@val] without payload *)
272
272
| _ ->
273
273
begin match Ast_payload. is_single_string payload with
274
274
| Some (val_name , _ ) -> `Nm_payload val_name
@@ -289,13 +289,13 @@ let parse_external_attributes
289
289
{st with external_module_name = Some { bundle; module_bind_name = Phint_nothing }}
290
290
else
291
291
let action () = begin match txt with
292
- | "bs.val" ->
292
+ | "bs.val" | "val" ->
293
293
if no_arguments then
294
294
{st with val_name = name_from_payload_or_prim ~loc payload}
295
295
else
296
296
{st with call_name = name_from_payload_or_prim ~loc payload}
297
297
298
- | "bs.module" ->
298
+ | "bs.module" | "module" ->
299
299
begin match Ast_payload. assert_strings loc payload with
300
300
| [bundle] ->
301
301
{st with external_module_name =
@@ -617,7 +617,7 @@ let external_desc_of_non_obj
617
617
| [] , `Nm_na , _ -> Js_module_as_var external_module_name
618
618
| _ , `Nm_na , _ -> Js_module_as_fn {splice; external_module_name }
619
619
| _ , #bundle_source , #bundle_source ->
620
- Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with [@@bs. module] ." )
620
+ Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with @@ module." )
621
621
622
622
| _, (`Nm_val _ | `Nm_external _) , `Nm_na
623
623
-> Js_module_as_class external_module_name
@@ -627,7 +627,7 @@ let external_desc_of_non_obj
627
627
" Incorrect FFI attribute found: (@new should not carry a payload here)"
628
628
end
629
629
| {module_as_val = Some _ ; _} ->
630
- Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with [@@bs. module] ." )
630
+ Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with @@ module." )
631
631
| {call_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name) ;
632
632
splice;
633
633
scopes ;
@@ -649,7 +649,7 @@ let external_desc_of_non_obj
649
649
Js_call {splice; name; external_module_name; scopes }
650
650
| {call_name = #bundle_source ; _ }
651
651
->
652
- Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with [@@bs. val] " )
652
+ Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with @ val" )
653
653
| {val_name = (`Nm_val lazy name | `Nm_external name | `Nm_payload name);
654
654
external_module_name;
655
655
@@ -670,13 +670,13 @@ let external_desc_of_non_obj
670
670
-> (*
671
671
if no_arguments -->
672
672
{[
673
- external ff : int = "" [@@bs. val]
673
+ external ff : int = "" [@@val]
674
674
]}
675
675
*)
676
676
Js_var { name; external_module_name; scopes}
677
677
| {val_name = #bundle_source ; _ }
678
678
->
679
- Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with [@@bs. val] " )
679
+ Bs_syntaxerr. err loc (Conflict_ffi_attribute " Attribute found that conflicts with @ val" )
680
680
681
681
| {splice ;
682
682
scopes ;
@@ -699,7 +699,7 @@ let external_desc_of_non_obj
699
699
if arg_type_specs_length = 0 then
700
700
(*
701
701
{[
702
- external ff : int = "" [@@bs. module "xx"]
702
+ external ff : int = "" [@@module "xx"]
703
703
]}
704
704
*)
705
705
Js_var { name; external_module_name; scopes}
@@ -846,7 +846,7 @@ let external_desc_of_non_obj
846
846
return_wrapper = _;
847
847
848
848
}
849
- -> Location. raise_errorf ~loc " Could not infer which FFI category it belongs to, maybe you forgot [%@%@bs. val] ? "
849
+ -> Location. raise_errorf ~loc " Could not infer which FFI category it belongs to, maybe you forgot %@ val? "
850
850
851
851
(* * Note that the passed [type_annotation] is already processed by visitor pattern before*)
852
852
let handle_attributes
0 commit comments