Class: AdLint::Cc1::Expression

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

Instance Attribute Summary

Attributes inherited from SyntaxNode

#head_token, #subsequent_sequence_point, #tail_token

Instance Method Summary collapse

Methods inherited from SyntaxNode

#head_location, #inspect, #location, #short_class_name, #tail_location

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initializeExpression

Returns a new instance of Expression.



456
457
458
459
# File 'lib/adlint/cc1/syntax.rb', line 456

def initialize
  super
  @full = false
end

Instance Method Details

#arithmetic?Boolean

Returns:

  • (Boolean)


494
495
496
# File 'lib/adlint/cc1/syntax.rb', line 494

def arithmetic?
  subclass_responsibility
end

#bitwise?Boolean

Returns:

  • (Boolean)


498
499
500
# File 'lib/adlint/cc1/syntax.rb', line 498

def bitwise?
  subclass_responsibility
end

#constant?(interp_bridge) ⇒ Boolean

Returns:

  • (Boolean)


486
487
488
# File 'lib/adlint/cc1/syntax.rb', line 486

def constant?(interp_bridge)
  ExpressionConstancy.new(interp_bridge).check(self)
end

#full=(expr_is_full) ⇒ Object



461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/adlint/cc1/syntax.rb', line 461

def full=(expr_is_full)
  @full = expr_is_full

  # NOTE: The ISO C99 standard says;
  #
  # Annex C (informative) Sequence points
  #
  # 1 The following are the sequence points described in 5.1.2.3:
  #
  #   -- The end of a full expression: an initializer (6.7.8); the
  #      expression in an expression statement (6.8.3); the controlling
  #      expression of a while or do statement (6.8.5); each of the
  #      expressions of a for statement (6.8.5.3); the expression in a
  #      return statement (6.8.6.4).
  if expr_is_full
    append_sequence_point!
  else
    delete_sequence_point!
  end
end

#have_side_effect?Boolean

Returns:

  • (Boolean)


482
483
484
# File 'lib/adlint/cc1/syntax.rb', line 482

def have_side_effect?
  subclass_responsibility
end

#logical?Boolean

Returns:

  • (Boolean)


490
491
492
# File 'lib/adlint/cc1/syntax.rb', line 490

def logical?
  subclass_responsibility
end

#object_specifiersObject



502
503
504
505
506
# File 'lib/adlint/cc1/syntax.rb', line 502

def object_specifiers
  ObjectSpecifierCollector.new.tap { |col|
    self.accept(col)
  }.object_specifiers
end

#to_complemental_logicalObject



512
513
514
515
# File 'lib/adlint/cc1/syntax.rb', line 512

def to_complemental_logical
  # NOTE: This method must be invoked on a normalized expression.
  subclass_responsibility
end

#to_normalized_logical(parent_expr = nil) ⇒ Object



508
509
510
# File 'lib/adlint/cc1/syntax.rb', line 508

def to_normalized_logical(parent_expr = nil)
  subclass_responsibility
end

#to_sObject



517
518
519
# File 'lib/adlint/cc1/syntax.rb', line 517

def to_s
  subclass_responsibility
end