Class: Rubex::AST::Expression::Typecast
- Defined in:
- lib/rubex/ast/expression/typecast.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #analyse_types(_local_scope) ⇒ Object
- #c_code(_local_scope) ⇒ Object
-
#initialize(dtype, ptr_level) ⇒ Typecast
constructor
A new instance of Typecast.
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
Returns a new instance of 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 |