Module: RipperRubyParser::SexpHandlers::MethodCalls Private

Defined in:
lib/ripper_ruby_parser/sexp_handlers/method_calls.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Sexp handlers for method calls

Constant Summary collapse

CALL_OP_MAP =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

{
  '.': :call,
  '::': :call,
  '&.': :safe_call
}.freeze

Instance Method Summary collapse

Instance Method Details

#process_call(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ripper_ruby_parser/sexp_handlers/method_calls.rb', line 24

def process_call(exp)
  _, receiver, op, ident = exp.shift 4
  type = CALL_OP_MAP.fetch op
  case ident
  when :call
    s(type, process(receiver), :call)
  else
    with_position_from_node_symbol(ident) do |method|
      s(type, process(receiver), method)
    end
  end
end

#process_command(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
40
41
42
43
# File 'lib/ripper_ruby_parser/sexp_handlers/method_calls.rb', line 37

def process_command(exp)
  _, ident, arglist = exp.shift 3
  with_position_from_node_symbol(ident) do |method|
    args = handle_argument_list(arglist)
    s(:call, nil, method, *args)
  end
end

#process_command_call(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



45
46
47
48
49
50
51
52
# File 'lib/ripper_ruby_parser/sexp_handlers/method_calls.rb', line 45

def process_command_call(exp)
  _, receiver, op, ident, arguments = exp.shift 5
  type = CALL_OP_MAP.fetch op
  with_position_from_node_symbol(ident) do |method|
    args = handle_argument_list(arguments)
    s(type, process(receiver), method, *args)
  end
end

#process_fcall(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



61
62
63
64
65
66
# File 'lib/ripper_ruby_parser/sexp_handlers/method_calls.rb', line 61

def process_fcall(exp)
  _, ident = exp.shift 2
  with_position_from_node_symbol(ident) do |method|
    s(:call, nil, method)
  end
end

#process_method_add_arg(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ripper_ruby_parser/sexp_handlers/method_calls.rb', line 5

def process_method_add_arg(exp)
  _, call, parens = exp.shift 3
  call = process(call)
  unless parens.empty?
    parens = process(parens)
    parens.shift
  end
  parens.each do |arg|
    call << arg
  end
  call
end

#process_super(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



68
69
70
71
72
73
# File 'lib/ripper_ruby_parser/sexp_handlers/method_calls.rb', line 68

def process_super(exp)
  _, args = exp.shift 2
  args = process(args)
  args.shift
  s(:super, *args)
end

#process_vcall(exp) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



54
55
56
57
58
59
# File 'lib/ripper_ruby_parser/sexp_handlers/method_calls.rb', line 54

def process_vcall(exp)
  _, ident = exp.shift 2
  with_position_from_node_symbol(ident) do |method|
    s(:call, nil, method)
  end
end