Class: Delorean::FnArgs

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

Instance Method Summary collapse

Instance Method Details

#arg_countObject



398
399
400
401
# File 'lib/delorean/nodes.rb', line 398

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

#check(context) ⇒ Object



383
384
385
386
387
388
389
# File 'lib/delorean/nodes.rb', line 383

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



391
392
393
394
395
396
# File 'lib/delorean/nodes.rb', line 391

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