Class: AdLint::Cc1::CompoundLiteralExpression

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(type_name, inits, left_paren) ⇒ CompoundLiteralExpression

Returns a new instance of CompoundLiteralExpression.



1256
1257
1258
1259
1260
# File 'lib/adlint/cc1/syntax.rb', line 1256

def initialize(type_name, inits, left_paren)
  super(left_paren)
  @type_name = type_name
  @initializers = inits
end

Instance Attribute Details

#initializersObject (readonly)

Returns the value of attribute initializers.



1263
1264
1265
# File 'lib/adlint/cc1/syntax.rb', line 1263

def initializers
  @initializers
end

#type_nameObject (readonly)

Returns the value of attribute type_name.



1262
1263
1264
# File 'lib/adlint/cc1/syntax.rb', line 1262

def type_name
  @type_name
end

Instance Method Details

#arithmetic?Boolean

Returns:

  • (Boolean)


1273
1274
1275
# File 'lib/adlint/cc1/syntax.rb', line 1273

def arithmetic?
  false
end

#bitwise?Boolean

Returns:

  • (Boolean)


1277
1278
1279
# File 'lib/adlint/cc1/syntax.rb', line 1277

def bitwise?
  false
end

#have_side_effect?Boolean

Returns:

  • (Boolean)


1265
1266
1267
# File 'lib/adlint/cc1/syntax.rb', line 1265

def have_side_effect?
  false
end

#inspect(indent = 0) ⇒ Object



1299
1300
1301
1302
# File 'lib/adlint/cc1/syntax.rb', line 1299

def inspect(indent = 0)
  " " * indent + "#{short_class_name} (#{location.inspect}) " +
    @initializers.map { |init| init.inspect }.join(",")
end

#logical?Boolean

Returns:

  • (Boolean)


1269
1270
1271
# File 'lib/adlint/cc1/syntax.rb', line 1269

def logical?
  false
end

#to_complemental_logicalObject



1290
1291
1292
# File 'lib/adlint/cc1/syntax.rb', line 1290

def to_complemental_logical
  self
end

#to_normalized_logical(parent_expr = nil) ⇒ Object



1281
1282
1283
1284
1285
1286
1287
1288
# File 'lib/adlint/cc1/syntax.rb', line 1281

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



1294
1295
1296
1297
# File 'lib/adlint/cc1/syntax.rb', line 1294

def to_s
  "(#{@type_name.to_s}){" +
    @initializers.map { |ini| ini.to_s }.join(",") + "}"
end