Class: Rubex::AST::Expression::FuncPtrArgDeclaration

Inherits:
ArgDeclaration show all
Defined in:
lib/rubex/ast/expression/func_ptr_arg_declaration.rb

Instance Attribute Summary

Attributes inherited from ArgDeclaration

#data_hash

Attributes inherited from Base

#entry, #type, #typecast

Instance Method Summary collapse

Methods inherited from ArgDeclaration

#initialize

Methods inherited from Base

#allocate_temp, #allocate_temps, #analyse_for_target_type, #c_code, #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

This class inherits a constructor from Rubex::AST::Expression::ArgDeclaration

Instance Method Details

#analyse_types(local_scope, extern: false) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rubex/ast/expression/func_ptr_arg_declaration.rb', line 6

def analyse_types(local_scope, extern: false)
  var, dtype, ident, ptr_level, value = fetch_data
  cfunc_return_type = Helpers.determine_dtype(dtype, ident[:return_ptr_level])
  arg_list = ident[:arg_list].analyse_statement(local_scope)
  ptr_level = '*' if ptr_level.empty?
  name = ident[:name]
  c_name = Rubex::ARG_PREFIX + ident[:name]
  @type = Helpers.determine_dtype(
    DataType::CFunction.new(name, c_name, arg_list, cfunc_return_type, nil), ptr_level
  )
  add_arg_to_symbol_table name, c_name, value, extern, local_scope
end