Class: AdLint::Cc1::GroupedExpression

Inherits:
PrimaryExpression 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(expr) ⇒ GroupedExpression

Returns a new instance of GroupedExpression.



800
801
802
803
804
805
# File 'lib/adlint/cc1/syntax.rb', line 800

def initialize(expr)
  super()
  @expression = expr
  self.head_token = expr.head_token
  self.tail_token = expr.tail_token
end

Instance Attribute Details

#expressionObject (readonly)

Returns the value of attribute expression.



807
808
809
# File 'lib/adlint/cc1/syntax.rb', line 807

def expression
  @expression
end

Instance Method Details

#arithmetic?Boolean

Returns:

  • (Boolean)


821
822
823
# File 'lib/adlint/cc1/syntax.rb', line 821

def arithmetic?
  @expression.arithmetic?
end

#bitwise?Boolean

Returns:

  • (Boolean)


825
826
827
# File 'lib/adlint/cc1/syntax.rb', line 825

def bitwise?
  @expression.bitwise?
end

#have_side_effect?Boolean

Returns:

  • (Boolean)


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

def have_side_effect?
  @expression.have_side_effect?
end

#inspect(indent = 0) ⇒ Object



846
847
848
849
# File 'lib/adlint/cc1/syntax.rb', line 846

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

#locationObject



809
810
811
# File 'lib/adlint/cc1/syntax.rb', line 809

def location
  head_location
end

#logical?Boolean

Returns:

  • (Boolean)


817
818
819
# File 'lib/adlint/cc1/syntax.rb', line 817

def logical?
  @expression.logical?
end

#to_complemental_logicalObject



838
839
840
# File 'lib/adlint/cc1/syntax.rb', line 838

def to_complemental_logical
  GroupedExpression.new(@expression.to_complemental_logical)
end

#to_normalized_logical(parent_expr = nil) ⇒ Object



829
830
831
832
833
834
835
836
# File 'lib/adlint/cc1/syntax.rb', line 829

def to_normalized_logical(parent_expr = nil)
  case parent_expr
  when nil, LogicalAndExpression, LogicalOrExpression
    GroupedExpression.new(@expression.to_normalized_logical(parent_expr))
  else
    self
  end
end

#to_sObject



842
843
844
# File 'lib/adlint/cc1/syntax.rb', line 842

def to_s
  "(#{expression.to_s})"
end