Class: AdLint::Cc1::FunctionSignature

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type) ⇒ FunctionSignature

Returns a new instance of FunctionSignature.



4448
4449
4450
4451
# File 'lib/adlint/cc1/syntax.rb', line 4448

def initialize(name, type)
  @name = name
  @type = type
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4453
4454
4455
# File 'lib/adlint/cc1/syntax.rb', line 4453

def name
  @name
end

Instance Method Details

#==(rhs) ⇒ Object



4455
4456
4457
4458
4459
4460
4461
# File 'lib/adlint/cc1/syntax.rb', line 4455

def ==(rhs)
  if @type.parameter_types.empty? || rhs.type.parameter_types.empty?
    @name == rhs.name
  else
    @name == rhs.name && @type == rhs.type
  end
end

#to_sObject



4463
4464
4465
4466
4467
# File 'lib/adlint/cc1/syntax.rb', line 4463

def to_s
  "#{@type.return_type.brief_image} #{@name}(" +
    @type.parameter_types.map { |t| t.brief_image }.join(",") +
    (@type.have_va_list? ? ",...)" : ")")
end