提交 c40541c4 编写于 作者: J Justin Collins

Avoid replacing variable with variable + stuff

to attempt to avoid stuff blowing up ridiculously
which should help #36
上级 e8f2b8d8
......@@ -89,7 +89,7 @@ class Brakeman::AliasProcessor < SexpProcessor
end
#Generic replace
if replacement = env[exp]
if replacement = env[exp] and not sexp_includes?(replacement, exp)
set_line replacement.deep_clone, exp.line
else
exp
......@@ -513,4 +513,20 @@ class Brakeman::AliasProcessor < SexpProcessor
exp
end
end
def sexp_includes? exp, search_term
search_queue = [exp]
until search_queue.empty?
node = search_queue.shift
if node == search_term
return true
elsif sexp? node
search_queue.concat node
end
end
false
end
end
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册