Class: AdLint::Cc1::StructSpecifier
- Inherits:
-
TypeSpecifier
- Object
- SyntaxNode
- TypeSpecifier
- AdLint::Cc1::StructSpecifier
- 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) ⇒ StructSpecifier
constructor
A new instance of StructSpecifier.
- #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) ⇒ StructSpecifier
Returns a new instance of StructSpecifier.
2769 2770 2771 2772 2773 2774 |
# File 'lib/adlint/cc1/syntax.rb', line 2769 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.
2776 2777 2778 |
# File 'lib/adlint/cc1/syntax.rb', line 2776 def identifier @identifier end |
#struct_declarations ⇒ Object (readonly)
Returns the value of attribute struct_declarations.
2777 2778 2779 |
# File 'lib/adlint/cc1/syntax.rb', line 2777 def struct_declarations @struct_declarations end |
Instance Method Details
#anonymous? ⇒ Boolean
2783 2784 2785 |
# File 'lib/adlint/cc1/syntax.rb', line 2783 def anonymous? @anonymous end |
#inspect(indent = 0) ⇒ Object
2800 2801 2802 |
# File 'lib/adlint/cc1/syntax.rb', line 2800 def inspect(indent = 0) " " * indent + short_class_name end |
#location ⇒ Object
2779 2780 2781 |
# File 'lib/adlint/cc1/syntax.rb', line 2779 def location @identifier.location end |
#to_s ⇒ Object
2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 |
# File 'lib/adlint/cc1/syntax.rb', line 2787 def to_s if @struct_declarations if @struct_declarations.empty? "struct #{identifier.value} {}" else "struct #{identifier.value} { " + @struct_declarations.map { |dcl| dcl.to_s }.join(" ") + " }" end else "struct #{identifier.value}" end end |