File tree Expand file tree Collapse file tree 5 files changed +31
-1
lines changed Expand file tree Collapse file tree 5 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -134,6 +134,10 @@ let type_int64 =
134
134
Ast_helper.Typ. mk
135
135
(Ptyp_constr ({ txt = Lident " int64" ; loc = Location. none}, [] ))
136
136
137
+ let type_float =
138
+ Ast_helper.Typ. mk
139
+ (Ptyp_constr ({ txt = Lident " float" ; loc = Location. none}, [] ))
140
+
137
141
let type_any ?loc () =
138
142
match loc with
139
143
| None -> No_loc. type_any
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ val type_string : core_type_lit
62
62
val type_bool : core_type_lit
63
63
val type_int : core_type_lit
64
64
val type_int64 : Parsetree .core_type
65
+ val type_float : Parsetree .core_type
65
66
val type_any : core_type_lit
66
67
67
68
val pat_unit : pattern_lit
Original file line number Diff line number Diff line change @@ -259,7 +259,14 @@ let signature_item_mapper (self : mapper) (sigi : Parsetree.signature_item) =
259
259
value_desc with
260
260
pval_prim = External_ffi_types. inline_int64_primitive s;
261
261
pval_attributes = [] ;
262
- } }
262
+ } }
263
+ | Pexp_constant (Pconst_float(s ,None)) ->
264
+ Bs_ast_invariant. warn_discarded_unused_attributes pval_attributes;
265
+ {sigi with psig_desc = Psig_value {
266
+ value_desc with
267
+ pval_prim = External_ffi_types. inline_float_primitive s;
268
+ pval_attributes = [] ;
269
+ } }
263
270
| Pexp_construct ({txt = Lident (" true" | " false" as txt)}, None )
264
271
->
265
272
Bs_ast_invariant. warn_discarded_unused_attributes pval_attributes;
@@ -338,6 +345,16 @@ let structure_item_mapper (self : mapper) (str : Parsetree.structure_item) =
338
345
pval_attributes = [] ;
339
346
pval_prim = External_ffi_types. inline_int64_primitive s
340
347
} }
348
+ | Pexp_constant (Pconst_float (s, None ))
349
+ ->
350
+ Bs_ast_invariant. warn_discarded_unused_attributes pvb_attributes;
351
+ {str with pstr_desc = Pstr_primitive {
352
+ pval_name = pval_name ;
353
+ pval_type = Ast_literal. type_float;
354
+ pval_loc = pvb_loc;
355
+ pval_attributes = [] ;
356
+ pval_prim = External_ffi_types. inline_float_primitive s
357
+ } }
341
358
| Pexp_construct ({txt = Lident ("true" | "false" as txt ) } ,None ) ->
342
359
Bs_ast_invariant. warn_discarded_unused_attributes pvb_attributes;
343
360
{str with pstr_desc = Pstr_primitive {
Original file line number Diff line number Diff line change @@ -316,6 +316,11 @@ let inline_int64_primitive (i : int64) : string list =
316
316
(Const_int64 i))
317
317
]
318
318
319
+ let inline_float_primitive (i : string ) : string list =
320
+ [" " ;
321
+ to_string
322
+ (Ffi_inline_const (Const_float i))
323
+ ]
319
324
let rec ffi_bs_aux acc (params : External_arg_spec.params ) =
320
325
match params with
321
326
| {arg_type = Nothing ; arg_label = Arg_empty }
Original file line number Diff line number Diff line change @@ -141,6 +141,9 @@ val inline_int64_primitive :
141
141
int64 ->
142
142
string list
143
143
144
+ val inline_float_primitive :
145
+ string -> string list
146
+
144
147
val ffi_bs :
145
148
External_arg_spec .params ->
146
149
return_wrapper ->
You can’t perform that action at this time.
0 commit comments