Skip to content

Commit

Permalink
Merge pull request #149 from presidentbeef/no_special_case_for_hamlout
Browse files Browse the repository at this point in the history
Remove special Sexp nodes from HAML processor
  • Loading branch information
presidentbeef committed Sep 21, 2012
2 parents 4d60342 + c0cedbd commit 59aaaab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 36 deletions.
11 changes: 5 additions & 6 deletions lib/brakeman/processors/haml_template_processor.rb
Expand Up @@ -29,16 +29,15 @@ def process_call exp

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

Expand Down
30 changes: 0 additions & 30 deletions lib/brakeman/processors/output_processor.rb
Expand Up @@ -23,36 +23,6 @@ def process exp
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
Expand Down

0 comments on commit 59aaaab

Please sign in to comment.