Class: AdLint::Cc1::ParameterDefinition

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

Instance Attribute Summary collapse

Attributes inherited from Definition

#declaration_specifiers, #type

Attributes inherited from SyntaxNode

#head_token, #subsequent_sequence_point, #tail_token

Instance Method Summary collapse

Methods included from DeclarationSpecifiersHolder

#explicitly_typed?, #function_specifier, #implicitly_typed?, #storage_class_specifier, #type_qualifiers, #type_specifiers

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(dcl_specs, dcr) ⇒ ParameterDefinition



4181
4182
4183
4184
# File 'lib/adlint/cc1/syntax.rb', line 4181

def initialize(dcl_specs, dcr)
  super(dcl_specs)
  @declarator = dcr
end

Instance Attribute Details

#declaratorObject (readonly)

Returns the value of attribute declarator.



4186
4187
4188
# File 'lib/adlint/cc1/syntax.rb', line 4186

def declarator
  @declarator
end

Instance Method Details

#identifierObject



4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
# File 'lib/adlint/cc1/syntax.rb', line 4188

def identifier
  if @declarator
    if @declarator.abstract?
      nil
    else
      @declarator.identifier
    end
  else
    nil
  end
end

#inspect(indent = 0) ⇒ Object



4217
4218
4219
4220
4221
# File 'lib/adlint/cc1/syntax.rb', line 4217

def inspect(indent = 0)
  " " * indent + "#{short_class_name} (#{location.inspect}) " +
    (storage_class_specifier ? storage_class_specifier.inspect : "") +
    (identifier ? identifier.value : "")
end

#locationObject



4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
# File 'lib/adlint/cc1/syntax.rb', line 4200

def location
  case
  when identifier
    identifier.location
  when declaration_specifiers
    declaration_specifiers.location
  else
    Location.new
  end
end

#to_variable_definitionObject



4211
4212
4213
4214
4215
# File 'lib/adlint/cc1/syntax.rb', line 4211

def to_variable_definition
  PseudoVariableDefinition.new(declaration_specifiers,
                               InitDeclarator.new(@declarator, nil, nil),
                               type)
end