Class: DeepCover::Node::Masgn::Setter

Inherits:
DeepCover::Node show all
Includes:
BackwardsStrategy
Defined in:
lib/deep_cover/node/assignments.rb

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 BackwardsStrategy

#flow_completion_count, #flow_entry_count

Methods inherited from DeepCover::Node

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

Methods included from Memoize

#freeze, included

Constructor Details

This class inherits a constructor from DeepCover::Node

Instance Method Details

#loc_hashObject



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/deep_cover/node/assignments.rb', line 88

def loc_hash
  base = super
  if method_name == :[]=
    selector = base[:selector]
    {
      expression: base[:expression],
      selector_begin: selector.resize(1),
      # The = is implicit, so only backtrack the end by one
      selector_end: Parser::Source::Range.new(selector.source_buffer, selector.end_pos - 1, selector.end_pos),
    }
  else
    {
      dot: base[:dot],
      expression: base[:expression],
      selector_begin: base[:selector],
      selector_end: nil, # ,
    }
  end
end