Class: Rubex::AST::Statement::CPtrFuncDecl

Inherits:
CPtrDecl show all
Defined in:
lib/rubex/ast/statement/c_ptr_decl/c_ptr_func_decl.rb

Instance Attribute Summary

Attributes inherited from CPtrDecl

#entry, #type

Attributes inherited from Base

#location

Instance Method Summary collapse

Methods inherited from CPtrDecl

#generate_code, #rescan_declarations

Methods inherited from Base

#==, #generate_code, #statement?

Constructor Details

#initialize(type, name, value, ptr_level, location) ⇒ CPtrFuncDecl

Returns a new instance of CPtrFuncDecl.



5
6
7
# File 'lib/rubex/ast/statement/c_ptr_decl/c_ptr_func_decl.rb', line 5

def initialize(type, name, value, ptr_level, location)
  super
end

Instance Method Details

#analyse_statement(local_scope, extern: false) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rubex/ast/statement/c_ptr_decl/c_ptr_func_decl.rb', line 9

def analyse_statement(local_scope, extern: false)
  cptr_cname extern
  ident = @type[:ident]
  ident[:arg_list].analyse_statement(local_scope)
  @type = DataType::CFunction.new(
    @name,
    @c_name,
    ident[:arg_list],
    Helpers.determine_dtype(@type[:dtype], ident[:return_ptr_level]),
    nil
  )
  super
end