Class: Delorean::SafeNavigationCall

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

Instance Method Summary collapse

Methods inherited from Call

#check

Instance Method Details

#rewrite(context, vcode) ⇒ Object



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
# File 'lib/delorean/nodes.rb', line 432

def rewrite(context, vcode)
  if al.text_value.empty?
    args_str = ''
    arg_count = 0
  else
    args_str = al.rewrite(context)
    arg_count = al.arg_count
  end

  if vcode.is_a?(ClassText)
    # FIXME: Do we really need this check here?
    # ruby class call
    class_name = vcode.text
    context.parse_check_call_fn(i.text_value, arg_count, class_name)
  end

  "_safe_navigation_instance_call(
    #{vcode}, '#{i.text_value}', [#{args_str}], _e
  )"
end