Class: AdLint::Cpp::BinaryExpression
- Inherits:
-
Expression
- Object
- SyntaxNode
- Expression
- AdLint::Cpp::BinaryExpression
- Defined in:
- lib/adlint/cpp/syntax.rb
Direct Known Subclasses
AdditiveExpression, AndExpression, EqualityExpression, ExclusiveOrExpression, InclusiveOrExpression, LogicalAndExpression, LogicalOrExpression, MultiplicativeExpression, RelationalExpression, ShiftExpression
Instance Attribute Summary collapse
-
#lhs_expression ⇒ Object
readonly
Returns the value of attribute lhs_expression.
-
#operator ⇒ Object
readonly
Returns the value of attribute operator.
-
#rhs_expression ⇒ Object
readonly
Returns the value of attribute rhs_expression.
Attributes inherited from Expression
Instance Method Summary collapse
-
#initialize(val, op, lhs_expr, rhs_expr) ⇒ BinaryExpression
constructor
A new instance of BinaryExpression.
- #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, op, lhs_expr, rhs_expr) ⇒ BinaryExpression
Returns a new instance of BinaryExpression.
837 838 839 840 841 842 |
# File 'lib/adlint/cpp/syntax.rb', line 837 def initialize(val, op, lhs_expr, rhs_expr) super(val) @operator = op @lhs_expression = lhs_expr @rhs_expression = rhs_expr end |
Instance Attribute Details
#lhs_expression ⇒ Object (readonly)
Returns the value of attribute lhs_expression.
845 846 847 |
# File 'lib/adlint/cpp/syntax.rb', line 845 def lhs_expression @lhs_expression end |
#operator ⇒ Object (readonly)
Returns the value of attribute operator.
844 845 846 |
# File 'lib/adlint/cpp/syntax.rb', line 844 def operator @operator end |
#rhs_expression ⇒ Object (readonly)
Returns the value of attribute rhs_expression.
846 847 848 |
# File 'lib/adlint/cpp/syntax.rb', line 846 def rhs_expression @rhs_expression end |
Instance Method Details
#inspect(indent = 0) ⇒ Object
856 857 858 859 860 |
# File 'lib/adlint/cpp/syntax.rb', line 856 def inspect(indent = 0) " " * indent + "#{short_class_name} (#{@operator.inspect})\n" + @lhs_expression.inspect(indent + 1) + "\n" + @rhs_expression.inspect(indent + 1) end |
#location ⇒ Object
848 849 850 |
# File 'lib/adlint/cpp/syntax.rb', line 848 def location @lhs_expression.location end |
#to_s ⇒ Object
852 853 854 |
# File 'lib/adlint/cpp/syntax.rb', line 852 def to_s "#{@lhs_expression.to_s} #{@operator.value} #{@rhs_expression.to_s}" end |