Skip to content

Commit 7a6308e

Browse files
committed
highlight extern_arg_array
1 parent c6bc812 commit 7a6308e

11 files changed

+48
-42
lines changed

jscomp/core/lam_compile_external_call.ml

+2-2
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ let ocaml_to_js_eff
146146
Js_of_lam_variant.eval_as_unwrap raw_arg
147147
in
148148
Splice1 single_arg,[]
149-
| Nothing | Array -> Splice1 arg, []
149+
| Nothing | Extern_arg_array -> Splice1 arg, []
150150

151151

152152

@@ -211,7 +211,7 @@ let assemble_args_has_splice call_loc ffi (arg_types : specs) (args : exprs)
211211
let accs, eff = aux labels args in
212212
begin match args, (arg : E.t) with
213213
| [], {expression_desc = Array (ls,_mutable_flag) ;_ } ->
214-
assert (arg_kind.arg_type = Array);
214+
assert (arg_kind.arg_type = Extern_arg_array);
215215
Ext_list.append ls accs, eff
216216
| _ ->
217217
if args = [] then dynamic := true ;

jscomp/syntax/ast_external_process.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ let spec_of_ptyp nolabel (ptyp : Parsetree.core_type) =
9797
| Ptyp_constr ({txt = Lident "unit"; _}, [])
9898
-> if nolabel then Extern_unit else Nothing
9999
| Ptyp_constr ({txt = Lident "array"; _}, [_])
100-
-> Array
100+
-> Extern_arg_array
101101
| Ptyp_variant _ ->
102102
Bs_warnings.prerr_bs_ffi_warning ptyp.ptyp_loc Unsafe_poly_variant_type;
103103
Nothing
@@ -436,7 +436,7 @@ let process_obj
436436
arg_type },
437437
arg_types, (* ignored in [arg_types], reserved in [result_types] *)
438438
((name , [], new_ty) :: result_types)
439-
| Nothing | Array ->
439+
| Nothing | Extern_arg_array ->
440440
let s = (Lam_methname.translate ~loc name) in
441441
{arg_label = External_arg_spec.label s None ; arg_type },
442442
{param_type with ty = new_ty}::arg_types,
@@ -469,7 +469,7 @@ let process_obj
469469
| Ignore ->
470470
External_arg_spec.empty_kind arg_type,
471471
param_type::arg_types, result_types
472-
| Nothing | Array ->
472+
| Nothing | Extern_arg_array ->
473473
let s = (Lam_methname.translate ~loc name) in
474474
{arg_label = External_arg_spec.optional s; arg_type},
475475
param_type :: arg_types,
@@ -916,7 +916,7 @@ let handle_attributes
916916
in
917917
(if i = 0 && splice then
918918
match arg_type with
919-
| Array -> ()
919+
| Extern_arg_array -> ()
920920
| _ -> Location.raise_errorf ~loc "[@@@@bs.splice] expect the last type to be an array");
921921
({ External_arg_spec.arg_label ;
922922
arg_type

jscomp/syntax/external_arg_spec.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type attr =
4545
| Arg_cst of cst
4646
| Fn_uncurry_arity of int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)
4747
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
48-
| Array
48+
| Extern_arg_array
4949
| Extern_unit
5050
| Nothing
5151
| Ignore

jscomp/syntax/external_arg_spec.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type attr =
4444
| Arg_cst of cst
4545
| Fn_uncurry_arity of int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)
4646
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
47-
| Array
47+
| Extern_arg_array
4848
| Extern_unit
4949
| Nothing
5050
| Ignore

jscomp/test/build.ninja

+1
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ build test/gpr_3154_test.cmi test/gpr_3154_test.cmj : cc test/gpr_3154_test.ml |
275275
build test/gpr_3209_test.cmi test/gpr_3209_test.cmj : cc test/gpr_3209_test.ml | $stdlib
276276
build test/gpr_3492_test.cmi test/gpr_3492_test.cmj : cc test/gpr_3492_test.ml | test/mt.cmj $stdlib
277277
build test/gpr_3502_test.cmi test/gpr_3502_test.cmj : cc test/gpr_3502_test.ml | $stdlib
278+
build test/gpr_3519_test.cmi test/gpr_3519_test.cmj : cc test/gpr_3519_test.ml | $stdlib
278279
build test/gpr_373_test.cmi test/gpr_373_test.cmj : cc test/gpr_373_test.ml | $stdlib
279280
build test/gpr_405_test.cmj : cc test/gpr_405_test.ml | test/gpr_405_test.cmi $stdlib
280281
build test/gpr_405_test.cmi : cc test/gpr_405_test.mli | $stdlib

