Class: Rubex::AST::Node::FileNode

Inherits:
Base
  • Object
show all
Defined in:
lib/rubex/ast/node/file_node.rb

Overview

Class for denoting a rubex file that is required from another rubex file.

Takes the Object scope from the MainNode or other FileNode objects and
uses that for storing any symbols that it encounters.

Instance Attribute Summary

Attributes inherited from Base

#file_name, #statements

Instance Method Summary collapse

Methods inherited from Base

#==, #add_top_statements_to_object_scope, #c_name_for_class, #call_dependent_init_methods, #create_symtab_entries_for_top_statements, #declare_unique_types, #define_classes, #define_instance_and_singleton_methods_for_all_classes, #generate_header_file, #generate_init_method, #init_function, #initialize, #object_or_stdlib_klass_scope, #outside_statement?, #rescan_declarations, #write_function_declarations, #write_global_variable_declarations, #write_outside_statements, #write_user_klasses

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

This class inherits a constructor from Rubex::AST::Node::Base

Instance Method Details

#analyse_statement(_local_scope) ⇒ Object



8
9
10
11
12
# File 'lib/rubex/ast/node/file_node.rb', line 8

def analyse_statement(_local_scope)
  add_top_statements_to_object_scope
  super()
  rescan_declarations @scope
end

#generate_code(supervisor) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/rubex/ast/node/file_node.rb', line 14

def generate_code(supervisor)
  supervisor.init_file(@file_name)
  code_writer = supervisor.code(@file_name)
  code_writer.write_include @file_name
  generate_header_file @file_name, supervisor.header(@file_name)
  super
  generate_init_method code_writer
end