提交 48cc5b41 编写于 作者: J Justin Collins

Reuse call locations in CallIndex

上级 9146de53
...@@ -9,6 +9,7 @@ class Brakeman::FindAllCalls < Brakeman::BaseProcessor ...@@ -9,6 +9,7 @@ class Brakeman::FindAllCalls < Brakeman::BaseProcessor
@current_method = nil @current_method = nil
@in_target = false @in_target = false
@calls = [] @calls = []
@cache = {}
end end
#Process the given source. Provide either class and method being searched #Process the given source. Provide either class and method being searched
...@@ -145,11 +146,18 @@ class Brakeman::FindAllCalls < Brakeman::BaseProcessor ...@@ -145,11 +146,18 @@ class Brakeman::FindAllCalls < Brakeman::BaseProcessor
def make_location def make_location
if @current_template if @current_template
{ :type => :template, key = [@current_template, @current_file]
cached = @cache[key]
return cached if cached
@cache[key] = { :type => :template,
:template => @current_template, :template => @current_template,
:file => @current_file } :file => @current_file }
else else
{ :type => :class, key = [@current_class, @current_method, @current_file]
cached = @cache[key]
return cached if cached
@cache[key] = { :type => :class,
:class => @current_class, :class => @current_class,
:method => @current_method, :method => @current_method,
:file => @current_file } :file => @current_file }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册