Class: Rubex::AST::Statement::CArrayDecl

Inherits:
Base
  • Object
show all
Defined in:
lib/rubex/ast/statement/c_array_decl.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#location

Instance Method Summary collapse

Methods inherited from Base

#==, #statement?

Constructor Details

#initialize(type, array_ref, array_list, location) ⇒ CArrayDecl

Returns a new instance of CArrayDecl.



7
8
9
10
11
12
13
# File 'lib/rubex/ast/statement/c_array_decl.rb', line 7

def initialize(type, array_ref, array_list, location)
  super(location)
  @name = array_ref.name
  @array_list = array_list
  @dimension = array_ref.pos[0]
  @type = Rubex::TYPE_MAPPINGS[type].new
end

Instance Attribute Details

#array_listObject (readonly)

Returns the value of attribute array_list.



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

def array_list
  @array_list
end

#dimensionObject (readonly)

Returns the value of attribute dimension.



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

def dimension
  @dimension
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

Instance Method Details

#analyse_statement(local_scope, extern: false) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/rubex/ast/statement/c_array_decl.rb', line 15

def analyse_statement(local_scope, extern: false)
  @dimension.analyse_types local_scope
  create_symbol_table_entry local_scope
  return if @array_list.nil?
  analyse_array_list local_scope
  verify_array_list_types local_scope
end

#generate_code(code, local_scope) ⇒ Object



23
# File 'lib/rubex/ast/statement/c_array_decl.rb', line 23

def generate_code(code, local_scope); end

#rescan_declarations(local_scope) ⇒ Object



25
# File 'lib/rubex/ast/statement/c_array_decl.rb', line 25

def rescan_declarations(local_scope); end