Class: AdLint::Cc1::BitAccessByPointerExpression

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

Instance Attribute Summary collapse

Attributes inherited from PostfixExpression

#operator

Attributes inherited from SyntaxNode

#head_token, #subsequent_sequence_point, #tail_token

Instance Method Summary collapse

Methods inherited from PostfixExpression

#location

Methods inherited from Expression

#constant?, #full=, #object_specifiers

Methods inherited from SyntaxNode

#head_location, #location, #short_class_name, #tail_location

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initialize(expr, const, arrow) ⇒ BitAccessByPointerExpression

Returns a new instance of BitAccessByPointerExpression.



1113
1114
1115
1116
1117
# File 'lib/adlint/cc1/syntax.rb', line 1113

def initialize(expr, const, arrow)
  super(arrow)
  @expression = expr
  @constant = const
end

Instance Attribute Details

#constantObject (readonly)

Returns the value of attribute constant.



1120
1121
1122
# File 'lib/adlint/cc1/syntax.rb', line 1120

def constant
  @constant
end

#expressionObject (readonly)

Returns the value of attribute expression.



1119
1120
1121
# File 'lib/adlint/cc1/syntax.rb', line 1119

def expression
  @expression
end

Instance Method Details

#arithmetic?Boolean

Returns:

  • (Boolean)


1130
1131
1132
# File 'lib/adlint/cc1/syntax.rb', line 1130

def arithmetic?
  false
end

#bitwise?Boolean

Returns:

  • (Boolean)


1134
1135
1136
# File 'lib/adlint/cc1/syntax.rb', line 1134

def bitwise?
  false
end

#have_side_effect?Boolean

Returns:

  • (Boolean)


1122
1123
1124
# File 'lib/adlint/cc1/syntax.rb', line 1122

def have_side_effect?
  @expression.have_side_effect?
end

#inspect(indent = 0) ⇒ Object



1155
1156
1157
1158
# File 'lib/adlint/cc1/syntax.rb', line 1155

def inspect(indent = 0)
  " " * indent + "#{short_class_name} (#{location.inspect}) " +
    "#{@expression.inspect}->#{@constant.value}"
end

#logical?Boolean

Returns:

  • (Boolean)


1126
1127
1128
# File 'lib/adlint/cc1/syntax.rb', line 1126

def logical?
  false
end

#to_complemental_logicalObject



1147
1148
1149
# File 'lib/adlint/cc1/syntax.rb', line 1147

def to_complemental_logical
  self
end

#to_normalized_logical(parent_expr = nil) ⇒ Object



1138
1139
1140
1141
1142
1143
1144
1145
# File 'lib/adlint/cc1/syntax.rb', line 1138

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



1151
1152
1153
# File 'lib/adlint/cc1/syntax.rb', line 1151

def to_s
  "#{@expression.to_s}->#{@constant.value}"
end