Class: DeepCover::Node::Csend

Inherits:
DeepCover::Node show all
Includes:
Branch
Defined in:
lib/deep_cover/node/send.rb

Direct Known Subclasses

CsendWithBlock

Constant Summary

Constants inherited from DeepCover::Node

And, 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 included from Branch

#flow_completion_count

Methods inherited from DeepCover::Node

#[], [], atom, #children_nodes, #covered_code, #each_node, #fancy_type, #find_all, has_evaluated_segments, inherited, #to_s, #type

Methods included from Memoize

#freeze, included

Constructor Details

#initialize(base_node, base_children: base_node.children) ⇒ Csend

Returns a new instance of Csend.



78
79
80
81
82
# File 'lib/deep_cover/node/send.rb', line 78

def initialize(base_node, base_children: base_node.children, **)
  send_without_receiver = base_node.updated(:safe_send, [nil, *base_node.children.drop(1)])
  base_children = [base_children.first, send_without_receiver]
  super
end

Instance Method Details

#branchesObject



94
95
96
97
98
# File 'lib/deep_cover/node/send.rb', line 94

def branches
  [actual_send,
   TrivialBranch.new(condition: receiver, other_branch: actual_send),
  ]
end

#execution_countObject



86
87
88
# File 'lib/deep_cover/node/send.rb', line 86

def execution_count
  receiver.flow_completion_count
end

#messageObject



90
91
92
# File 'lib/deep_cover/node/send.rb', line 90

def message
  actual_send.message
end