Class: AdLint::Cc1::BinaryExpression

Inherits:
Expression show all
Defined in:
lib/adlint/cc1/syntax.rb

Instance Attribute Summary collapse

Attributes inherited from SyntaxNode

#head_token, #subsequent_sequence_point, #tail_token

Instance Method Summary collapse

Methods inherited from Expression

#arithmetic?, #bitwise?, #constant?, #full=, #have_side_effect?, #logical?, #object_specifiers, #to_complemental_logical, #to_normalized_logical

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(op, lhs_operand, rhs_operand) ⇒ BinaryExpression

Returns a new instance of BinaryExpression.



1689
1690
1691
1692
1693
1694
# File 'lib/adlint/cc1/syntax.rb', line 1689

def initialize(op, lhs_operand, rhs_operand)
  super()
  @operator = op
  @lhs_operand = lhs_operand
  @rhs_operand = rhs_operand
end

Instance Attribute Details

#lhs_operandObject (readonly)

Returns the value of attribute lhs_operand.



1697
1698
1699
# File 'lib/adlint/cc1/syntax.rb', line 1697

def lhs_operand
  @lhs_operand
end

#operatorObject (readonly)

Returns the value of attribute operator.



1696
1697
1698
# File 'lib/adlint/cc1/syntax.rb', line 1696

def operator
  @operator
end

#rhs_operandObject (readonly)

Returns the value of attribute rhs_operand.



1698
1699
1700
# File 'lib/adlint/cc1/syntax.rb', line 1698

def rhs_operand
  @rhs_operand
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



1708
1709
1710
1711
# File 'lib/adlint/cc1/syntax.rb', line 1708

def inspect(indent = 0)
  " " * indent + "#{short_class_name} (#{location.inspect}) " +
    "#{@operator.value} #{lhs_operand.inspect} #{rhs_operand.inspect}"
end

#locationObject



1700
1701
1702
# File 'lib/adlint/cc1/syntax.rb', line 1700

def location
  @operator.location
end

#to_sObject



1704
1705
1706
# File 'lib/adlint/cc1/syntax.rb', line 1704

def to_s
  "#{@lhs_operand.to_s} #{@operator.value} #{@rhs_operand.to_s}"
end