class AdLint::Cpp::ConditionalExpression

Attributes

condition[R]
first_expression[R]
second_expression[R]

Public Class Methods

new(val, cond, fst_expr, snd_expr) click to toggle source
Calls superclass method AdLint::Cpp::Expression::new
# File lib/adlint/cpp/syntax.rb, line 884
def initialize(val, cond, fst_expr, snd_expr)
  super(val)
  @condition = cond
  @first_expression  = fst_expr
  @second_expression = snd_expr
end

Public Instance Methods

inspect(indent = 0) click to toggle source
# File lib/adlint/cpp/syntax.rb, line 904
def inspect(indent = 0)
  " " * indent + "#{short_class_name} (#{@condition.inspect})\n" +
    @first_expression.inspect(indent + 1) + "\n" +
      @second_expression.inspect(indent + 1)
end
location() click to toggle source
# File lib/adlint/cpp/syntax.rb, line 895
def location
  @condition.location
end
to_s() click to toggle source
# File lib/adlint/cpp/syntax.rb, line 899
def to_s
  "#{@condition.to_s}? " +
    "#{@first_expression.to_s} : #{@second_expression.to_s}"
end