Class: AdLint::Cc1::StructDeclaration

Inherits:
SyntaxNode
  • Object
show all
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 inherited from SyntaxNode

#head_location, #short_class_name, #tail_location

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initialize(spec_qual_list, struct_dcrs) ⇒ StructDeclaration

Returns a new instance of StructDeclaration.



2844
2845
2846
2847
2848
2849
# File 'lib/adlint/cc1/syntax.rb', line 2844

def initialize(spec_qual_list, struct_dcrs)
  super()
  @specifier_qualifier_list = spec_qual_list
  @struct_declarators = struct_dcrs
  @items = build_items(spec_qual_list, struct_dcrs)
end

Instance Attribute Details

#itemsObject (readonly)

Returns the value of attribute items.



2853
2854
2855
# File 'lib/adlint/cc1/syntax.rb', line 2853

def items
  @items
end

#specifier_qualifier_listObject (readonly)

Returns the value of attribute specifier_qualifier_list.



2851
2852
2853
# File 'lib/adlint/cc1/syntax.rb', line 2851

def specifier_qualifier_list
  @specifier_qualifier_list
end

#struct_declaratorsObject (readonly)

Returns the value of attribute struct_declarators.



2852
2853
2854
# File 'lib/adlint/cc1/syntax.rb', line 2852

def struct_declarators
  @struct_declarators
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



2863
2864
2865
2866
# File 'lib/adlint/cc1/syntax.rb', line 2863

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

#locationObject



2855
2856
2857
# File 'lib/adlint/cc1/syntax.rb', line 2855

def location
  @specifier_qualifier_list.location
end

#to_sObject



2859
2860
2861
# File 'lib/adlint/cc1/syntax.rb', line 2859

def to_s
  @items.map { |item| item.to_s + ";" }.join(" ")
end