Class: AdLint::Cc1::DoStatement
- Inherits:
-
IterationStatement
- Object
- SyntaxNode
- Statement
- IterationStatement
- AdLint::Cc1::DoStatement
- Defined in:
- lib/adlint/cc1/syntax.rb
Instance Attribute Summary collapse
-
#expression ⇒ Object
readonly
Returns the value of attribute expression.
-
#footer_initiator ⇒ Object
readonly
Returns the value of attribute footer_initiator.
-
#header_terminator ⇒ Object
readonly
Returns the value of attribute header_terminator.
-
#statement ⇒ Object
readonly
Returns the value of attribute statement.
Attributes inherited from Statement
Attributes inherited from SyntaxNode
#head_token, #subsequent_sequence_point, #tail_token
Instance Method Summary collapse
- #deduct_controlling_expression ⇒ Object
-
#initialize(stmt, expr, header_term, footer_init) ⇒ DoStatement
constructor
A new instance of DoStatement.
- #inspect(indent = 0) ⇒ Object
- #location ⇒ Object
Methods inherited from IterationStatement
#varying_expressions, #varying_variable_names
Methods included from SyntaxNodeCollector
collect_additive_expressions, collect_array_declarators, collect_compound_assignment_expressions, collect_constant_specifiers, collect_equality_expressions, collect_function_declarators, collect_generic_labeled_statements, collect_goto_statements, collect_identifier_declarators, collect_if_else_statements, collect_if_statements, collect_logical_and_expressions, collect_logical_or_expressions, collect_object_specifiers, collect_postfix_decrement_expressions, collect_postfix_increment_expressions, collect_prefix_decrement_expressions, collect_prefix_increment_expressions, collect_relational_expressions, collect_simple_assignment_expressions, collect_typedef_type_specifiers
Methods inherited from Statement
Methods inherited from SyntaxNode
#head_location, #short_class_name, #tail_location
Methods included from LocationHolder
Methods included from Visitable
Constructor Details
#initialize(stmt, expr, header_term, footer_init) ⇒ DoStatement
Returns a new instance of DoStatement.
3793 3794 3795 3796 3797 3798 3799 |
# File 'lib/adlint/cc1/syntax.rb', line 3793 def initialize(stmt, expr, header_term, ) super() @statement = stmt @expression = expr @header_terminator = header_term @footer_initiator = end |
Instance Attribute Details
#expression ⇒ Object (readonly)
Returns the value of attribute expression.
3802 3803 3804 |
# File 'lib/adlint/cc1/syntax.rb', line 3802 def expression @expression end |
#footer_initiator ⇒ Object (readonly)
Returns the value of attribute footer_initiator.
3804 3805 3806 |
# File 'lib/adlint/cc1/syntax.rb', line 3804 def @footer_initiator end |
#header_terminator ⇒ Object (readonly)
Returns the value of attribute header_terminator.
3803 3804 3805 |
# File 'lib/adlint/cc1/syntax.rb', line 3803 def header_terminator @header_terminator end |
#statement ⇒ Object (readonly)
Returns the value of attribute statement.
3801 3802 3803 |
# File 'lib/adlint/cc1/syntax.rb', line 3801 def statement @statement end |
Instance Method Details
#deduct_controlling_expression ⇒ Object
3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 |
# File 'lib/adlint/cc1/syntax.rb', line 3810 def deduct_controlling_expression sels = collect_loop_breaking_selection_statements(@statement) expr = @expression rough_cands = [[expr, expr.to_normalized_logical]] + sels.map { |stmt| [stmt.expression, stmt.expression.to_normalized_logical.to_complemental_logical] } # FIXME: When many loop breaking selection-statements are found, how can # I select one selection-statement? # FIXME: When the loop breaking selection-statement is a # if-else-statement and the loop breaking is in the else branch, # the controlling expression should be inverted. deduct_controlling_expression_candidates(rough_cands).first end |
#inspect(indent = 0) ⇒ Object
3826 3827 3828 3829 |
# File 'lib/adlint/cc1/syntax.rb', line 3826 def inspect(indent = 0) " " * indent + "#{short_class_name}\n" + @statement.inspect(indent + 1) + "\n" + @expression.inspect(indent + 1) end |
#location ⇒ Object
3806 3807 3808 |
# File 'lib/adlint/cc1/syntax.rb', line 3806 def location head_location end |