Class: AdLint::Cc1::FunctionAbstractDeclarator

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

#abstract?, #identifier

Methods inherited from Declarator

#abstract?, #full=, #full?, #identifier, #identifier_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(abstract_dcr, param_type_list) ⇒ FunctionAbstractDeclarator

Returns a new instance of FunctionAbstractDeclarator.



4370
4371
4372
4373
4374
# File 'lib/adlint/cc1/syntax.rb', line 4370

def initialize(abstract_dcr, param_type_list)
  super()
  @base = abstract_dcr
  @parameter_type_list = param_type_list
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



4376
4377
4378
# File 'lib/adlint/cc1/syntax.rb', line 4376

def base
  @base
end

#parameter_type_listObject (readonly)

Returns the value of attribute parameter_type_list.



4377
4378
4379
# File 'lib/adlint/cc1/syntax.rb', line 4377

def parameter_type_list
  @parameter_type_list
end

Instance Method Details

#function?(stack = []) ⇒ Boolean

Returns:

  • (Boolean)


4383
4384
4385
4386
4387
# File 'lib/adlint/cc1/syntax.rb', line 4383

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

#innermost_parameter_type_listObject



4389
4390
4391
# File 'lib/adlint/cc1/syntax.rb', line 4389

def innermost_parameter_type_list
  @base.innermost_parameter_type_list || @parameter_type_list
end

#inspect(indent = 0) ⇒ Object



4393
4394
4395
# File 'lib/adlint/cc1/syntax.rb', line 4393

def inspect(indent = 0)
  " " * indent + short_class_name
end

#locationObject



4379
4380
4381
# File 'lib/adlint/cc1/syntax.rb', line 4379

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