pat_ty ne semble pas fiable. Voir t19.ept
This commit is contained in:
parent
3369f6dffc
commit
05750352f8
3 changed files with 14 additions and 20 deletions
|
@ -36,18 +36,17 @@ open Obc_mapfold
|
|||
let fresh_for = fresh_for "scalarize"
|
||||
|
||||
let act funs () a = match a with
|
||||
(* TODO | Acall([p], ...) *)
|
||||
| Aassgn (p, e) ->
|
||||
(match Modules.unalias_type p.pat_ty with
|
||||
(match Modules.unalias_type e.e_ty with
|
||||
| Types.Tarray (t, size) ->
|
||||
let new_vd, new_eq, w_from_e = match e.e_desc with
|
||||
| Eextvalue w -> [], [], w
|
||||
| _ ->
|
||||
(* a reference (alias) to the array, since we have a full expression *)
|
||||
let array_ref = Idents.gen_var "scalarize" "a_ref" in
|
||||
let vd_array_ref = mk_var_dec ~alias: true array_ref p.pat_ty in
|
||||
let vd_array_ref = mk_var_dec ~alias: true array_ref e.e_ty in
|
||||
(* reference initialization *)
|
||||
let pat_array_ref = mk_pattern ~loc: e.e_loc p.pat_ty (Lvar array_ref) in
|
||||
let pat_array_ref = mk_pattern ~loc: e.e_loc e.e_ty (Lvar array_ref) in
|
||||
let init_array_ref = Aassgn (pat_array_ref, e) in
|
||||
[vd_array_ref], [init_array_ref], ext_value_of_pattern pat_array_ref
|
||||
in
|
||||
|
@ -55,7 +54,7 @@ let act funs () a = match a with
|
|||
let array_ref_i i = mk_ext_value_exp t (Warray (w_from_e, i)) in
|
||||
let p_i i = mk_pattern t (Larray (p, i)) in
|
||||
let copy_i i =
|
||||
(* recursive call to deal with multidimensional arrays (go deeper) *)
|
||||
(* recursive call to deal with multidimensional arrays *)
|
||||
let a = Aassgn (p_i i, array_ref_i i) in
|
||||
let a, _ = act_it funs () a in
|
||||
[a]
|
||||
|
|
10
test/good/t19.ept
Normal file
10
test/good/t19.ept
Normal file
|
@ -0,0 +1,10 @@
|
|||
|
||||
fun substr<<n:int>> (x: int^n^n) returns (d: int)
|
||||
let
|
||||
d = x[0][0] - n;
|
||||
tel
|
||||
|
||||
fun mean<<n: int>> (i: int) returns (m: int)
|
||||
let
|
||||
m = substr<<n>> (i^n^n)
|
||||
tel
|
15
test/tt.ept
15
test/tt.ept
|
@ -1,15 +0,0 @@
|
|||
node m(x:int) returns (y:int)
|
||||
let
|
||||
y = 0 fby x
|
||||
tel
|
||||
|
||||
|
||||
node f(x,y:int;c1,c2:bool) returns (o1,o2:int)
|
||||
var r:bool;
|
||||
let
|
||||
r = true;
|
||||
reset
|
||||
o1 = m(x when c1);
|
||||
o2 = y
|
||||
every (true when c2)
|
||||
tel
|
Loading…
Reference in a new issue