psyclone.psyir.nodes.container#
This module contains the Container node implementation.
Classes#
Container: Node representing a set of Routine and/or Container nodes, as well
- class psyclone.psyir.nodes.container.Container(name, **kwargs)[source]#
Node representing a set of Routine and/or Container nodes, as well as a name and a SymbolTable. This construct can be used to scope symbols of variables, Routine names and Container names. In Fortran a container would naturally represent a module or a submodule.
- Parameters:
name (str) – the name of the container.
parent (
psyclone.psyir.nodes.Node) – optional parent node of this Container in the PSyIR.symbol_table (
psyclone.psyir.symbols.SymbolTableor NoneType) – initialise the node with a given symbol table.
Inheritance

- classmethod create(name, symbol_table, children)[source]#
Create a Container instance given a name, a symbol table and a list of child nodes.
- Parameters:
name (str) – the name of the Container.
symbol_table (
psyclone.psyir.symbols.SymbolTable) – the symbol table associated with this Container.children (list of
psyclone.psyir.nodes.Containerorpsyclone.psyir.nodes.Routine) – a list of PSyIR nodes contained in the Container. These must be Containers or Routines.
- Returns:
an instance of cls.
- Return type:
psyclone.psyir.nodes.Containeror subclass thereof- Raises:
GenerationError – if the arguments to the create method are not of the expected type.
- find_routine_psyir(name, allow_private=False)[source]#
Searches the Container for a definition of the named routine with appropriate visibility.
NOTE: if the named routine corresponds to a generic interface then this method will return None. You will need to use resolve_routine first to find the names of the routines that the interface resolves to.
- Parameters:
name (str) – the name of the Routine for which to search.
allow_private (bool) – whether the Routine is permitted to have a visibility of PRIVATE.
- Returns:
the PSyIR of the named Routine if found, otherwise None.
- Return type:
psyclone.psyir.nodes.Routine| NoneType
- property name#
- Returns:
name of the container.
- Return type:
str
- node_str(colour=True)[source]#
Returns the name of this node with appropriate control codes to generate coloured output in a terminal that supports it.
- Parameters:
colour (bool) – whether or not to include colour control codes.
- Returns:
description of this node, possibly coloured.
- Return type:
str
- resolve_routine(name)[source]#
This function returns a list of function names that might be actually called when the routine name is called. In most cases this is exactly name, but in case of a generic subroutine the name might change. For now (since we cannot compare routine signatures yet), we return the list of all possible functions that might be called.
If the symbol with the specified name is a generic Symbol and is imported then it is specialised (in place) to become a RoutineSymbol.
- Parameters:
name (str) – the name of the routine to resolve
- Returns:
the names of those routines that may actually be invoked when the routine name is called or an empty list if there is no routine with that name in this container.
- Return type:
list[str | None]
- Raises:
TypeError – if the Symbol with the supplied name is not a RoutineSymbol, GenericInterfaceSymbol or imported Symbol.