Class: Rubex::AST::Expression::Typecast
- Inherits:
-
Base
- Object
- Base
- Rubex::AST::Expression::Typecast
show all
- Defined in:
- lib/rubex/ast/expression/typecast.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, #generate_assignment_code, #generate_disposal_code, #generate_evaluation_code, #has_temp, #possible_typecast, #release_temp, #release_temps, #to_ruby_object
Constructor Details
#initialize(dtype, ptr_level) ⇒ Typecast
5
6
7
8
|
# File 'lib/rubex/ast/expression/typecast.rb', line 5
def initialize(dtype, ptr_level)
@dtype = dtype
@ptr_level = ptr_level
end
|
Instance Method Details
#analyse_types(_local_scope) ⇒ Object
10
11
12
|
# File 'lib/rubex/ast/expression/typecast.rb', line 10
def analyse_types(_local_scope)
@type = Rubex::Helpers.determine_dtype @dtype, @ptr_level
end
|
#c_code(_local_scope) ⇒ Object
14
15
16
|
# File 'lib/rubex/ast/expression/typecast.rb', line 14
def c_code(_local_scope)
"(#{@type})"
end
|