Class: AdLint::Cpp::IfSection

Inherits:
GroupPart show all
Defined in:
lib/adlint/cpp/syntax.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from SyntaxNode

#short_class_name

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initialize(if_group, elif_groups, else_group, endif_line) ⇒ IfSection

Returns a new instance of IfSection.



128
129
130
131
132
133
# File 'lib/adlint/cpp/syntax.rb', line 128

def initialize(if_group, elif_groups, else_group, endif_line)
  @if_group    = if_group
  @elif_groups = elif_groups
  @else_group  = else_group
  @endif_line  = endif_line
end

Instance Attribute Details

#elif_groupsObject (readonly)

Returns the value of attribute elif_groups.



136
137
138
# File 'lib/adlint/cpp/syntax.rb', line 136

def elif_groups
  @elif_groups
end

#else_groupObject (readonly)

Returns the value of attribute else_group.



137
138
139
# File 'lib/adlint/cpp/syntax.rb', line 137

def else_group
  @else_group
end

#endif_lineObject (readonly)

Returns the value of attribute endif_line.



138
139
140
# File 'lib/adlint/cpp/syntax.rb', line 138

def endif_line
  @endif_line
end

#if_groupObject (readonly)

Returns the value of attribute if_group.



135
136
137
# File 'lib/adlint/cpp/syntax.rb', line 135

def if_group
  @if_group
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



144
145
146
147
148
149
150
151
# File 'lib/adlint/cpp/syntax.rb', line 144

def inspect(indent = 0)
  [" " * indent + short_class_name,
    @if_group ? @if_group.inspect(indent + 1) : nil,
    @elif_groups ? @elif_groups.inspect(indent + 1) : nil,
    @else_group ? @else_group.inspect(indent + 1) : nil,
    @endif_line ? @endif_line.inspect(indent + 1) : nil
  ].compact.join("\n")
end

#locationObject



140
141
142
# File 'lib/adlint/cpp/syntax.rb', line 140

def location
  @if_group.location
end