Class: DeepCover::Node::Rescue

Inherits:
DeepCover::Node show all
Defined in:
lib/deep_cover/node/exceptions.rb

Constant Summary

Constants inherited from DeepCover::Node

CLASSES, Complex, Cvasgn, Dsym, Erange, Float, Int, Ivar, Kwarg, Kwoptarg, Kwrestarg, OrAsgn, Rational, Sym, True, Zsuper

Instance Attribute Summary

Attributes inherited from DeepCover::Node

#base_node, #children, #index, #next_sibling, #parent, #previous_sibling

Instance Method Summary collapse

Methods inherited from DeepCover::Node

[], #[], atom, #children_nodes, #covered_code, define_module_class, #each_node, #fancy_type, #find_all, has_evaluated_segments, inherited, #initialize, #simple_literal?, #to_s, #type

Methods included from Memoize

#freeze, included

Constructor Details

This class inherits a constructor from DeepCover::Node

Instance Method Details

#execution_countObject



46
47
48
# File 'lib/deep_cover/node/exceptions.rb', line 46

def execution_count
  watched_body.flow_completion_count
end

#flow_completion_countObject



42
43
44
# File 'lib/deep_cover/node/exceptions.rb', line 42

def flow_completion_count
  resbodies.map(&:flow_completion_count).inject(0, :+) + self.else.flow_completion_count
end

#is_statementObject



38
39
40
# File 'lib/deep_cover/node/exceptions.rb', line 38

def is_statement
  false
end

#resbodies_flow_entry_count(child) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/deep_cover/node/exceptions.rb', line 50

def resbodies_flow_entry_count(child)
  prev = child.previous_sibling

  if prev.equal? watched_body
    prev.flow_entry_count - prev.flow_completion_count
  else # RESBODIES
    if prev.exception # rubocop:disable Style/IfInsideElse
      prev.exception.flow_completion_count - prev.execution_count
    else
      prev.flow_entry_count - prev.execution_count
    end
  end
end