Commit 95544e70 authored by Julien Lopez's avatar Julien Lopez
Browse files

Attempt to add a fresh variable to Patterns.Cap (still not working)

parent 315736ac
......@@ -184,10 +184,21 @@ and compile_branch env br =
(* We add a fresh variable "pat<nb>:x" for each pattern
TODO: Add a fresh variable for cap too. *)
let t, _, d = br.Typed.br_pat.Patterns.descr in
let fv = match d with
| Patterns.Constr(_) | Patterns.Cap(_) -> Patterns.fv br.Typed.br_pat
| _ -> incr Patterns.counter; (Patterns.fv br.Typed.br_pat)
@ [!Patterns.counter, "pat" ^ (string_of_int !Patterns.counter) ^ ":x"] in
let fv, d = match d with
| Patterns.Constr(_) -> Patterns.fv br.Typed.br_pat, d
| Patterns.Cap((t1, _, d1), (t2, _, d2)) -> incr Patterns.counter;
let fv = (Patterns.fv br.Typed.br_pat)
@ [!Patterns.counter, "pat" ^ (string_of_int !Patterns.counter) ^ ":x"] in
fv, Patterns.Cap((t1, fv, d1), (t2, fv, d2))
| Patterns.Cup((t1, _, d1), (t2, _, d2)) -> incr Patterns.counter;
let fv = (Patterns.fv br.Typed.br_pat)
@ [!Patterns.counter, "pat" ^ (string_of_int !Patterns.counter) ^ ":x"] in
fv, Patterns.Cup((t1, fv, d1), (t2, fv, d2))
| _ -> incr Patterns.counter;
let fv = (Patterns.fv br.Typed.br_pat)
@ [!Patterns.counter, "pat" ^ (string_of_int !Patterns.counter) ^ ":x"] in
fv, d
in
let pat = { br.Typed.br_pat with Patterns.descr=(t,fv,d); Patterns.fv=fv } in
let env = List.fold_left enter_local env fv in
let m = Patterns.filter (Types.descr (Patterns.accept pat)) pat in
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment