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.



3510
3511
3512
3513
3514
3515
3516
3517
# File 'lib/adlint/cc1/syntax.rb', line 3510

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.



3523
3524
3525
# File 'lib/adlint/cc1/syntax.rb', line 3523

def else_header_terminator
  @else_header_terminator
end

#else_statementObject (readonly)

Returns the value of attribute else_statement.



3521
3522
3523
# File 'lib/adlint/cc1/syntax.rb', line 3521

def else_statement
  @else_statement
end

#expressionObject (readonly)

Returns the value of attribute expression.



3519
3520
3521
# File 'lib/adlint/cc1/syntax.rb', line 3519

def expression
  @expression
end

#then_header_terminatorObject (readonly)

Returns the value of attribute then_header_terminator.



3522
3523
3524
# File 'lib/adlint/cc1/syntax.rb', line 3522

def then_header_terminator
  @then_header_terminator
end

#then_statementObject (readonly)

Returns the value of attribute then_statement.



3520
3521
3522
# File 'lib/adlint/cc1/syntax.rb', line 3520

def then_statement
  @then_statement
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



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

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



3525
3526
3527
# File 'lib/adlint/cc1/syntax.rb', line 3525

def location
  head_location
end