Class: Rubex::AST::Statement::ForwardDecl
- Defined in:
- lib/rubex/ast/statement/forward_decl.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #analyse_statement(local_scope, extern: false) ⇒ Object
- #generate_code(code, local_scope) ⇒ Object
-
#initialize(kind, name, location) ⇒ ForwardDecl
constructor
A new instance of ForwardDecl.
- #rescan_declarations(_local_scope) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(kind, name, location) ⇒ ForwardDecl
Returns a new instance of ForwardDecl.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/rubex/ast/statement/forward_decl.rb', line 5 def initialize(kind, name, location) super(location) @name = name if /struct/.match kind @kind = :struct elsif /union/.match kind @kind = :union end Rubex::CUSTOM_TYPES[@name] = @name end |
Instance Method Details
#analyse_statement(local_scope, extern: false) ⇒ Object
16 17 18 19 20 |
# File 'lib/rubex/ast/statement/forward_decl.rb', line 16 def analyse_statement(local_scope, extern: false) @c_name = Rubex::TYPE_PREFIX + local_scope.klass_name + '_' + @name @type = Rubex::DataType::TypeDef.new("#{@kind} #{@name}", @c_name, @type) local_scope.declare_type type: @type, extern: extern end |
#generate_code(code, local_scope) ⇒ Object
27 |
# File 'lib/rubex/ast/statement/forward_decl.rb', line 27 def generate_code(code, local_scope); end |