class AdLint::Cc1::WhileStatement

Attributes

expression[R]
header_terminator[R]
statement[R]

Public Class Methods

new(expr, stmt, header_term) click to toggle source
Calls superclass method AdLint::Cc1::Statement::new
# File lib/adlint/cc1/syntax.rb, line 3755
def initialize(expr, stmt, header_term)
  super()
  @expression = expr
  @statement = stmt
  @header_terminator = header_term
end

Public Instance Methods

deduct_controlling_expression() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 3770
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) click to toggle source
# File lib/adlint/cc1/syntax.rb, line 3786
def inspect(indent = 0)
  " " * indent + "#{short_class_name}\n" +
    @expression.inspect(indent + 1) + "\n" + @statement.inspect(indent + 1)
end
location() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 3766
def location
  head_location
end