Class: AdLint::Cc1::TranslationUnit

Inherits:
SyntaxNode 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 SyntaxNode

#head_location, #short_class_name, #tail_location

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initializeTranslationUnit

Returns a new instance of TranslationUnit.



3980
3981
3982
3983
# File 'lib/adlint/cc1/syntax.rb', line 3980

def initialize
  super
  @external_declarations = []
end

Instance Attribute Details

#external_declarationsObject (readonly)

Returns the value of attribute external_declarations.



3985
3986
3987
# File 'lib/adlint/cc1/syntax.rb', line 3985

def external_declarations
  @external_declarations
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



4000
4001
4002
4003
# File 'lib/adlint/cc1/syntax.rb', line 4000

def inspect(indent = 0)
  ([" " * indent + short_class_name] +
   @external_declarations.map { |d| d.inspect(indent + 1) }).join("\n")
end

#locationObject



3996
3997
3998
# File 'lib/adlint/cc1/syntax.rb', line 3996

def location
  head_location ? head_location : Location.new
end

#push(external_dcl) ⇒ Object



3987
3988
3989
3990
3991
3992
3993
3994
# File 'lib/adlint/cc1/syntax.rb', line 3987

def push(external_dcl)
  if @external_declarations.empty?
    self.head_token = external_dcl.head_token
  end
  @external_declarations.push(external_dcl)
  self.tail_token = external_dcl.tail_token
  self
end