class AdLint::Cc1::AnsiFunctionDefinition

Public Class Methods

new(dcl_specs, dcr, compound_stmt, sym_tbl) click to toggle source
Calls superclass method AdLint::Cc1::FunctionDefinition::new
# File lib/adlint/cc1/syntax.rb, line 4147
def initialize(dcl_specs, dcr, compound_stmt, sym_tbl)
  super(dcl_specs, dcr,
        create_parameters(dcr.innermost_parameter_type_list),
        compound_stmt, sym_tbl)
end

Public Instance Methods

parameter_type_list() click to toggle source
# File lib/adlint/cc1/syntax.rb, line 4153
def parameter_type_list
  declarator.parameter_type_list
end

Private Instance Methods

create_parameters(param_type_list) click to toggle source
# File lib/adlint/cc1/syntax.rb, line 4158
def create_parameters(param_type_list)
  return [] unless param_type_list
  param_type_list.parameters.map do |param_dcl|
    dcl_specs = param_dcl.declaration_specifiers
    dcr = param_dcl.declarator
    param_def = ParameterDefinition.new(dcl_specs, dcr)

    unless dcl_specs
      param_def.head_token = dcr.head_token
      param_def.tail_token = dcr.tail_token
    end

    unless dcr
      param_def.head_token = dcl_specs.head_token
      param_def.tail_token = dcl_specs.tail_token
    end

    param_def
  end
end