Class: AdLint::Cc1::UnionSpecifier
- Inherits:
-
TypeSpecifier
- Object
- SyntaxNode
- TypeSpecifier
- AdLint::Cc1::UnionSpecifier
- Defined in:
- lib/adlint/cc1/syntax.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#struct_declarations ⇒ Object
readonly
Returns the value of attribute struct_declarations.
Attributes inherited from SyntaxNode
#head_token, #subsequent_sequence_point, #tail_token
Instance Method Summary collapse
- #anonymous? ⇒ Boolean
-
#initialize(id, struct_dcls, anonymous = false) ⇒ UnionSpecifier
constructor
A new instance of UnionSpecifier.
- #inspect(indent = 0) ⇒ Object
- #location ⇒ Object
- #to_s ⇒ Object
Methods inherited from SyntaxNode
#head_location, #short_class_name, #tail_location
Methods included from LocationHolder
Methods included from Visitable
Constructor Details
#initialize(id, struct_dcls, anonymous = false) ⇒ UnionSpecifier
Returns a new instance of UnionSpecifier.
2806 2807 2808 2809 2810 2811 |
# 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 |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
2813 2814 2815 |
# File 'lib/adlint/cc1/syntax.rb', line 2813 def identifier @identifier end |
#struct_declarations ⇒ Object (readonly)
Returns the value of attribute struct_declarations.
2814 2815 2816 |
# File 'lib/adlint/cc1/syntax.rb', line 2814 def struct_declarations @struct_declarations end |
Instance Method Details
#anonymous? ⇒ Boolean
2820 2821 2822 |
# File 'lib/adlint/cc1/syntax.rb', line 2820 def anonymous? @anonymous end |
#inspect(indent = 0) ⇒ Object
2838 2839 2840 |
# File 'lib/adlint/cc1/syntax.rb', line 2838 def inspect(indent = 0) " " * indent + short_class_name end |
#location ⇒ Object
2816 2817 2818 |
# File 'lib/adlint/cc1/syntax.rb', line 2816 def location @identifier.location end |
#to_s ⇒ Object
2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 |
# 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 |