Class: Rubex::AST::Expression::CommandCall
- Inherits:
-
Base
- Object
- Base
- Rubex::AST::Expression::CommandCall
show all
- Defined in:
- lib/rubex/ast/expression/command_call.rb
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, #expression?, #from_ruby_object, #generate_and_dispose_subexprs, #has_temp, #possible_typecast, #release_temp, #release_temps, #to_ruby_object
Constructor Details
#initialize(expr, command, arg_list) ⇒ CommandCall
Returns a new instance of CommandCall.
5
6
7
8
9
|
# File 'lib/rubex/ast/expression/command_call.rb', line 5
def initialize(expr, command, arg_list)
@expr = expr
@command = command
@arg_list = arg_list
end
|
Instance Method Details
#analyse_types(local_scope) ⇒ Object
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/rubex/ast/expression/command_call.rb', line 11
def analyse_types(local_scope)
@entry = local_scope.find(@command)
if @expr.nil? @expr = (@entry && !@entry.extern) ? Expression::Self.new : Expression::Empty.new
end
@expr.analyse_types(local_scope)
analyse_command_type local_scope
@subexprs = [@expr, @command]
super
end
|
#c_code(local_scope) ⇒ Object
39
40
41
42
43
|
# File 'lib/rubex/ast/expression/command_call.rb', line 39
def c_code(local_scope)
code = super
code << @c_code
code
end
|
#generate_assignment_code(rhs, code, local_scope) ⇒ Object
33
34
35
36
37
|
# File 'lib/rubex/ast/expression/command_call.rb', line 33
def generate_assignment_code(rhs, code, local_scope)
generate_evaluation_code code, local_scope
code << "#{c_code(local_scope)} = #{rhs.c_code(local_scope)};"
code.nl
end
|
#generate_disposal_code(code) ⇒ Object
28
29
30
31
|
# File 'lib/rubex/ast/expression/command_call.rb', line 28
def generate_disposal_code(code)
@expr.generate_disposal_code code
@command.generate_disposal_code code
end
|
#generate_evaluation_code(code, local_scope) ⇒ Object
22
23
24
25
26
|
# File 'lib/rubex/ast/expression/command_call.rb', line 22
def generate_evaluation_code(code, local_scope)
@expr.generate_evaluation_code(code, local_scope)
@command.generate_evaluation_code code, local_scope
@c_code = @command.c_code(local_scope)
end
|