[IR] address long-lived FIXME in computing free variables

Summary: That should do it.

Reviewed By: sblackshear, mbouaziz

Differential Revision: D7113356

fbshipit-source-id: 4b5ebb0
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent bc7a71d413
commit a926f82c39

@ -297,17 +297,13 @@ let rec gen_free_vars =
function function
| Var id -> | Var id ->
yield id yield id
| Cast (_, e) | Cast (_, e) | Exn e | Lfield (e, _, _) | Sizeof {dynamic_length= Some e} | UnOp (_, e, _) ->
| Exn e
| Lfield (e, _, _)
(* do nothing since we only count non-program variables *)
| UnOp (_, e, _) ->
gen_free_vars e gen_free_vars e
| Closure {captured_vars} -> | Closure {captured_vars} ->
ISequence.gen_sequence_list captured_vars ~f:(fun (e, _, _) -> gen_free_vars e) ISequence.gen_sequence_list captured_vars ~f:(fun (e, _, _) -> gen_free_vars e)
| Const (Cint _ | Cfun _ | Cstr _ | Cfloat _ | Cclass _) | Const (Cint _ | Cfun _ | Cstr _ | Cfloat _ | Cclass _)
| Lvar _ | Lvar _
| Sizeof _ (* TODO: Sizeof length expressions may contain variables, do not ignore them. *) -> | Sizeof {dynamic_length= None} ->
return () return ()
| BinOp (_, e1, e2) | Lindex (e1, e2) -> | BinOp (_, e1, e2) | Lindex (e1, e2) ->
gen_free_vars e1 >>= fun () -> gen_free_vars e2 gen_free_vars e1 >>= fun () -> gen_free_vars e2

Loading…
Cancel
Save