Class: Delorean::FnArgs

Inherits:
SNode
  • Object
show all
Defined in:
lib/delorean/nodes.rb

Instance Method Summary collapse

Instance Method Details

#arg_countObject



653
654
655
656
# File 'lib/delorean/nodes.rb', line 653

def arg_count
  defined?(args_rest.args) && !args_rest.args.text_value.empty? ?
    1 + args_rest.args.arg_count : 1
end

#check(context) ⇒ Object



638
639
640
641
642
643
644
# File 'lib/delorean/nodes.rb', line 638

def check(context, *)
  [
    arg0.check(context),
    (args_rest.args.check(context) if
      defined?(args_rest.args) && !args_rest.args.text_value.empty?)
  ].compact.sum
end

#rewrite(context) ⇒ Object



646
647
648
649
650
651
# File 'lib/delorean/nodes.rb', line 646

def rewrite(context)
  rest = ', ' + args_rest.args.rewrite(context) if
    defined?(args_rest.args) && !args_rest.args.text_value.empty?

  [arg0.rewrite(context), rest].compact.sum
end