Skip to content

Commit

Permalink
avoid replacing local function args when outside of it in optimize_co…
Browse files Browse the repository at this point in the history
…mpletion (close HaxeFoundation#2542)
  • Loading branch information
ncannasse committed Feb 20, 2015
1 parent 8a8b5ad commit 483cb0a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions optimizer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1549,6 +1549,8 @@ let optimize_completion_expr e =
with Not_found ->
(* not found locals are most likely to be member/static vars *)
e)
| EFunction (_,f) ->
Ast.map_expr (subst_locals { r = PMap.foldi (fun n i acc -> if List.exists (fun (a,_,_,_) -> a = n) f.f_args then acc else PMap.add n i acc) locals.r PMap.empty }) e
| _ ->
Ast.map_expr (subst_locals locals) e
in
Expand Down

0 comments on commit 483cb0a

Please sign in to comment.