Class: AdLint::Cc1::CastExpression

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

#constant?, #full=, #object_specifiers

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(type_name, ope) ⇒ CastExpression

Returns a new instance of CastExpression.



1636
1637
1638
1639
1640
# File 'lib/adlint/cc1/syntax.rb', line 1636

def initialize(type_name, ope)
  super()
  @type_name = type_name
  @operand = ope
end

Instance Attribute Details

#operandObject (readonly)

Returns the value of attribute operand.



1643
1644
1645
# File 'lib/adlint/cc1/syntax.rb', line 1643

def operand
  @operand
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



1642
1643
1644
# File 'lib/adlint/cc1/syntax.rb', line 1642

def type_name
  @type_name
end

Instance Method Details

#arithmetic?Boolean

Returns:

  • (Boolean)


1657
1658
1659
# File 'lib/adlint/cc1/syntax.rb', line 1657

def arithmetic?
  @operand.arithmetic?
end

#bitwise?Boolean

Returns:

  • (Boolean)


1661
1662
1663
# File 'lib/adlint/cc1/syntax.rb', line 1661

def bitwise?
  @operand.bitwise?
end

#have_side_effect?Boolean

Returns:

  • (Boolean)


1649
1650
1651
# File 'lib/adlint/cc1/syntax.rb', line 1649

def have_side_effect?
  @operand.have_side_effect?
end

#inspect(indent = 0) ⇒ Object



1682
1683
1684
1685
# File 'lib/adlint/cc1/syntax.rb', line 1682

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

#locationObject



1645
1646
1647
# File 'lib/adlint/cc1/syntax.rb', line 1645

def location
  head_location
end

#logical?Boolean

Returns:

  • (Boolean)


1653
1654
1655
# File 'lib/adlint/cc1/syntax.rb', line 1653

def logical?
  @operand.logical?
end

#to_complemental_logicalObject



1674
1675
1676
# File 'lib/adlint/cc1/syntax.rb', line 1674

def to_complemental_logical
  self
end

#to_normalized_logical(parent_expr = nil) ⇒ Object



1665
1666
1667
1668
1669
1670
1671
1672
# File 'lib/adlint/cc1/syntax.rb', line 1665

def to_normalized_logical(parent_expr = nil)
  case parent_expr
  when nil, LogicalAndExpression, LogicalOrExpression
    create_normalized_logical_of(self)
  else
    self
  end
end

#to_sObject



1678
1679
1680
# File 'lib/adlint/cc1/syntax.rb', line 1678

def to_s
  "(#{@type_name.to_s}) #{@operand.to_s}"
end