提交 818ecf50 编写于 作者: J Justin Collins

Remove new call creation in template processing

上级 0c699b00
......@@ -46,11 +46,9 @@ class Brakeman::ErbTemplateProcessor < Brakeman::TemplateProcessor
exp.arglist = process(exp.arglist)
make_render_in_view exp
else
#TODO: Is it really necessary to create a new Sexp here?
call = make_call target, method, process_all!(exp.args)
call.original_line = exp.original_line
call.line(exp.line)
call
exp.target = target
exp.arglist = process(exp.arglist)
exp
end
end
......
......@@ -9,12 +9,14 @@ class Brakeman::ErubisTemplateProcessor < Brakeman::TemplateProcessor
if sexp? target
target = process target
end
exp.target = target
exp.arglist = process exp.arglist
method = exp.method
#_buf is the default output variable for Erubis
if node_type?(target, :lvar, :ivar) and (target.value == :_buf or target.value == :@output_buffer)
if method == :<< or method == :safe_concat
exp.arglist = process exp.arglist
arg = exp.first_arg
......@@ -42,14 +44,9 @@ class Brakeman::ErubisTemplateProcessor < Brakeman::TemplateProcessor
abort "Unrecognized action on buffer: #{method}"
end
elsif target == nil and method == :render
exp.arglist = process exp.arglist
make_render_in_view exp
else
#TODO: Is it really necessary to create a new Sexp here?
call = make_call target, method, process_all!(exp.args)
call.original_line = exp.original_line
call.line(exp.line)
call
exp
end
end
......
......@@ -76,11 +76,9 @@ class Brakeman::HamlTemplateProcessor < Brakeman::TemplateProcessor
exp.arglist = process exp.arglist
make_render_in_view exp
else
#TODO: Do we really need a new Sexp here?
call = make_call target, method, process_all!(exp.args)
call.original_line = exp.original_line
call.line(exp.line)
call
exp.target = target
exp.arglist = process exp.arglist
exp
end
end
......
......@@ -38,10 +38,8 @@ class Brakeman::SlimTemplateProcessor < Brakeman::TemplateProcessor
exp.arglist = process exp.arglist
make_render_in_view exp
else
call = make_call target, method, process_all!(exp.args)
call.original_line = exp.original_line
call.line(exp.line)
call
exp.arglist = process exp.arglist
exp
end
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册