Class: DeepCover::Node::Optarg

Inherits:
DeepCover::Node show all
Defined in:
lib/deep_cover/node/arguments.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

#executable?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/deep_cover/node/arguments.rb', line 40

def executable?
  false
end

#rewrite_defaultObject

Default child rewriting rule



29
30
31
32
33
34
35
36
37
38
# File 'lib/deep_cover/node/arguments.rb', line 29

def rewrite_default
  if parent.children.size >= 32 && RUBY_VERSION >= '2.3' && RUBY_VERSION < '2.6'
    # Workaround for Ruby bugs when too many default arguments are present
    # This will ignore some cases which would not create issues, but its rare enough to have
    # 32 arguments to a method that I don't care.
    # https://github.com/deep-cover/deep-cover/issues/47#issuecomment-477176061
    return
  end
  '(%{default_tracker};%{node})'
end