@@ -331,7 +331,7 @@ let regval_base_convs typ =
331
331
332
332
let add_regval_conv ctx env id typ defs =
333
333
let typ_str = Document. to_string (doc_typ typ) in
334
- let v_exp = mk_exp (E_id (mk_id " v" )) in
334
+ let v_exp = mk_exp (E_id (mk_id " v# " )) in
335
335
let base_typ = regval_base_typ env typ in
336
336
(* Create a function that converts from regval to the target type. *)
337
337
let from_name, to_name = regval_base_convs typ in
@@ -343,13 +343,13 @@ let add_regval_conv ctx env id typ defs =
343
343
| Some id ->
344
344
let base_exp = mk_exp (E_app (mk_id from_base, [v_exp])) in
345
345
let result_exp = Bitfield. construct_bitfield_struct id v_exp in
346
- let some_clause = " Some(v) => Some(" ^ string_of_exp result_exp ^ " )" in
346
+ let some_clause = " Some(v# ) => Some(" ^ string_of_exp result_exp ^ " )" in
347
347
let clauses = " { " ^ some_clause ^ " , None() => None() }" in
348
- " function " ^ from_name ^ " v = match " ^ string_of_exp base_exp ^ clauses
348
+ " function " ^ from_name ^ " v# = match " ^ string_of_exp base_exp ^ clauses
349
349
| _ ->
350
350
String. concat " \n "
351
351
[
352
- Printf. sprintf " function %s Regval_%s(v) = Some(v)" from_name constr_name;
352
+ Printf. sprintf " function %s Regval_%s(v# ) = Some(v# )" from_name constr_name;
353
353
Printf. sprintf " and %s _ = None()" from_name;
354
354
]
355
355
in
@@ -360,7 +360,7 @@ let add_regval_conv ctx env id typ defs =
360
360
if is_bitfield_typ env typ then mk_exp (E_app (mk_id to_base, [Bitfield. get_bits_field v_exp]))
361
361
else mk_exp (E_app (mk_id (" Regval_" ^ constr_name), [v_exp]))
362
362
in
363
- let to_function = Printf. sprintf " function %s v = %s" to_name (string_of_exp to_exp) in
363
+ let to_function = Printf. sprintf " function %s v# = %s" to_name (string_of_exp to_exp) in
364
364
let to_defs = if is_defined defs to_name then [] else [to_val; to_function] in
365
365
let cdefs = List. concat (List. map (fun s -> fst (defs_of_string __POS__ ctx s)) (from_defs @ to_defs)) in
366
366
defs @ cdefs
0 commit comments