# loki.function module

class Function(*args, parent=None, symbol_attrs=None, **kwargs)

  Bases: `Subroutine`

  Class to handle and manipulate a single function.

  Parameters:

    - name (str) – Name of the subroutine.

    - args (iterable of str, optional) – The names of the dummy args.

    - docstring (tuple of `Node`, optional) – The subroutine docstring in the original source.

    - spec (`Section`, optional) – The spec of the subroutine.

    - body (`Section`, optional) – The body of the subroutine.

    - contains (`Section`, optional) – The internal-subprogram part following a `CONTAINS` statement declaring member procedures

    - prefix (iterable, optional) – Prefix specifications for the procedure

    - bind (optional) – Bind information (e.g., for Fortran `BIND(C)` annotation).

    - result_name (str, optional) – The name of the result variable for functions.

    - ast (optional) – Frontend node for this subroutine (from parse tree of the frontend).

    - source (`Source`) – Source object representing the raw source string information from the read file.

    - parent (`Scope`, optional) – The enclosing parent scope of the subroutine, typically a `Module` or `Subroutine` object. Declarations from the parent scope remain valid within the subroutine’s scope (unless shadowed by local declarations).

    - rescope_symbols (bool, optional) – Ensure that the type information for all `TypedSymbol` in the subroutine’s IR exist in the subroutine’s scope or the scope’s parents. Defaults to False.

    - symbol_attrs (`SymbolTable`, optional) – Use the provided `SymbolTable` object instead of creating a new

    - incomplete (bool, optional) – Mark the object as incomplete, i.e. only partially parsed. This is typically the case when it was instantiated using the `Frontend.REGEX` frontend and a full parse using one of the other frontends is pending.

    - parser_classes (`RegexParserClass`, optional) – Provide the list of parser classes used during incomplete regex parsing

  is_function = True
  property return_type

    Return the return_type of this subroutine

  clone(**kwargs)

    Create a copy of the function with the option to override individual parameters.

    Parameters:

      **kwargs – Any parameters from the constructor of `Function`.

    Returns:

      The cloned subroutine object.

    Return type:

      `Function`