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.



3961
3962
3963
3964
# File 'lib/adlint/cc1/syntax.rb', line 3961

def initialize
  super
  @external_declarations = []
end

Instance Attribute Details

#external_declarationsObject (readonly)

Returns the value of attribute external_declarations.



3966
3967
3968
# File 'lib/adlint/cc1/syntax.rb', line 3966

def external_declarations
  @external_declarations
end

Instance Method Details

#inspect(indent = 0) ⇒ Object



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

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

#locationObject



3977
3978
3979
# File 'lib/adlint/cc1/syntax.rb', line 3977

def location
  head_location ? head_location : Location.new
end

#push(external_dcl) ⇒ Object



3968
3969
3970
3971
3972
3973
3974
3975
# File 'lib/adlint/cc1/syntax.rb', line 3968

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