psyclone.psyir.symbols.containersymbol#

This module contains the ContainerSymbol and its interfaces.

Classes#

class psyclone.psyir.symbols.containersymbol.ContainerSymbol(name, **kwargs)[source]#

Symbol that represents a reference to a Container. The reference is lazy evaluated, this means that the Symbol will be created without parsing and importing the referenced container, but this can be imported when needed.

Parameters:
  • name (str) – name of the symbol.

  • wildcard_import (bool) – if all public Symbols of the Container are imported into the current scope. Defaults to False.

  • is_intrinsic (bool) – if the module is an intrinsic import. Defauts to False.

  • kwargs (unwrapped dict.) – additional keyword arguments provided by psyclone.psyir.symbols.Symbol.

Inheritance

Inheritance diagram of ContainerSymbol
copy()[source]#

Create and return a copy of this object. Any references to the original will not be affected so the copy will not be referred to by any other object.

Returns:

A symbol object with the same properties as this symbol object.

Return type:

psyclone.psyir.symbols.Symbol

find_container_psyir(local_node=None)[source]#

Searches for the Container that this Symbol refers to. If it is not available, use the interface to import the container. If local_node is supplied then the PSyIR tree below it is searched for the container first.

Parameters:

local_node (Optional[psyclone.psyir.nodes.Node]) – root of PSyIR sub-tree to include in search for the container.

Returns:

referenced container.

Return type:

psyclone.psyir.nodes.Container

property is_intrinsic#
Returns:

whether or not this module is an intrinsic module.

Return type:

bool

property wildcard_import#
Returns:

whether or not there is a wildcard import of all public symbols from this Container.

Return type:

bool

class psyclone.psyir.symbols.containersymbol.ContainerSymbolInterface[source]#

Abstract implementation of the ContainerSymbol Interface

Inheritance

Inheritance diagram of ContainerSymbolInterface
static get_container(name)[source]#

Abstract method to import an external container, the specific implementation depends on the language used.

Parameters:

name (str) – name of the external entity to be imported.

Raises:

NotImplementedError – this is an abstract method.

class psyclone.psyir.symbols.containersymbol.FortranModuleInterface[source]#

Implementation of ContainerSymbolInterface for Fortran modules

Inheritance

Inheritance diagram of FortranModuleInterface
static get_container(name)[source]#

Imports a Fortran module as a PSyIR Container (via the ModuleManager) and returns it.

Parameters:

name (str) – name of the module to be imported.

Returns:

container associated with the given name.

Return type:

psyclone.psyir.nodes.Container

Raises:

SymbolError – the given Fortran module is not found on the import path.