Class: Rubex::AST::Expression::SizeOf
- Defined in:
- lib/rubex/ast/expression/size_of.rb
Overview
C sizeof operator.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #analyse_types(local_scope) ⇒ Object
- #c_code(_local_scope) ⇒ Object
-
#initialize(type, ptr_level) ⇒ SizeOf
constructor
A new instance of SizeOf.
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(type, ptr_level) ⇒ SizeOf
Returns a new instance of SizeOf.
6 7 8 |
# File 'lib/rubex/ast/expression/size_of.rb', line 6 def initialize(type, ptr_level) @type, @ptr_level = type, ptr_level end |
Instance Method Details
#analyse_types(local_scope) ⇒ Object
10 11 12 13 14 |
# File 'lib/rubex/ast/expression/size_of.rb', line 10 def analyse_types(local_scope) @size_of_type = Helpers.determine_dtype @type, @ptr_level @type = DataType::ULInt.new super end |
#c_code(_local_scope) ⇒ Object
16 17 18 |
# File 'lib/rubex/ast/expression/size_of.rb', line 16 def c_code(_local_scope) "sizeof(#{@size_of_type})" end |