class AdLint::Cc1::UnionSpecifier

Attributes

identifier[R]
struct_declarations[R]

Public Class Methods

new(id, struct_dcls, anonymous = false) click to toggle source
Calls superclass method AdLint::Cc1::SyntaxNode::new
# File lib/adlint/cc1/syntax.rb, line 2806
def initialize(id, struct_dcls, anonymous = false)
  super()
  @identifier = id
  @struct_declarations = struct_dcls
  @anonymous = anonymous
end

Public Instance Methods

anonymous?() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 2820
def anonymous?
  @anonymous
end
inspect(indent = 0) click to toggle source
# File lib/adlint/cc1/syntax.rb, line 2838
def inspect(indent = 0)
  " " * indent + short_class_name
end
location() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 2816
def location
  @identifier.location
end
to_s() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 2824
def to_s
  if @struct_declarations
    if @struct_declarations.empty?
      "union #{identifier.value} {}"
    else
      "union #{identifier.value} { " +
        @struct_declarations.map { |dcl| dcl.to_s }.join(" ") +
        " }"
    end
  else
    "union #{identifier.value}"
  end
end