Class: AdLint::Cpp::ConditionalExpression
- Inherits:
-
Expression
- Object
- SyntaxNode
- Expression
- AdLint::Cpp::ConditionalExpression
- Defined in:
- lib/adlint/cpp/syntax.rb
Instance Attribute Summary collapse
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#first_expression ⇒ Object
readonly
Returns the value of attribute first_expression.
-
#second_expression ⇒ Object
readonly
Returns the value of attribute second_expression.
Attributes inherited from Expression
Instance Method Summary collapse
-
#initialize(val, cond, fst_expr, snd_expr) ⇒ ConditionalExpression
constructor
A new instance of ConditionalExpression.
- #inspect(indent = 0) ⇒ Object
- #location ⇒ Object
- #to_s ⇒ Object
Methods inherited from SyntaxNode
Methods included from LocationHolder
Methods included from Visitable
Constructor Details
#initialize(val, cond, fst_expr, snd_expr) ⇒ ConditionalExpression
Returns a new instance of ConditionalExpression.
884 885 886 887 888 889 |
# 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 |
Instance Attribute Details
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
891 892 893 |
# File 'lib/adlint/cpp/syntax.rb', line 891 def condition @condition end |
#first_expression ⇒ Object (readonly)
Returns the value of attribute first_expression.
892 893 894 |
# File 'lib/adlint/cpp/syntax.rb', line 892 def first_expression @first_expression end |
#second_expression ⇒ Object (readonly)
Returns the value of attribute second_expression.
893 894 895 |
# File 'lib/adlint/cpp/syntax.rb', line 893 def second_expression @second_expression end |
Instance Method Details
#inspect(indent = 0) ⇒ Object
904 905 906 907 908 |
# 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 ⇒ Object
895 896 897 |
# File 'lib/adlint/cpp/syntax.rb', line 895 def location @condition.location end |
#to_s ⇒ Object
899 900 901 902 |
# File 'lib/adlint/cpp/syntax.rb', line 899 def to_s "#{@condition.to_s}? " + "#{@first_expression.to_s} : #{@second_expression.to_s}" end |