From 0aef6fcb5b08818500cfffec3f59a137cdb2f596 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9onard=20G=C3=A9rard?= Date: Wed, 23 Mar 2011 16:49:32 +0100 Subject: [PATCH] pattern_of_idx in right order. Probably array_elt_of_exp is also wrong. --- compiler/main/mls2obc.ml | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/compiler/main/mls2obc.ml b/compiler/main/mls2obc.ml index 009d818..f86e3ff 100644 --- a/compiler/main/mls2obc.ml +++ b/compiler/main/mls2obc.ml @@ -29,25 +29,23 @@ let gen_obj_ident n = Idents.gen_var "mls2obc" ((shortname n) ^ "_inst") let op_from_string op = { qual = Pervasives; name = op; } let rec pattern_of_idx_list p l = - let rec aux ty l = match ty, l with + let rec aux p l = match p.pat_ty, l with | _, [] -> p - | Tarray (ty',_), idx :: l -> mk_pattern ty' (Larray (aux ty' l, idx)) + | Tarray (ty',_), idx :: l -> aux (mk_pattern ty' (Larray (p, idx))) l | _ -> internal_error "mls2obc" 1 in - aux p.pat_ty (List.rev l) + aux p l let rec pattern_of_trunc_idx_list p l = let mk_between idx se = - mk_exp_int (Eop (mk_pervasives "between", - [idx; mk_exp se.se_ty (Econst se)])) + mk_exp_int (Eop (mk_pervasives "between", [idx; mk_exp se.se_ty (Econst se)])) in - let rec aux ty l = match ty, l with + let rec aux p l = match p.pat_ty, l with | _, [] -> p - | Tarray (ty', se), idx :: l -> - mk_pattern ty' (Larray (aux ty' l, mk_between idx se)) + | Tarray (ty', se), idx :: l -> aux (mk_pattern ty' (Larray (p, mk_between idx se))) l | _ -> internal_error "mls2obc" 1 in - aux p.pat_ty (List.rev l) + aux p l let array_elt_of_exp idx e = match e.e_desc, Modules.unalias_type e.e_ty with