lib/fasterer/method_call.rb in fasterer-0.1.8 vs lib/fasterer/method_call.rb in fasterer-0.1.9

- old
+ new

@@ -40,12 +40,10 @@ @call_element = case element.sexp_type when :call @element when :iter @element[1] - else - fail '!!!!!!!' end end def set_receiver @receiver = ReceiverFactory.new(receiver_element) @@ -75,36 +73,20 @@ def set_block_argument_names @block_argument_names = if has_block? and element[2].is_a?(Sexp) # hack for lambdas element[2].drop(1).map { |argument| argument } end || [] end - - def token - element[0] - end end - # For now, used for determening if - # the receiver is a reference or not. + # For now, used for determening if the + # receiver is a reference or a method call. class ReceiverFactory - attr_reader :name - attr_reader :method - def self.new(receiver_info) - return if receiver_info.nil? - token = receiver_info.first + return unless receiver_info.is_a?(Sexp) - case token + case receiver_info.sexp_type when :lvar return VariableReference.new(receiver_info) - when :method_add_arg, :method_add_block - case receiver_info[1][0] - when :call, :fcall - return MethodCall.new(receiver_info[1]) - else - # binding.pry watch out for :method_add_arg - # raise 'nije ni metoda' - end when :call, :iter return MethodCall.new(receiver_info) end end end