lib/covered/source.rb in covered-0.5.1 vs lib/covered/source.rb in covered-0.5.2
- old
+ new
@@ -60,11 +60,10 @@
attr :paths
def intercept_eval(string, binding = nil, filename = nil, lineno = 1)
return unless filename
- # TODO replace with Concurrent::Map
@mutex.synchronize do
@paths[filename] = string
end
end
@@ -75,21 +74,21 @@
def ignore?(node)
# NODE_ARGS Ruby doesn't report execution of arguments in :line tracepoint.
node.nil? or node.type.to_s =~ @ignore
end
- def expand(node, counts)
+ def expand(node, counts, level = 0)
# puts "#{node.first_lineno}: #{node.inspect}"
counts[node.first_lineno] ||= 0 if executable?(node)
- # puts "#{node.inspect} #{node.to_s} -> #{node.children.inspect}"
+ # puts "#{"\t"*level}#{node.type} (#{node.first_lineno})"
node.children.each do |child|
next unless child.is_a? RubyVM::AbstractSyntaxTree::Node
next if ignore?(child)
- expand(child, counts)
+ expand(child, counts, level + 1)
end
end
def parse(path)
# puts "Parse #{path}"