Explorar o código

avoid replacing local function args when outside of it in optimize_completion (close #2542)

Nicolas Cannasse %!s(int64=10) %!d(string=hai) anos
pai
achega
483cb0a4ff
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      optimizer.ml

+ 2 - 0
optimizer.ml

@@ -1549,6 +1549,8 @@ let optimize_completion_expr e =
 					with Not_found ->
 					with Not_found ->
 						(* not found locals are most likely to be member/static vars *)
 						(* not found locals are most likely to be member/static vars *)
 						e)
 						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
 					Ast.map_expr (subst_locals locals) e
 			in
 			in