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.



891
892
893
# File 'lib/adlint/cc1/object.rb', line 891

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

Instance Method Details

#builtin?Boolean

Returns:

  • (Boolean)


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

def builtin?
  subclass_responsibility
end

#call(interp, funcall_expr, args) ⇒ Object



927
928
929
930
931
932
933
934
935
936
937
# File 'lib/adlint/cc1/object.rb', line 927

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)


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

def explicit?
  subclass_responsibility
end

#function?Boolean

Returns:

  • (Boolean)


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

def function?
  true
end

#implicit?Boolean

Returns:

  • (Boolean)


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

def implicit?
  !explicit?
end

#nameObject



895
896
897
# File 'lib/adlint/cc1/object.rb', line 895

def name
  subclass_responsibility
end

#named?Boolean

Returns:

  • (Boolean)


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

def named?
  false
end

#signatureObject



939
940
941
# File 'lib/adlint/cc1/object.rb', line 939

def signature
  subclass_responsibility
end

#temporary?Boolean

Returns:

  • (Boolean)


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

def temporary?
  false
end

#variable?Boolean

Returns:

  • (Boolean)


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

def variable?
  false
end