Class: Rubex::AST::Expression::MethodCall

Inherits:
Base
  • Object
show all
Defined in:
lib/rubex/ast/expression/method_call.rb

Direct Known Subclasses

CFunctionCall, RubyMethodCall

Instance Attribute Summary

Attributes inherited from Base

#entry, #type, #typecast

Instance Method Summary collapse

Methods inherited from Base

#allocate_temp, #allocate_temps, #analyse_for_target_type, #c_code, #expression?, #from_ruby_object, #generate_and_dispose_subexprs, #generate_assignment_code, #generate_disposal_code, #has_temp, #possible_typecast, #release_temp, #release_temps, #to_ruby_object

Constructor Details

#initialize(invoker, method_name, arg_list) ⇒ MethodCall

Returns a new instance of MethodCall.



5
6
7
8
9
# File 'lib/rubex/ast/expression/method_call.rb', line 5

def initialize(invoker, method_name, arg_list)
  @method_name = method_name
  @invoker = invoker
  @arg_list = arg_list
end

Instance Method Details

#analyse_types(local_scope) ⇒ Object



11
12
13
14
15
16
# File 'lib/rubex/ast/expression/method_call.rb', line 11

def analyse_types(local_scope)
  if method_not_within_scope? local_scope
    raise Rubex::NoMethodError, "Cannot call #{@method_name} from this method."
  end
  super
end

#generate_evaluation_code(code, local_scope) ⇒ Object



18
19
20
# File 'lib/rubex/ast/expression/method_call.rb', line 18

def generate_evaluation_code code, local_scope
  @arg_list.each { |a| a.generate_evaluation_code(code, local_scope) }
end