loki.types.procedure_type

Representation of a procedure type for function or subroutine type definitions.

Classes

ProcedureType([name, is_function, ...])

Representation of a function or subroutine type definition.

class ProcedureType(name=None, is_function=None, is_generic=False, is_intrinsic=False, procedure=None, return_type=None)

Bases: DataType

Representation of a function or subroutine type definition.

This serves also as the cross-link between the use of a procedure (e.g. in a CallStatement) to the Subroutine object that is the target of a call. If the corresponding object is not yet available when the ProcedureType object is created, or its definition is transient and subject to IR rebuilds (e.g. StatementFunction), the LazyNodeLookup utility can be used to defer the actual instantiation. In that situation, name should be provided in addition.

Parameters:
  • name (str, optional) – The name of the function or subroutine. Can be skipped if procedure is provided (not in the form of a LazyNodeLookup)

  • is_function (bool, optional) – Indicate that this is a function

  • is_generic (bool, optional) – Indicate that this is a generic function

  • is_intrinsic (bool, optional) – Indicate that this is an intrinsic function

  • procedure (Subroutine or StatementFunction or LazyNodeLookup, optional) – The procedure this type represents

property name

The name of the procedure

This looks up the name in the linked procedure if available, otherwise returns the name stored during instanation of the ProcedureType object.

property procedure

The Subroutine object of the procedure

If not provided during instantiation or if the underlying weakref is dead, this returns BasicType.DEFERRED.

property is_function

Return True if the procedure is a function, otherwise False

property is_elemental

Return True if the procedure has the elemental prefix, otherwise False

property return_type

The return type of the function (or None)