Class: Rubex::AST::TopStatement::AttachedKlass
- Defined in:
- lib/rubex/ast/top_statement/klass/attached_klass.rb
Constant Summary collapse
- ALLOC_FUNC_NAME =
Rubex::ALLOC_FUNC_NAME
- DEALLOC_FUNC_NAME =
Rubex::DEALLOC_FUNC_NAME
- MEMCOUNT_FUNC_NAME =
Rubex::MEMCOUNT_FUNC_NAME
- GET_STRUCT_FUNC_NAME =
Rubex::GET_STRUCT_FUNC_NAME
Instance Attribute Summary collapse
-
#attached_type ⇒ Object
readonly
Returns the value of attribute attached_type.
Attributes inherited from Klass
#ancestor, #entry, #name, #scope, #statements
Instance Method Summary collapse
- #analyse_statement(outer_scope) ⇒ Object
- #generate_code(code) ⇒ Object
-
#initialize(name, attached_type, ancestor, statements, location) ⇒ AttachedKlass
constructor
A new instance of AttachedKlass.
Methods inherited from Klass
Methods included from Helpers::Writers
#declare_carrays, #declare_ruby_objects, #declare_temps, #declare_types, #declare_vars, #sue_footer, #sue_header, #write_char_2_ruby_str_code, #write_char_2_ruby_str_header, #write_usability_functions_code, #write_usability_functions_header, #write_usability_macros
Constructor Details
#initialize(name, attached_type, ancestor, statements, location) ⇒ AttachedKlass
Returns a new instance of AttachedKlass.
12 13 14 15 16 |
# File 'lib/rubex/ast/top_statement/klass/attached_klass.rb', line 12 def initialize(name, attached_type, ancestor, statements, location) @attached_type = attached_type @location = location super(name, ancestor, statements) end |
Instance Attribute Details
#attached_type ⇒ Object (readonly)
Returns the value of attribute attached_type.
5 6 7 |
# File 'lib/rubex/ast/top_statement/klass/attached_klass.rb', line 5 def attached_type @attached_type end |
Instance Method Details
#analyse_statement(outer_scope) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rubex/ast/top_statement/klass/attached_klass.rb', line 18 def analyse_statement(outer_scope) super(outer_scope, attach_klass: true) prepare_data_holding_struct! prepare_rb_data_type_t_struct detach_and_modify_auxillary_c_functions_from_statements add_auxillary_functions_to_klass_scope prepare_auxillary_c_functions @statements[1..-1].each do |stmt| # 0th stmt is the data struct if ruby_method_or_c_func_without_gil_lock?(stmt) rewrite_method_with_data_fetching stmt end stmt.analyse_statement @scope end analyse_auxillary_c_functions end |
#generate_code(code) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/rubex/ast/top_statement/klass/attached_klass.rb', line 34 def generate_code(code) write_auxillary_c_functions code write_data_type_t_struct code write_get_struct_c_function code write_alloc_c_function code super end |