Class: Rubex::AST::Statement::CBaseType

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

Instance Attribute Summary collapse

Attributes inherited from Base

#location

Instance Method Summary collapse

Methods inherited from Base

#generate_code, #statement?

Constructor Details

#initialize(type, name, value = nil) ⇒ CBaseType

Returns a new instance of CBaseType.



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

def initialize(type, name, value = nil)
  @type = type
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



13
14
15
16
17
18
# File 'lib/rubex/ast/statement/c_base_type.rb', line 13

def ==(other)
  self.class == other.class &&
    type == other.class  &&
    name == other.name   &&
    value == other.value
end

#analyse_statement(_local_scope) ⇒ Object



20
21
22
# File 'lib/rubex/ast/statement/c_base_type.rb', line 20

def analyse_statement(_local_scope)
  @type = Rubex::Helpers.determine_dtype @type
end