class Bpl::AST::IfStatement

Public Instance Methods

declarations() click to toggle source
# File lib/bpl/ast/statement.rb, line 76
def declarations
  @blocks +
  case @else
  when IfStatement then @else.declarations
  when Enumerable then @else
  else []
  end
end
show() { |b| ... } click to toggle source
# File lib/bpl/ast/statement.rb, line 86
def show
  body = Printing.braces(@blocks.map{|b| yield b} * "\n")
  rest = case @else
  when IfStatement
    " else " + yield(@else)
  when Enumerable
    " else " + Printing.braces(@else.map{|b| yield b} * "\n")
  else
    ""
  end
  "#{yield :if} (#{yield @condition}) #{body}#{rest}"
end