提交 59aaaabe 编写于 作者: J Justin

Merge pull request #149 from presidentbeef/no_special_case_for_hamlout

Remove special Sexp nodes from HAML processor
......@@ -29,16 +29,15 @@ class Brakeman::HamlTemplateProcessor < Brakeman::TemplateProcessor
method = exp.method
if (call? target and target.method == :_hamlout) or target == :_hamlout
if (call? target and target.method == :_hamlout)
res = case method
when :adjust_tabs, :rstrip!, :attributes #Check attributes, maybe?
ignore
when :options
Sexp.new :call, :_hamlout, :options, exp.arglist
when :buffer
Sexp.new :call, :_hamlout, :buffer, exp.arglist
when :options, :buffer
exp
when :open_tag
Sexp.new(:tag, process(exp.arglist))
process(exp.arglist)
exp
else
arg = exp.first_arg
......
......@@ -23,36 +23,6 @@ class Brakeman::OutputProcessor < Ruby2Ruby
end
end
def process_call exp
if exp[0].is_a? Symbol
target = exp[0]
method = exp[1]
args = process exp[2]
out = nil
if method == :[]
if target
out = "#{target}[#{args}]"
else
raise Exception.new("Not sure what to do with access and no target: #{exp}")
end
else
if target
out = "#{target}.#{method}(#{args})"
else
out = "#{method}(#{args})"
end
end
exp.clear
out
else
super exp
end
end
def process_lvar exp
out = "(local #{exp[0]})"
exp.clear
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册