Class: AdLint::Cc1::Declaration

Inherits:
SyntaxNode show all
Includes:
DeclarationSpecifiersHolder
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 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_dcrs, sym_tbl) ⇒ Declaration

Returns a new instance of Declaration.



2303
2304
2305
2306
2307
2308
# File 'lib/adlint/cc1/syntax.rb', line 2303

def initialize(dcl_specs, init_dcrs, sym_tbl)
  super()
  @declaration_specifiers = dcl_specs
  @init_declarators = init_dcrs
  @items = build_items(dcl_specs, init_dcrs, sym_tbl)
end

Instance Attribute Details

#declaration_specifiersObject (readonly)

Returns the value of attribute declaration_specifiers.



2310
2311
2312
# File 'lib/adlint/cc1/syntax.rb', line 2310

def declaration_specifiers
  @declaration_specifiers
end

#init_declaratorsObject (readonly)

Returns the value of attribute init_declarators.



2311
2312
2313
# File 'lib/adlint/cc1/syntax.rb', line 2311

def init_declarators
  @init_declarators
end

#itemsObject (readonly)

Returns the value of attribute items.



2312
2313
2314
# File 'lib/adlint/cc1/syntax.rb', line 2312

def items
  @items
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



2318
2319
2320
2321
# File 'lib/adlint/cc1/syntax.rb', line 2318

def inspect(indent = 0)
  ([" " * indent + "#{short_class_name} (#{location.inspect})"] +
   @items.map { |item| item.inspect(indent + 1) }).join("\n")
end

#locationObject



2314
2315
2316
# File 'lib/adlint/cc1/syntax.rb', line 2314

def location
  head_location
end