Class: AdLint::Cc1::Function

Inherits:
TypedObject show all
Defined in:
lib/adlint/cc1/object.rb

Overview

DESCRIPTION

Function class hierarchy

Function
  <-- NamedFunction ------> Nameable <<module>>
        <-- ExplicitFunction
        <-- ImplicitFunction
        <-- BuiltinFunction
  <-- AnonymousFunction

Direct Known Subclasses

AnonymousFunction, NamedFunction

Instance Attribute Summary

Attributes inherited from TypedObject

#type

Attributes inherited from Object

#declarations_and_definitions

Attributes included from Bindable

#binding

Instance Method Summary collapse

Methods inherited from TypedObject

#to_pointer, #to_pointer_value, #to_value, #to_variable

Methods inherited from Object

#declared_as_auto?, #declared_as_extern?, #declared_as_register?, #declared_as_static?, #designated_by_lvalue?, #storage_class_specifiers

Methods included from Bindable

#be_alias_to, #bind_to

Constructor Details

#initialize(dcl_or_def, type) ⇒ Function

Returns a new instance of Function.



900
901
902
# File 'lib/adlint/cc1/object.rb', line 900

def initialize(dcl_or_def, type)
  super(type, dcl_or_def)
end

Instance Method Details

#builtin?Boolean

Returns:

  • (Boolean)


932
933
934
# File 'lib/adlint/cc1/object.rb', line 932

def builtin?
  subclass_responsibility
end

#call(interp, funcall_expr, args) ⇒ Object



936
937
938
939
940
941
942
943
944
945
946
# File 'lib/adlint/cc1/object.rb', line 936

def call(interp, funcall_expr, args)
  assign_arguments_to_parameters(interp, args)
  return_values_via_pointer_arguments(interp, funcall_expr, args)

  if type.return_type.function?
    interp.create_tmpvar
  else
    ret_type = type.return_type
    interp.create_tmpvar(ret_type, ret_type.return_value)
  end
end

#explicit?Boolean

Returns:

  • (Boolean)


924
925
926
# File 'lib/adlint/cc1/object.rb', line 924

def explicit?
  subclass_responsibility
end

#function?Boolean

Returns:

  • (Boolean)


920
921
922
# File 'lib/adlint/cc1/object.rb', line 920

def function?
  true
end

#implicit?Boolean

Returns:

  • (Boolean)


928
929
930
# File 'lib/adlint/cc1/object.rb', line 928

def implicit?
  !explicit?
end

#nameObject



904
905
906
# File 'lib/adlint/cc1/object.rb', line 904

def name
  subclass_responsibility
end

#named?Boolean

Returns:

  • (Boolean)


908
909
910
# File 'lib/adlint/cc1/object.rb', line 908

def named?
  false
end

#signatureObject



948
949
950
# File 'lib/adlint/cc1/object.rb', line 948

def signature
  subclass_responsibility
end

#temporary?Boolean

Returns:

  • (Boolean)


912
913
914
# File 'lib/adlint/cc1/object.rb', line 912

def temporary?
  false
end

#variable?Boolean

Returns:

  • (Boolean)


916
917
918
# File 'lib/adlint/cc1/object.rb', line 916

def variable?
  false
end