class AdLint::Cc1::C99ForStatement
Attributes
body_statement[R]
condition_statement[R]
declaration[R]
expression[R]
header_terminator[R]
Public Class Methods
new(dcl, cond_stmt, expr, body_stmt, header_term)
click to toggle source
Calls superclass method
AdLint::Cc1::Statement::new
# File lib/adlint/cc1/syntax.rb, line 3884 def initialize(dcl, cond_stmt, expr, body_stmt, header_term) super() @declaration = dcl @condition_statement = cond_stmt @expression = expr @body_statement = body_stmt @header_terminator = header_term end
Public Instance Methods
deduct_controlling_expression()
click to toggle source
# File lib/adlint/cc1/syntax.rb, line 3903 def deduct_controlling_expression sels = collect_loop_breaking_selection_statements(@body_statement) if expr = @condition_statement.expression rough_cands = [[expr, expr.to_normalized_logical]] + sels.map { |stmt| [stmt.expression, stmt.expression.to_normalized_logical.to_complemental_logical] } else rough_cands = sels.map { |stmt| [stmt.expression, stmt.expression.to_normalized_logical.to_complemental_logical] } end # 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 3925 def inspect(indent = 0) " " * indent + "#{short_class_name}\n" + @declaration.inspect(indent + 1) + "\n" + @condition_statement.inspect(indent + 1) + (@expression ? "\n#{@expression.inspect(indent + 1)}" : "") + "\n" + @body_statement.inspect(indent + 1) end
location()
click to toggle source
# File lib/adlint/cc1/syntax.rb, line 3899 def location head_location end