Class: Delorean::FnArgs

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

Instance Method Summary collapse

Instance Method Details

#arg_countObject



459
460
461
462
# File 'lib/delorean/nodes.rb', line 459

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

#check(context) ⇒ Object



444
445
446
447
448
449
450
# File 'lib/delorean/nodes.rb', line 444

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



452
453
454
455
456
457
# File 'lib/delorean/nodes.rb', line 452

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