Class: AdLint::Cc1::FunctionDeclarator

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

Instance Attribute Summary collapse

Attributes inherited from Declarator

#pointer

Attributes inherited from SyntaxNode

#head_token, #subsequent_sequence_point, #tail_token

Instance Method Summary collapse

Methods inherited from Declarator

#abstract?, #full=, #full?, #identifier_list, #innermost_parameter_type_list, #parameter_type_list, #variable?

Methods inherited from SyntaxNode

#head_location, #short_class_name, #tail_location

Methods included from LocationHolder

#analysis_target?

Methods included from Visitable

#accept

Constructor Details

#initialize(base_dcr) ⇒ FunctionDeclarator

Returns a new instance of FunctionDeclarator.



3257
3258
3259
3260
# File 'lib/adlint/cc1/syntax.rb', line 3257

def initialize(base_dcr)
  super()
  @base = base_dcr
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



3262
3263
3264
# File 'lib/adlint/cc1/syntax.rb', line 3262

def base
  @base
end

Instance Method Details

#function?(stack = []) ⇒ Boolean

Returns:

  • (Boolean)


3272
3273
3274
3275
3276
3277
# File 'lib/adlint/cc1/syntax.rb', line 3272

def function?(stack = [])
  stack.push(:pointer) if pointer
  stack.push(:function)
  @base.function?(stack)
  stack.last == :function
end

#identifierObject



3268
3269
3270
# File 'lib/adlint/cc1/syntax.rb', line 3268

def identifier
  @base.identifier
end

#inspect(indent = 0) ⇒ Object



3279
3280
3281
# File 'lib/adlint/cc1/syntax.rb', line 3279

def inspect(indent = 0)
  " " * indent + "#{short_class_name}\n" + @base.inspect(indent + 1)
end

#locationObject



3264
3265
3266
# File 'lib/adlint/cc1/syntax.rb', line 3264

def location
  @base ? @base.location || head_location : head_location
end