module DeepCover::Node::Mixin::ExecutionLocation

Public Class Methods

included(base) click to toggle source
# File lib/deep_cover/node/mixin/execution_location.rb, line 6
def self.included(base)
  base.extend ClassMethods
  base.has_child_handler('%{name}_executed_loc_keys')
end

Public Instance Methods

child_executed_loc_keys(_child, _child_name) click to toggle source
# File lib/deep_cover/node/mixin/execution_location.rb, line 28
def child_executed_loc_keys(_child, _child_name)
  nil
end
diagnostic_expression() click to toggle source
# File lib/deep_cover/node/mixin/execution_location.rb, line 56
def diagnostic_expression
  expression || parent.diagnostic_expression
end
executed_loc_hash() click to toggle source
# File lib/deep_cover/node/mixin/execution_location.rb, line 32
def executed_loc_hash
  h = Tools.slice(loc_hash, *executed_loc_keys)
  if (keys = parent.child_executed_loc_keys(self))
    h.merge!(Tools.slice(parent.loc_hash, *keys))
  end
  h.reject { |k, v| v.nil? }
end
executed_loc_keys() click to toggle source
# File lib/deep_cover/node/mixin/execution_location.rb, line 23
def executed_loc_keys
  return [] unless executable?
  loc_hash.keys - [:expression]
end
executed_locs() click to toggle source
# File lib/deep_cover/node/mixin/execution_location.rb, line 40
def executed_locs
  executed_loc_hash.values
end
expression() click to toggle source
# File lib/deep_cover/node/mixin/execution_location.rb, line 48
def expression
  loc_hash[:expression]
end
loc_hash() click to toggle source
# File lib/deep_cover/node/mixin/execution_location.rb, line 44
def loc_hash
  base_node.respond_to?(:location) ? base_node.location.to_hash : {}
end
proper_range() click to toggle source

Returns an array of character numbers (in the original buffer) that pertain exclusively to this node (and thus not to any children).

# File lib/deep_cover/node/mixin/execution_location.rb, line 62
def proper_range
  executed_locs.map(&:to_a).inject([], :+).uniq
end
source() click to toggle source
# File lib/deep_cover/node/mixin/execution_location.rb, line 52
def source
  expression.source if expression
end