Class: AdLint::Cc1::UnionTypeDeclaration

Inherits:
TypeDeclaration show all
Defined in:
lib/adlint/cc1/syntax.rb

Direct Known Subclasses

PseudoUnionTypeDeclaration

Instance Attribute Summary collapse

Attributes inherited from TypeDeclaration

#symbol

Attributes inherited from SyntaxNode

#head_token, #subsequent_sequence_point, #tail_token

Instance Method Summary collapse

Methods included from SymbolicElement

#mark_as_referred_by

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(union_spec, sym) ⇒ UnionTypeDeclaration

Returns a new instance of UnionTypeDeclaration.



2593
2594
2595
2596
2597
2598
# File 'lib/adlint/cc1/syntax.rb', line 2593

def initialize(union_spec, sym)
  super(sym)
  @union_specifier = union_spec
  @struct_declarations = union_spec.struct_declarations
  @type = nil
end

Instance Attribute Details

#struct_declarationsObject (readonly)

Returns the value of attribute struct_declarations.



2601
2602
2603
# File 'lib/adlint/cc1/syntax.rb', line 2601

def struct_declarations
  @struct_declarations
end

#typeObject

Returns the value of attribute type.



2602
2603
2604
# File 'lib/adlint/cc1/syntax.rb', line 2602

def type
  @type
end

#union_specifierObject (readonly)

Returns the value of attribute union_specifier.



2600
2601
2602
# File 'lib/adlint/cc1/syntax.rb', line 2600

def union_specifier
  @union_specifier
end

Instance Method Details

#identifierObject



2604
2605
2606
# File 'lib/adlint/cc1/syntax.rb', line 2604

def identifier
  @union_specifier.identifier
end

#inspect(indent = 0) ⇒ Object



2612
2613
2614
2615
2616
# File 'lib/adlint/cc1/syntax.rb', line 2612

def inspect(indent = 0)
  " " * indent + "#{short_class_name} (#{location.inspect}) " +
    "#{identifier.value}\n" +
    @struct_declarations.map { |sd| sd.inspect(indent + 1) }.join("\n")
end

#locationObject



2608
2609
2610
# File 'lib/adlint/cc1/syntax.rb', line 2608

def location
  identifier.location
end