Class: Delorean::Call

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

Instance Method Summary collapse

Instance Method Details

#check(context) ⇒ Object



330
331
332
# File 'lib/delorean/nodes.rb', line 330

def check(context, *)
  al.text_value.empty? ? [] : al.check(context)
end

#rewrite(context, vcode) ⇒ Object



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
# File 'lib/delorean/nodes.rb', line 334

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

  if vcode.is_a?(ClassText)
    # ruby class call
    class_name = vcode.text
    context.parse_check_call_fn(i.text_value, arg_count, class_name)
    "#{class_name}.#{i.text_value}(#{args_str})"
  else
    "_instance_call(#{vcode}, '#{i.text_value}', [#{args_str}], _e)"
  end
end