Commit 3037d748 authored by Julien Lopez's avatar Julien Lopez
Browse files

Merge from master to propagate

parents 180e9317 b59ef008
......@@ -199,18 +199,10 @@ and compile_branches env (brs : Typed.branches) =
(* p_i / t_i -> br.Typed.br_pat / br.Typed.br_type
* p_i / t_i is used here to add elements to env.gamma *)
and compile_branch env br =
(* We add a fresh variable "pat<nb>:x" for each pattern *)
let t, fv, d = br.Typed.br_pat.Patterns.descr in
let fv, d = incr Patterns.counter;
let freshname = "pat" ^ (string_of_int !Patterns.counter) ^ ":x" in
let fv = fv @ [!Patterns.counter, freshname] in
fv, Patterns.Cap((Types.any, fv, Patterns.Capture(!Patterns.counter, freshname)), (t, 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
let env = List.fold_left enter_local env (Patterns.fv br.Typed.br_pat) in
let m = Patterns.filter (Types.descr (Patterns.accept br.Typed.br_pat)) br.Typed.br_pat in
let env = { env with gamma = IdMap.union_disj m env.gamma } in
(pat, compile env br.Typed.br_body )
(br.Typed.br_pat, compile env br.Typed.br_body)
let enter_globals env n = match env.cu with
| None -> List.fold_left enter_global_toplevel env n
......
......@@ -374,15 +374,6 @@ x=(1,2)
IdSet.cup
(approx_var seen p1 t (IdSet.cap fv1 xs))
(approx_var seen p2 t (IdSet.cap fv2 xs))
(*
| Cap ((_,fv1,d1) as p1,((_,fv2,d2) as p2)) ->
(match d1 with
| Capture(_, name) when Str.string_match (Str.regexp "pat[0-9]+:") name 0 ->
(match d2 with | Constr _ -> fv2 | _ -> approx_var seen p2 t xs)
| _ -> IdSet.cup
(approx_var seen p1 t (IdSet.cap fv1 xs))
(approx_var seen p2 t (IdSet.cap fv2 xs)))
*)
| Capture _ ->
xs
| Constant (_,c) ->
......
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