Class: AdLint::Cc1::MemberDeclaration

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_dcl) ⇒ MemberDeclaration

Returns a new instance of MemberDeclaration.



2879
2880
2881
2882
2883
2884
# File 'lib/adlint/cc1/syntax.rb', line 2879

def initialize(spec_qual_list, struct_dcl)
  super()
  @specifier_qualifier_list = spec_qual_list
  @struct_declarator = struct_dcl
  @type = nil
end

Instance Attribute Details

#specifier_qualifier_listObject (readonly)

Returns the value of attribute specifier_qualifier_list.



2886
2887
2888
# File 'lib/adlint/cc1/syntax.rb', line 2886

def specifier_qualifier_list
  @specifier_qualifier_list
end

#struct_declaratorObject (readonly)

Returns the value of attribute struct_declarator.



2887
2888
2889
# File 'lib/adlint/cc1/syntax.rb', line 2887

def struct_declarator
  @struct_declarator
end

#typeObject

Returns the value of attribute type.



2888
2889
2890
# File 'lib/adlint/cc1/syntax.rb', line 2888

def type
  @type
end

Instance Method Details

#identifierObject



2890
2891
2892
# File 'lib/adlint/cc1/syntax.rb', line 2890

def identifier
  @struct_declarator.declarator.identifier
end

#inspect(indent = 0) ⇒ Object



2902
2903
2904
2905
# File 'lib/adlint/cc1/syntax.rb', line 2902

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

#locationObject



2894
2895
2896
# File 'lib/adlint/cc1/syntax.rb', line 2894

def location
  identifier.location
end

#to_sObject



2898
2899
2900
# File 'lib/adlint/cc1/syntax.rb', line 2898

def to_s
  "#{type.brief_image} #{identifier.value}"
end