Use underscores for generated variables

This commit is contained in:
Cédric Pasteur 2011-09-06 14:42:34 +02:00
parent 2147402a20
commit eec957cc6a
2 changed files with 8 additions and 8 deletions

View file

@ -154,7 +154,7 @@ let rec assoc_type_lhs lhs var_env = match lhs with
| Cty_ptr ty -> ty
| _ -> Error.message no_location Error.Ederef_not_pointer)
| CLfield(CLderef (CLvar "self"), { name = x }) -> assoc_type x var_env
| CLfield(CLderef (CLvar "out"), { name = x }) -> assoc_type x var_env
| CLfield(CLderef (CLvar "_out"), { name = x }) -> assoc_type x var_env
| CLfield(x, f) ->
let ty = assoc_type_lhs x var_env in
let n = struct_name ty in
@ -282,7 +282,7 @@ and clhs_of_pattern out_env var_env l = match l.pat_desc with
let n = name v in
let n_lhs =
if IdentSet.mem v out_env
then CLfield (CLderef (CLvar "out"), local_qn n)
then CLfield (CLderef (CLvar "_out"), local_qn n)
else CLvar n
in
@ -311,7 +311,7 @@ and cexpr_of_pattern out_env var_env l = match l.pat_desc with
let n = name v in
let n_lhs =
if IdentSet.mem v out_env
then Cfield (Cderef (Cvar "out"), local_qn n)
then Cfield (Cderef (Cvar "_out"), local_qn n)
else Cvar n
in
@ -338,7 +338,7 @@ and cexpr_of_ext_value out_env var_env w = match w.w_desc with
let n = name v in
let n_lhs =
if IdentSet.mem v out_env
then Cfield (Cderef (Cvar "out"), local_qn n)
then Cfield (Cderef (Cvar "_out"), local_qn n)
else Cvar n
in
@ -593,7 +593,7 @@ let qn_append q suffix =
(** Builds the argument list of step function*)
let step_fun_args n md =
let args = inputlist_of_ovarlist md.m_inputs in
let out_arg = [("out", Cty_ptr (Cty_id (qn_append n "_out")))] in
let out_arg = [("_out", Cty_ptr (Cty_id (qn_append n "_out")))] in
let context_arg =
if is_stateful n then
[("self", Cty_ptr (Cty_id (qn_append n "_mem")))]

View file

@ -206,7 +206,7 @@ let main_def_of_class_def cd =
let (printf_calls, printf_decls) =
let write_lhs_of_ty_for_vd vd =
let (stm, vars) =
write_lhs_of_ty (Cfield (Cvar "res",
write_lhs_of_ty (Cfield (Cvar "_res",
local_qn (name vd.v_ident))) vd.v_type in
if !Compiler_options.hepts_simulation then
(stm, vars)
@ -217,7 +217,7 @@ let main_def_of_class_def cd =
let printf_calls = List.concat printf_calls in
let cinp = inputlist_of_ovarlist stepm.m_inputs in
let cout = ["res", (Cty_id (qn_append cd.cd_name "_out"))] in
let cout = ["_res", (Cty_id (qn_append cd.cd_name "_out"))] in
let varlist =
(if cd.cd_stateful
@ -234,7 +234,7 @@ let main_def_of_class_def cd =
let funcall =
let args =
map (fun vd -> Cvar (name vd.v_ident)) stepm.m_inputs
@ (Caddrof (Cvar "res")
@ (Caddrof (Cvar "_res")
:: if cd.cd_stateful then [Caddrof (Cvar "mem")] else []) in
Cfun_call ((cname_of_qn cd.cd_name) ^ "_step", args) in
concat scanf_calls