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.



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

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.



4395
4396
4397
# File 'lib/adlint/cc1/syntax.rb', line 4395

def base
  @base
end

#parameter_type_listObject (readonly)

Returns the value of attribute parameter_type_list.



4396
4397
4398
# File 'lib/adlint/cc1/syntax.rb', line 4396

def parameter_type_list
  @parameter_type_list
end

Instance Method Details

#function?(stack = []) ⇒ Boolean

Returns:

  • (Boolean)


4402
4403
4404
4405
4406
# File 'lib/adlint/cc1/syntax.rb', line 4402

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

#innermost_parameter_type_listObject



4408
4409
4410
# File 'lib/adlint/cc1/syntax.rb', line 4408

def innermost_parameter_type_list
  @base.innermost_parameter_type_list || @parameter_type_list
end

#inspect(indent = 0) ⇒ Object



4412
4413
4414
# File 'lib/adlint/cc1/syntax.rb', line 4412

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

#locationObject



4398
4399
4400
# File 'lib/adlint/cc1/syntax.rb', line 4398

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