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.



3238
3239
3240
3241
# File 'lib/adlint/cc1/syntax.rb', line 3238

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

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



3243
3244
3245
# File 'lib/adlint/cc1/syntax.rb', line 3243

def base
  @base
end

Instance Method Details

#function?(stack = []) ⇒ Boolean

Returns:

  • (Boolean)


3253
3254
3255
3256
3257
3258
# File 'lib/adlint/cc1/syntax.rb', line 3253

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

#identifierObject



3249
3250
3251
# File 'lib/adlint/cc1/syntax.rb', line 3249

def identifier
  @base.identifier
end

#inspect(indent = 0) ⇒ Object



3260
3261
3262
# File 'lib/adlint/cc1/syntax.rb', line 3260

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

#locationObject



3245
3246
3247
# File 'lib/adlint/cc1/syntax.rb', line 3245

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