class AdLint::Cc1::MemberDeclaration

Attributes

specifier_qualifier_list[R]
struct_declarator[R]
type[RW]

Public Class Methods

new(spec_qual_list, struct_dcl) click to toggle source
Calls superclass method AdLint::Cc1::SyntaxNode::new
# File lib/adlint/cc1/syntax.rb, line 2883
def initialize(spec_qual_list, struct_dcl)
  super()
  @specifier_qualifier_list = spec_qual_list
  @struct_declarator = struct_dcl
  @type = nil
end

Public Instance Methods

identifier() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 2894
def identifier
  if @struct_declarator && @struct_declarator.declarator
    @struct_declarator.declarator.identifier
  else
    nil
  end
end
inspect(indent = 0) click to toggle source
# File lib/adlint/cc1/syntax.rb, line 2921
def inspect(indent = 0)
  " " * indent + "#{short_class_name} (#{location.inspect}) " +
    ((id = identifier) ? id.value : "")
end
location() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 2902
def location
  case
  when @struct_declarator && @struct_declarator.declarator
    @struct_declarator.declarator.identifier.location
  when @struct_declarator
    @struct_declarator.head_location
  else
    @specifier_qualifier_list.head_location
  end
end
to_s() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 2913
def to_s
  if id = identifier
    "#{type.brief_image} #{id.value}"
  else
    type.brief_image
  end
end