Class: AdLint::Cc1::BitAccessByValueExpression

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, dot) ⇒ BitAccessByValueExpression

Returns a new instance of BitAccessByValueExpression.



1064
1065
1066
1067
1068
# File 'lib/adlint/cc1/syntax.rb', line 1064

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

Instance Attribute Details

#constantObject (readonly)

Returns the value of attribute constant.



1071
1072
1073
# File 'lib/adlint/cc1/syntax.rb', line 1071

def constant
  @constant
end

#expressionObject (readonly)

Returns the value of attribute expression.



1070
1071
1072
# File 'lib/adlint/cc1/syntax.rb', line 1070

def expression
  @expression
end

Instance Method Details

#arithmetic?Boolean

Returns:

  • (Boolean)


1081
1082
1083
# File 'lib/adlint/cc1/syntax.rb', line 1081

def arithmetic?
  false
end

#bitwise?Boolean

Returns:

  • (Boolean)


1085
1086
1087
# File 'lib/adlint/cc1/syntax.rb', line 1085

def bitwise?
  false
end

#have_side_effect?Boolean

Returns:

  • (Boolean)


1073
1074
1075
# File 'lib/adlint/cc1/syntax.rb', line 1073

def have_side_effect?
  @expression.have_side_effect?
end

#inspect(indent = 0) ⇒ Object



1106
1107
1108
1109
# File 'lib/adlint/cc1/syntax.rb', line 1106

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

#logical?Boolean

Returns:

  • (Boolean)


1077
1078
1079
# File 'lib/adlint/cc1/syntax.rb', line 1077

def logical?
  false
end

#to_complemental_logicalObject



1098
1099
1100
# File 'lib/adlint/cc1/syntax.rb', line 1098

def to_complemental_logical
  self
end

#to_normalized_logical(parent_expr = nil) ⇒ Object



1089
1090
1091
1092
1093
1094
1095
1096
# File 'lib/adlint/cc1/syntax.rb', line 1089

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



1102
1103
1104
# File 'lib/adlint/cc1/syntax.rb', line 1102

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