Class: AdLint::Cc1::ParameterType

Inherits:
Type
  • Object
show all
Extended by:
Forwardable
Includes:
Scopeable
Defined in:
lib/adlint/cc1/type.rb

Overview

NOTE: ParameterType is a decorator which attaches a parameter name to other

types.

Instance Attribute Summary collapse

Attributes included from Scopeable

#scope

Attributes inherited from Type

#declarations, #name, #type_table

Instance Method Summary collapse

Methods inherited from Type

#==, #_arithmetic_type_with_array, #_arithmetic_type_with_bitfield, #_arithmetic_type_with_char, #_arithmetic_type_with_double, #_arithmetic_type_with_enum, #_arithmetic_type_with_extended_big_int, #_arithmetic_type_with_float, #_arithmetic_type_with_function, #_arithmetic_type_with_int, #_arithmetic_type_with_long, #_arithmetic_type_with_long_double, #_arithmetic_type_with_long_int, #_arithmetic_type_with_long_long, #_arithmetic_type_with_long_long_int, #_arithmetic_type_with_pointer, #_arithmetic_type_with_short, #_arithmetic_type_with_short_int, #_arithmetic_type_with_signed, #_arithmetic_type_with_signed_char, #_arithmetic_type_with_signed_int, #_arithmetic_type_with_signed_long, #_arithmetic_type_with_signed_long_int, #_arithmetic_type_with_signed_long_long, #_arithmetic_type_with_signed_long_long_int, #_arithmetic_type_with_signed_short, #_arithmetic_type_with_signed_short_int, #_arithmetic_type_with_struct, #_arithmetic_type_with_undeclared, #_arithmetic_type_with_union, #_arithmetic_type_with_unresolved, #_arithmetic_type_with_unsigned, #_arithmetic_type_with_unsigned_char, #_arithmetic_type_with_unsigned_int, #_arithmetic_type_with_unsigned_long, #_arithmetic_type_with_unsigned_long_int, #_arithmetic_type_with_unsigned_long_long, #_arithmetic_type_with_unsigned_long_long_int, #_arithmetic_type_with_unsigned_short, #_arithmetic_type_with_unsigned_short_int, #_arithmetic_type_with_void, #aligned_bit_size, #aligned_byte_size, #arbitrary_value, #argument_promoted_type, #arithmetic_type_with, #array?, #base_type, #bit_alignment, #bit_size, #bitfield?, #brief_image, #byte_alignment, #byte_size, #coerce_array_value, #coerce_composite_value, #coerce_scalar_value, #coercible?, #compatible?, #composite?, #const?, #convertible?, #corresponding_signed_type, #corresponding_unsigned_type, #enum?, #enumerators, #explicitly_signed?, #floating?, #function?, #have_va_list?, #id, #image, #impl_length, #incomplete?, #inspect, #integer?, #integer_conversion_rank, #integer_promoted_type, #length, #length=, #max, #member_named, #members, #min, #more_cv_qualified?, #named?, #nil_value, #parameter_types, #parameter_value, #pointer?, #qualified?, #restrict?, #return_type, #return_value, #same_as?, #scalar?, #signed?, #standard?, #struct?, #undeclared?, #undefined_value, #union?, #unqualify, #unresolved?, #unsigned?, #user?, #void?, #volatile?, #zero_value

Methods included from StandardTypesAccessor

#char_alignment, #char_as_unsigned_char?, #char_size, #code_ptr_alignment, #code_ptr_size, #data_ptr_alignment, #data_ptr_size, #double_alignment, #double_size, #float_alignment, #float_size, #int_alignment, #int_size, #long_alignment, #long_double_alignment, #long_double_size, #long_long_alignment, #long_long_size, #long_size, #short_alignment, #short_size, #standard_types

Methods included from ArithmeticAccessor

#arithmetic, #logical_right_shift?

Methods included from Visitable

#accept

Constructor Details

#initialize(type_tbl, type, dcl_or_def = nil) ⇒ ParameterType

Returns a new instance of ParameterType.



6936
6937
6938
6939
6940
6941
6942
6943
6944
6945
6946
# File 'lib/adlint/cc1/type.rb', line 6936

def initialize(type_tbl, type, dcl_or_def = nil)
  super(type_tbl, type.name, type.declarations)
  @type = type

  if dcl_or_def and dcr = dcl_or_def.declarator
    identifier = dcr.identifier
  end

  @param_name = identifier ? identifier.value : ""
  @declaration_or_definition = dcl_or_def
end

Instance Attribute Details

#param_nameObject (readonly)

Returns the value of attribute param_name.



6949
6950
6951
# File 'lib/adlint/cc1/type.rb', line 6949

def param_name
  @param_name
end

#typeObject (readonly)

Returns the value of attribute type.



6948
6949
6950
# File 'lib/adlint/cc1/type.rb', line 6948

def type
  @type
end

Instance Method Details

#dupObject



7074
7075
7076
# File 'lib/adlint/cc1/type.rb', line 7074

def dup
  ParameterType.new(type_table, @type.dup, @declaration_or_definition)
end

#locationObject



6955
6956
6957
6958
# File 'lib/adlint/cc1/type.rb', line 6955

def location
  @declaration_or_definition ?
    @declaration_or_definition.location : @type.location
end

#parameter?Boolean

Returns:

  • (Boolean)


6980
6981
6982
# File 'lib/adlint/cc1/type.rb', line 6980

def parameter?
  true
end

#real_typeObject



6966
6967
6968
6969
# File 'lib/adlint/cc1/type.rb', line 6966

def real_type
  ParameterType.new(type_table, @type.real_type,
                    @declaration_or_definition)
end