Generate C code for static records

This fixes the test t8.ept
This commit is contained in:
Cédric Pasteur 2011-01-18 17:52:44 +01:00
parent 82250b7536
commit 2b18fcab93

View file

@ -244,6 +244,14 @@ let rec cexpr_of_static_exp se =
| Sfield _ -> assert false | Sfield _ -> assert false
| Sconstructor c -> Cconst (Ctag (cname_of_qn c)) | Sconstructor c -> Cconst (Ctag (cname_of_qn c))
| Sarray sl -> Carraylit (List.map cexpr_of_static_exp sl) | Sarray sl -> Carraylit (List.map cexpr_of_static_exp sl)
| Srecord fl ->
let ty_name =
match Modules.unalias_type se.se_ty with
| Types.Tid n -> cname_of_qn n
| _ -> assert false
in
Cstructlit (ty_name,
List.map (fun (_, se) -> cexpr_of_static_exp se) fl)
| Sarray_power(n,c) -> | Sarray_power(n,c) ->
let cc = cexpr_of_static_exp c in let cc = cexpr_of_static_exp c in
Carraylit (repeat_list cc (int_of_static_exp n)) Carraylit (repeat_list cc (int_of_static_exp n))
@ -259,7 +267,7 @@ let rec cexpr_of_static_exp se =
else else
cexpr_of_static_exp se' cexpr_of_static_exp se'
| Stuple _ -> assert false (** TODO *) | Stuple _ -> assert false (** TODO *)
| Srecord _ -> assert false (** TODO *)
(** [cexpr_of_exp exp] translates the Obj action [exp] to a C expression. *) (** [cexpr_of_exp exp] translates the Obj action [exp] to a C expression. *)
let rec cexpr_of_exp var_env exp = let rec cexpr_of_exp var_env exp =