Class: AdLint::Cc1::VariableDeclaration

Inherits:
SyntaxNode
  • Object
show all
Includes:
DeclarationSpecifiersHolder, SymbolicElement
Defined in:
lib/adlint/cc1/syntax.rb

Instance Attribute Summary collapse

Attributes inherited from SyntaxNode

#head_token, #subsequent_sequence_point, #tail_token

Instance Method Summary collapse

Methods included from DeclarationSpecifiersHolder

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

Methods included from SymbolicElement

#mark_as_referred_by

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, dcr, sym) ⇒ VariableDeclaration

Returns a new instance of VariableDeclaration.



2444
2445
2446
2447
2448
2449
2450
# File 'lib/adlint/cc1/syntax.rb', line 2444

def initialize(dcl_specs, dcr, sym)
  super()
  @declaration_specifiers = dcl_specs
  @declarator = dcr
  @symbol = sym
  @type = nil
end

Instance Attribute Details

#declaration_specifiersObject (readonly)

Returns the value of attribute declaration_specifiers.



2452
2453
2454
# File 'lib/adlint/cc1/syntax.rb', line 2452

def declaration_specifiers
  @declaration_specifiers
end

#declaratorObject (readonly)

Returns the value of attribute declarator.



2453
2454
2455
# File 'lib/adlint/cc1/syntax.rb', line 2453

def declarator
  @declarator
end

#symbolObject (readonly)

Returns the value of attribute symbol.



2454
2455
2456
# File 'lib/adlint/cc1/syntax.rb', line 2454

def symbol
  @symbol
end

#typeObject

Returns the value of attribute type.



2455
2456
2457
# File 'lib/adlint/cc1/syntax.rb', line 2455

def type
  @type
end

Instance Method Details

#identifierObject



2457
2458
2459
# File 'lib/adlint/cc1/syntax.rb', line 2457

def identifier
  @declarator.identifier
end

#inspect(indent = 0) ⇒ Object



2465
2466
2467
2468
# File 'lib/adlint/cc1/syntax.rb', line 2465

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

#locationObject



2461
2462
2463
# File 'lib/adlint/cc1/syntax.rb', line 2461

def location
  identifier.location
end