Class: AdLint::Cpp::UnaryArithmeticExpression

Inherits:
UnaryExpression show all
Defined in:
lib/adlint/cpp/syntax.rb

Instance Attribute Summary collapse

Attributes inherited from UnaryExpression

#operator

Attributes inherited from Expression

#value

Instance Method Summary collapse

Methods inherited from UnaryExpression

#location

Methods inherited from SyntaxNode

#location, #short_class_name

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initialize(val, op, expr) ⇒ UnaryArithmeticExpression

Returns a new instance of UnaryArithmeticExpression.



801
802
803
804
# File 'lib/adlint/cpp/syntax.rb', line 801

def initialize(val, op, expr)
  super(val, op)
  @expression = expr
end

Instance Attribute Details

#expressionObject (readonly)

Returns the value of attribute expression.



806
807
808
# File 'lib/adlint/cpp/syntax.rb', line 806

def expression
  @expression
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



812
813
814
815
# File 'lib/adlint/cpp/syntax.rb', line 812

def inspect(indent = 0)
  " " * indent + "#{short_class_name} (#{operator.inspect})\n" +
    @expression.inspect(indent + 1)
end

#to_sObject



808
809
810
# File 'lib/adlint/cpp/syntax.rb', line 808

def to_s
  "#{operator.value} #{@expression.to_s}"
end