Class: AdLint::Cc1::VariableDefinition

Inherits:
Definition show all
Includes:
SymbolicElement
Defined in:
lib/adlint/cc1/syntax.rb

Direct Known Subclasses

PseudoVariableDefinition

Instance Attribute Summary collapse

Attributes inherited from Definition

#declaration_specifiers, #type

Attributes inherited from SyntaxNode

#head_token, #subsequent_sequence_point, #tail_token

Instance Method Summary collapse

Methods included from SymbolicElement

#mark_as_referred_by

Methods included from DeclarationSpecifiersHolder

#explicitly_typed?, #function_specifier, #implicitly_typed?, #storage_class_specifier, #type_qualifiers, #type_specifiers

Methods inherited from SyntaxNode

#head_location, #short_class_name, #tail_location

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initialize(dcl_specs, init_dcr, sym) ⇒ VariableDefinition

Returns a new instance of VariableDefinition.



2486
2487
2488
2489
2490
2491
# File 'lib/adlint/cc1/syntax.rb', line 2486

def initialize(dcl_specs, init_dcr, sym)
  super(dcl_specs)

  @init_declarator = init_dcr
  @symbol = sym
end

Instance Attribute Details

#init_declaratorObject (readonly)

Returns the value of attribute init_declarator.



2493
2494
2495
# File 'lib/adlint/cc1/syntax.rb', line 2493

def init_declarator
  @init_declarator
end

#symbolObject (readonly)

Returns the value of attribute symbol.



2494
2495
2496
# File 'lib/adlint/cc1/syntax.rb', line 2494

def symbol
  @symbol
end

Instance Method Details

#identifierObject



2496
2497
2498
# File 'lib/adlint/cc1/syntax.rb', line 2496

def identifier
  @init_declarator.declarator.identifier
end

#initializerObject



2500
2501
2502
# File 'lib/adlint/cc1/syntax.rb', line 2500

def initializer
  @init_declarator.initializer
end

#inspect(indent = 0) ⇒ Object



2508
2509
2510
2511
# File 'lib/adlint/cc1/syntax.rb', line 2508

def inspect(indent = 0)
  " " * indent + "#{short_class_name} (#{location.inspect}) " +
    identifier.value
end

#locationObject



2504
2505
2506
# File 'lib/adlint/cc1/syntax.rb', line 2504

def location
  identifier.location
end