Skip to content

Commit

Permalink
[analyzer] actually retain TMeta
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Dec 14, 2014
1 parent 06ac05d commit 68bc43c
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions analyzer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,6 @@ module Simplifier = struct
(* | TBinop(OpAssignOp op,({eexpr = TLocal _} as e1),e2) ->
push e;
mk_assign e1 *)
| TParenthesis e1 ->
loop e1 (* this is weird *)
| _ ->
mk_assign e
in
Expand All @@ -145,24 +143,35 @@ module Simplifier = struct
let e = mk (TVar (v,e_init)) com.basic.tvoid p in
push e;
in
begin match eo with
let e_v = match eo with
| None ->
declare None
declare None;
e_v
| Some e1 ->
begin match e1.eexpr with
| TThrow _ | TReturn _ | TBreak | TContinue ->
()
e_v
| _ ->
let rec loop e_v e = match e.eexpr with
| TParenthesis e1 ->
loop {e_v with eexpr = TParenthesis e_v} e1
| TMeta(m,e1) ->
loop {e_v with eexpr = TMeta(m,e_v)} e1
| _ ->
e_v,e
in
let e_v',e1 = loop e_v e1 in
let e1 = assign e_v e1 in
begin match e1.eexpr with
| TBinop(OpAssign,{eexpr = TLocal v1},e2) when v == v1 ->
declare (Some e2)
| _ ->
declare None;
push e1
end
end;
e_v'
end
end;
in
e_v
in
let rec push_block () =
Expand Down

0 comments on commit 68bc43c

Please sign in to comment.