Class: AdLint::Cc1::UnaryExpression

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, ope) ⇒ UnaryExpression

Returns a new instance of UnaryExpression.



1306
1307
1308
1309
1310
# File 'lib/adlint/cc1/syntax.rb', line 1306

def initialize(op, ope)
  super()
  @operator = op
  @operand = ope
end

Instance Attribute Details

#operandObject (readonly)

Returns the value of attribute operand.



1313
1314
1315
# File 'lib/adlint/cc1/syntax.rb', line 1313

def operand
  @operand
end

#operatorObject (readonly)

Returns the value of attribute operator.



1312
1313
1314
# File 'lib/adlint/cc1/syntax.rb', line 1312

def operator
  @operator
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



1323
1324
1325
1326
# File 'lib/adlint/cc1/syntax.rb', line 1323

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

#locationObject



1315
1316
1317
# File 'lib/adlint/cc1/syntax.rb', line 1315

def location
  @operator.location
end

#to_sObject



1319
1320
1321
# File 'lib/adlint/cc1/syntax.rb', line 1319

def to_s
  @operator.value + @operand.to_s
end