let new_procedure name args value pos ext =
{
def_name = name;
def_type = Unit;
def_nature = Fun;
def_value = Procedure
(
let p =
{
proc_args = args;
proc_value = value;
proc_used = false;
proc_asm_def = Asm_ir.proc_stub name (List.map (fun a -> Asm_ir.new_var_def Asm_ir.No_type 0) args) 0; (* TODO: globally unique name *) (* TODO: this should be filled later *)
proc_external = ext;
}
in
List.iter2 (fun a b -> a.def_asm <- Asm_var b) args p.proc_asm_def.Asm_ir.proc_args;
(* An argument is considered as any other variable. *)
value.block_env <- concat_env true (env_of_def_list args) value.block_env;
p
);
def_pos = pos;
def_coord = [];
def_asm = Asm_none;
def_pass_by_ref = false;
}