jscomp/test/gpr_3519_test.ml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Foo :
2+
sig
3+
external makeProps : ?bar:string array -> string = ""[@@bs.obj ]
4+
end =
5+
struct external makeProps : ?bar:'bar -> string = ""[@@bs.obj ] end

lib/4.02.3/bsdep.ml

+6-6
Original file line numberDiff line numberDiff line change
@@ -33344,7 +33344,7 @@ type attr =
3334433344
| Arg_cst of cst
3334533345
| Fn_uncurry_arity of int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)
3334633346
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
33347-
| Array
33347+
| Extern_arg_array
3334833348
| Extern_unit
3334933349
| Nothing
3335033350
| Ignore
@@ -33415,7 +33415,7 @@ type attr =
3341533415
| Arg_cst of cst
3341633416
| Fn_uncurry_arity of int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)
3341733417
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
33418-
| Array
33418+
| Extern_arg_array
3341933419
| Extern_unit
3342033420
| Nothing
3342133421
| Ignore
@@ -35464,7 +35464,7 @@ let spec_of_ptyp nolabel (ptyp : Parsetree.core_type) =
3546435464
| Ptyp_constr ({txt = Lident "unit"; _}, [])
3546535465
-> if nolabel then Extern_unit else Nothing
3546635466
| Ptyp_constr ({txt = Lident "array"; _}, [_])
35467-
-> Array
35467+
-> Extern_arg_array
3546835468
| Ptyp_variant _ ->
3546935469
Bs_warnings.prerr_bs_ffi_warning ptyp.ptyp_loc Unsafe_poly_variant_type;
3547035470
Nothing
@@ -35801,7 +35801,7 @@ let process_obj
3580135801
arg_type },
3580235802
arg_types, (* ignored in [arg_types], reserved in [result_types] *)
3580335803
((name , [], new_ty) :: result_types)
35804-
| Nothing | Array ->
35804+
| Nothing | Extern_arg_array ->
3580535805
let s = (Lam_methname.translate ~loc name) in
3580635806
{arg_label = External_arg_spec.label s None ; arg_type },
3580735807
{param_type with ty = new_ty}::arg_types,
@@ -35834,7 +35834,7 @@ let process_obj
3583435834
| Ignore ->
3583535835
External_arg_spec.empty_kind arg_type,
3583635836
param_type::arg_types, result_types
35837-
| Nothing | Array ->
35837+
| Nothing | Extern_arg_array ->
3583835838
let s = (Lam_methname.translate ~loc name) in
3583935839
{arg_label = External_arg_spec.optional s; arg_type},
3584035840
param_type :: arg_types,
@@ -36281,7 +36281,7 @@ let handle_attributes
3628136281
in
3628236282
(if i = 0 && splice then
3628336283
match arg_type with
36284-
| Array -> ()
36284+
| Extern_arg_array -> ()
3628536285
| _ -> Location.raise_errorf ~loc "[@@@@bs.splice] expect the last type to be an array");
3628636286
({ External_arg_spec.arg_label ;
3628736287
arg_type

lib/4.02.3/bsppx.ml

+6-6
Original file line numberDiff line numberDiff line change
@@ -15397,7 +15397,7 @@ type attr =
1539715397
| Arg_cst of cst
1539815398
| Fn_uncurry_arity of int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)
1539915399
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
15400-
| Array
15400+
| Extern_arg_array
1540115401
| Extern_unit
1540215402
| Nothing
1540315403
| Ignore
@@ -15468,7 +15468,7 @@ type attr =
1546815468
| Arg_cst of cst
1546915469
| Fn_uncurry_arity of int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)
1547015470
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
15471-
| Array
15471+
| Extern_arg_array
1547215472
| Extern_unit
1547315473
| Nothing
1547415474
| Ignore
@@ -17580,7 +17580,7 @@ let spec_of_ptyp nolabel (ptyp : Parsetree.core_type) =
1758017580
| Ptyp_constr ({txt = Lident "unit"; _}, [])
1758117581
-> if nolabel then Extern_unit else Nothing
1758217582
| Ptyp_constr ({txt = Lident "array"; _}, [_])
17583-
-> Array
17583+
-> Extern_arg_array
1758417584
| Ptyp_variant _ ->
1758517585
Bs_warnings.prerr_bs_ffi_warning ptyp.ptyp_loc Unsafe_poly_variant_type;
1758617586
Nothing
@@ -17917,7 +17917,7 @@ let process_obj
1791717917
arg_type },
1791817918
arg_types, (* ignored in [arg_types], reserved in [result_types] *)
1791917919
((name , [], new_ty) :: result_types)
17920-
| Nothing | Array ->
17920+
| Nothing | Extern_arg_array ->
1792117921
let s = (Lam_methname.translate ~loc name) in
1792217922
{arg_label = External_arg_spec.label s None ; arg_type },
1792317923
{param_type with ty = new_ty}::arg_types,
@@ -17950,7 +17950,7 @@ let process_obj
1795017950
| Ignore ->
1795117951
External_arg_spec.empty_kind arg_type,
1795217952
param_type::arg_types, result_types
17953-
| Nothing | Array ->
17953+
| Nothing | Extern_arg_array ->
1795417954
let s = (Lam_methname.translate ~loc name) in
1795517955
{arg_label = External_arg_spec.optional s; arg_type},
1795617956
param_type :: arg_types,
@@ -18397,7 +18397,7 @@ let handle_attributes
1839718397
in
1839818398
(if i = 0 && splice then
1839918399
match arg_type with
18400-
| Array -> ()
18400+
| Extern_arg_array -> ()
1840118401
| _ -> Location.raise_errorf ~loc "[@@@@bs.splice] expect the last type to be an array");
1840218402
({ External_arg_spec.arg_label ;
1840318403
arg_type

lib/4.02.3/unstable/js_compiler.ml

+8-8
Original file line numberDiff line numberDiff line change
@@ -15304,7 +15304,7 @@ type attr =
1530415304
| Arg_cst of cst
1530515305
| Fn_uncurry_arity of int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)
1530615306
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
15307-
| Array
15307+
| Extern_arg_array
1530815308
| Extern_unit
1530915309
| Nothing
1531015310
| Ignore
@@ -15375,7 +15375,7 @@ type attr =
1537515375
| Arg_cst of cst
1537615376
| Fn_uncurry_arity of int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)
1537715377
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
15378-
| Array
15378+
| Extern_arg_array
1537915379
| Extern_unit
1538015380
| Nothing
1538115381
| Ignore
@@ -17461,7 +17461,7 @@ let spec_of_ptyp nolabel (ptyp : Parsetree.core_type) =
1746117461
| Ptyp_constr ({txt = Lident "unit"; _}, [])
1746217462
-> if nolabel then Extern_unit else Nothing
1746317463
| Ptyp_constr ({txt = Lident "array"; _}, [_])
17464-
-> Array
17464+
-> Extern_arg_array
1746517465
| Ptyp_variant _ ->
1746617466
Bs_warnings.prerr_bs_ffi_warning ptyp.ptyp_loc Unsafe_poly_variant_type;
1746717467
Nothing
@@ -17798,7 +17798,7 @@ let process_obj
1779817798
arg_type },
1779917799
arg_types, (* ignored in [arg_types], reserved in [result_types] *)
1780017800
((name , [], new_ty) :: result_types)
17801-
| Nothing | Array ->
17801+
| Nothing | Extern_arg_array ->
1780217802
let s = (Lam_methname.translate ~loc name) in
1780317803
{arg_label = External_arg_spec.label s None ; arg_type },
1780417804
{param_type with ty = new_ty}::arg_types,
@@ -17831,7 +17831,7 @@ let process_obj
1783117831
| Ignore ->
1783217832
External_arg_spec.empty_kind arg_type,
1783317833
param_type::arg_types, result_types
17834-
| Nothing | Array ->
17834+
| Nothing | Extern_arg_array ->
1783517835
let s = (Lam_methname.translate ~loc name) in
1783617836
{arg_label = External_arg_spec.optional s; arg_type},
1783717837
param_type :: arg_types,
@@ -18278,7 +18278,7 @@ let handle_attributes
1827818278
in
1827918279
(if i = 0 && splice then
1828018280
match arg_type with
18281-
| Array -> ()
18281+
| Extern_arg_array -> ()
1828218282
| _ -> Location.raise_errorf ~loc "[@@@@bs.splice] expect the last type to be an array");
1828318283
({ External_arg_spec.arg_label ;
1828418284
arg_type
@@ -104326,7 +104326,7 @@ let ocaml_to_js_eff
104326104326
Js_of_lam_variant.eval_as_unwrap raw_arg
104327104327
in
104328104328
Splice1 single_arg,[]
104329-
| Nothing | Array -> Splice1 arg, []
104329+
| Nothing | Extern_arg_array -> Splice1 arg, []
104330104330

104331104331

104332104332

@@ -104391,7 +104391,7 @@ let assemble_args_has_splice call_loc ffi (arg_types : specs) (args : exprs)
104391104391
let accs, eff = aux labels args in
104392104392
begin match args, (arg : E.t) with
104393104393
| [], {expression_desc = Array (ls,_mutable_flag) ;_ } ->
104394-
assert (arg_kind.arg_type = Array);
104394+
assert (arg_kind.arg_type = Extern_arg_array);
104395104395
Ext_list.append ls accs, eff
104396104396
| _ ->
104397104397
if args = [] then dynamic := true ;

lib/4.02.3/unstable/native_ppx.ml

+6-6
Original file line numberDiff line numberDiff line change
@@ -14517,7 +14517,7 @@ type attr =
1451714517
| Arg_cst of cst
1451814518
| Fn_uncurry_arity of int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)
1451914519
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
14520-
| Array
14520+
| Extern_arg_array
1452114521
| Extern_unit
1452214522
| Nothing
1452314523
| Ignore
@@ -14588,7 +14588,7 @@ type attr =
1458814588
| Arg_cst of cst
1458914589
| Fn_uncurry_arity of int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)
1459014590
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
14591-
| Array
14591+
| Extern_arg_array
1459214592
| Extern_unit
1459314593
| Nothing
1459414594
| Ignore
@@ -16700,7 +16700,7 @@ let spec_of_ptyp nolabel (ptyp : Parsetree.core_type) =
1670016700
| Ptyp_constr ({txt = Lident "unit"; _}, [])
1670116701
-> if nolabel then Extern_unit else Nothing
1670216702
| Ptyp_constr ({txt = Lident "array"; _}, [_])
16703-
-> Array
16703+
-> Extern_arg_array
1670416704
| Ptyp_variant _ ->
1670516705
Bs_warnings.prerr_bs_ffi_warning ptyp.ptyp_loc Unsafe_poly_variant_type;
1670616706
Nothing
@@ -17037,7 +17037,7 @@ let process_obj
1703717037
arg_type },
1703817038
arg_types, (* ignored in [arg_types], reserved in [result_types] *)
1703917039
((name , [], new_ty) :: result_types)
17040-
| Nothing | Array ->
17040+
| Nothing | Extern_arg_array ->
1704117041
let s = (Lam_methname.translate ~loc name) in
1704217042
{arg_label = External_arg_spec.label s None ; arg_type },
1704317043
{param_type with ty = new_ty}::arg_types,
@@ -17070,7 +17070,7 @@ let process_obj
1707017070
| Ignore ->
1707117071
External_arg_spec.empty_kind arg_type,
1707217072
param_type::arg_types, result_types
17073-
| Nothing | Array ->
17073+
| Nothing | Extern_arg_array ->
1707417074
let s = (Lam_methname.translate ~loc name) in
1707517075
{arg_label = External_arg_spec.optional s; arg_type},
1707617076
param_type :: arg_types,
@@ -17517,7 +17517,7 @@ let handle_attributes
1751717517
in
1751817518
(if i = 0 && splice then
1751917519
match arg_type with
17520-
| Array -> ()
17520+
| Extern_arg_array -> ()
1752117521
| _ -> Location.raise_errorf ~loc "[@@@@bs.splice] expect the last type to be an array");
1752217522
({ External_arg_spec.arg_label ;
1752317523
arg_type

lib/4.02.3/whole_compiler.ml

+8-8
Original file line numberDiff line numberDiff line change
@@ -61656,7 +61656,7 @@ type attr =
6165661656
| Arg_cst of cst
6165761657
| Fn_uncurry_arity of int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)
6165861658
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
61659-
| Array
61659+
| Extern_arg_array
6166061660
| Extern_unit
6166161661
| Nothing
6166261662
| Ignore
@@ -61727,7 +61727,7 @@ type attr =
6172761727
| Arg_cst of cst
6172861728
| Fn_uncurry_arity of int (* annotated with [@bs.uncurry ] or [@bs.uncurry 2]*)
6172961729
(* maybe we can improve it as a combination of {!Asttypes.constant} and tuple *)
61730-
| Array
61730+
| Extern_arg_array
6173161731
| Extern_unit
6173261732
| Nothing
6173361733
| Ignore
@@ -94950,7 +94950,7 @@ let ocaml_to_js_eff
9495094950
Js_of_lam_variant.eval_as_unwrap raw_arg
9495194951
in
9495294952
Splice1 single_arg,[]
94953-
| Nothing | Array -> Splice1 arg, []
94953+
| Nothing | Extern_arg_array -> Splice1 arg, []
9495494954

9495594955

9495694956

@@ -95015,7 +95015,7 @@ let assemble_args_has_splice call_loc ffi (arg_types : specs) (args : exprs)
9501595015
let accs, eff = aux labels args in
9501695016
begin match args, (arg : E.t) with
9501795017
| [], {expression_desc = Array (ls,_mutable_flag) ;_ } ->
95018-
assert (arg_kind.arg_type = Array);
95018+
assert (arg_kind.arg_type = Extern_arg_array);
9501995019
Ext_list.append ls accs, eff
9502095020
| _ ->
9502195021
if args = [] then dynamic := true ;
@@ -105880,7 +105880,7 @@ let spec_of_ptyp nolabel (ptyp : Parsetree.core_type) =
105880105880
| Ptyp_constr ({txt = Lident "unit"; _}, [])
105881105881
-> if nolabel then Extern_unit else Nothing
105882105882
| Ptyp_constr ({txt = Lident "array"; _}, [_])
105883-
-> Array
105883+
-> Extern_arg_array
105884105884
| Ptyp_variant _ ->
105885105885
Bs_warnings.prerr_bs_ffi_warning ptyp.ptyp_loc Unsafe_poly_variant_type;
105886105886
Nothing
@@ -106217,7 +106217,7 @@ let process_obj
106217106217
arg_type },
106218106218
arg_types, (* ignored in [arg_types], reserved in [result_types] *)
106219106219
((name , [], new_ty) :: result_types)
106220-
| Nothing | Array ->
106220+
| Nothing | Extern_arg_array ->
106221106221
let s = (Lam_methname.translate ~loc name) in
106222106222
{arg_label = External_arg_spec.label s None ; arg_type },
106223106223
{param_type with ty = new_ty}::arg_types,
@@ -106250,7 +106250,7 @@ let process_obj
106250106250
| Ignore ->
106251106251
External_arg_spec.empty_kind arg_type,
106252106252
param_type::arg_types, result_types
106253-
| Nothing | Array ->
106253+
| Nothing | Extern_arg_array ->
106254106254
let s = (Lam_methname.translate ~loc name) in
106255106255
{arg_label = External_arg_spec.optional s; arg_type},
106256106256
param_type :: arg_types,
@@ -106697,7 +106697,7 @@ let handle_attributes
106697106697
in
106698106698
(if i = 0 && splice then
106699106699
match arg_type with
106700-
| Array -> ()
106700+
| Extern_arg_array -> ()
106701106701
| _ -> Location.raise_errorf ~loc "[@@@@bs.splice] expect the last type to be an array");
106702106702
({ External_arg_spec.arg_label ;
106703106703
arg_type

0 commit comments

Comments
 (0)