Class: AdLint::Cc1::IfElseStatement

Inherits:
SelectionStatement show all
Defined in:
lib/adlint/cc1/syntax.rb

Instance Attribute Summary collapse

Attributes inherited from Statement

#executed

Attributes inherited from SyntaxNode

#head_token, #subsequent_sequence_point, #tail_token

Instance Method Summary collapse

Methods inherited from Statement

#executed?

Methods inherited from SyntaxNode

#head_location, #short_class_name, #tail_location

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initialize(expr, then_stmt, else_stmt, then_term, else_term) ⇒ IfElseStatement

Returns a new instance of IfElseStatement.



3529
3530
3531
3532
3533
3534
3535
3536
# File 'lib/adlint/cc1/syntax.rb', line 3529

def initialize(expr, then_stmt, else_stmt, then_term, else_term)
  super()
  @expression = expr
  @then_statement = then_stmt
  @else_statement = else_stmt
  @then_header_terminator = then_term
  @else_header_terminator = else_term
end

Instance Attribute Details

#else_header_terminatorObject (readonly)

Returns the value of attribute else_header_terminator.



3542
3543
3544
# File 'lib/adlint/cc1/syntax.rb', line 3542

def else_header_terminator
  @else_header_terminator
end

#else_statementObject (readonly)

Returns the value of attribute else_statement.



3540
3541
3542
# File 'lib/adlint/cc1/syntax.rb', line 3540

def else_statement
  @else_statement
end

#expressionObject (readonly)

Returns the value of attribute expression.



3538
3539
3540
# File 'lib/adlint/cc1/syntax.rb', line 3538

def expression
  @expression
end

#then_header_terminatorObject (readonly)

Returns the value of attribute then_header_terminator.



3541
3542
3543
# File 'lib/adlint/cc1/syntax.rb', line 3541

def then_header_terminator
  @then_header_terminator
end

#then_statementObject (readonly)

Returns the value of attribute then_statement.



3539
3540
3541
# File 'lib/adlint/cc1/syntax.rb', line 3539

def then_statement
  @then_statement
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



3548
3549
3550
3551
3552
3553
# File 'lib/adlint/cc1/syntax.rb', line 3548

def inspect(indent = 0)
  " " * indent + "#{short_class_name}\n" +
    @expression.inspect(indent + 1) + "\n" +
    @then_statement.inspect(indent + 1) + "\n" +
    @else_statement.inspect(indent + 1)
end

#locationObject



3544
3545
3546
# File 'lib/adlint/cc1/syntax.rb', line 3544

def location
  head_location
end