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.



4429
4430
4431
4432
# File 'lib/adlint/cc1/syntax.rb', line 4429

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4434
4435
4436
# File 'lib/adlint/cc1/syntax.rb', line 4434

def name
  @name
end

Instance Method Details

#==(rhs) ⇒ Object



4436
4437
4438
4439
4440
4441
4442
# File 'lib/adlint/cc1/syntax.rb', line 4436

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



4444
4445
4446
4447
4448
# File 'lib/adlint/cc1/syntax.rb', line 4444

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