Reference Guide  2.5.0
psyclone.psyir.symbols.containersymbol.ContainerSymbol Class Reference
Inheritance diagram for psyclone.psyir.symbols.containersymbol.ContainerSymbol:
Collaboration diagram for psyclone.psyir.symbols.containersymbol.ContainerSymbol:

Public Member Functions

def __init__ (self, name, wildcard_import=False, **kwargs)
 
def copy (self)
 
def container (self)
 
def __str__ (self)
 
def wildcard_import (self)
 
def wildcard_import (self, value)
 
- Public Member Functions inherited from psyclone.psyir.symbols.symbol.Symbol
def __init__ (self, name, visibility=DEFAULT_VISIBILITY, interface=None)
 
def copy_properties (self, symbol_in)
 
def specialise (self, subclass, **kwargs)
 
def get_external_symbol (self)
 
def resolve_type (self)
 
def name (self)
 
def visibility (self)
 
def visibility (self, value)
 
def interface (self)
 
def interface (self, value)
 
def is_automatic (self)
 
def is_modulevar (self)
 
def is_import (self)
 
def is_argument (self)
 
def is_commonblock (self)
 
def is_static (self)
 
def is_unresolved (self)
 
def is_unknown_interface (self)
 
def find_symbol_table (self, node)
 
def is_array (self)
 
def is_array_access (self, index_variable=None, access_info=None)
 

Public Attributes

 wildcard_import
 
- Public Attributes inherited from psyclone.psyir.symbols.symbol.Symbol
 interface
 
 visibility
 

Additional Inherited Members

- Static Public Attributes inherited from psyclone.psyir.symbols.symbol.Symbol
 DEFAULT_VISIBILITY = Visibility.PUBLIC
 

Detailed Description

 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.

:param str name: name of the symbol.
:param bool wildcard_import: if all public Symbols of the Container are \
    imported into the current scope. Defaults to False.
:param kwargs: additional keyword arguments provided by \
    :py:class:`psyclone.psyir.symbols.Symbol`.
:type kwargs: unwrapped dict.

Definition at line 47 of file containersymbol.py.

Member Function Documentation

◆ container()

def psyclone.psyir.symbols.containersymbol.ContainerSymbol.container (   self)
 Returns the referenced container. If it is not available, use
the interface to import the container

:returns: referenced container.
:rtype: :py:class:`psyclone.psyir.nodes.Container`

Definition at line 121 of file containersymbol.py.

121  def container(self):
122  ''' Returns the referenced container. If it is not available, use
123  the interface to import the container
124 
125  :returns: referenced container.
126  :rtype: :py:class:`psyclone.psyir.nodes.Container`
127  '''
128  if not self._reference:
129  self._reference = self._interface.import_container(self._name)
130  return self._reference
131 

References psyclone.psyir.symbols.symbol.Symbol._interface, psyclone.domain.common.algorithm.psyir.AlgorithmInvokeCall._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata._name, psyclone.domain.gocean.kernel.psyir.GOceanKernelMetadata.GridArg._name, psyclone.domain.lfric.kernel.lfric_kernel_metadata.LFRicKernelMetadata._name, psyclone.dynamo0p3.DynFuncDescriptor03._name, psyclone.expression.NamedArg._name, psyclone.gocean1p0.GOKernelGridArgument._name, psyclone.gocean1p0.GOStencil._name, psyclone.nemo.NemoInvoke._name, psyclone.nemo.NemoPSy._name, psyclone.parse.algorithm.FileInfo._name, psyclone.parse.algorithm.InvokeCall._name, psyclone.parse.kernel.KernelProcedure._name, psyclone.parse.kernel.KernelType._name, psyclone.parse.module_info.ModuleInfo._name, psyclone.psyGen.PSy._name, psyclone.psyGen.Invoke._name, psyclone.psyGen.Kern._name, psyclone.psyGen.Argument._name, psyclone.psyir.nodes.container.Container._name, psyclone.psyir.nodes.routine.Routine._name, psyclone.psyir.symbols.symbol.Symbol._name, and psyclone.psyir.symbols.containersymbol.ContainerSymbol._reference.

Here is the caller graph for this function:

◆ copy()

def psyclone.psyir.symbols.containersymbol.ContainerSymbol.copy (   self)
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.
:rtype: :py:class:`psyclone.psyir.symbols.Symbol`

Reimplemented from psyclone.psyir.symbols.symbol.Symbol.

Definition at line 105 of file containersymbol.py.

105  def copy(self):
106  '''Create and return a copy of this object. Any references to the
107  original will not be affected so the copy will not be referred
108  to by any other object.
109 
110  :returns: A symbol object with the same properties as this \
111  symbol object.
112  :rtype: :py:class:`psyclone.psyir.symbols.Symbol`
113 
114  '''
115  # Use the generic Symbol copy and add the wildcard import value
116  new_symbol = super(ContainerSymbol, self).copy()
117  new_symbol.wildcard_import = self.wildcard_import
118  return new_symbol
119 

References psyclone.psyir.symbols.containersymbol.ContainerSymbol.wildcard_import.

◆ wildcard_import() [1/2]

def psyclone.psyir.symbols.containersymbol.ContainerSymbol.wildcard_import (   self)
:returns: whether or not there is a wildcard import of all public \
          symbols from this Container.
:rtype: bool

Definition at line 141 of file containersymbol.py.

141  def wildcard_import(self):
142  '''
143  :returns: whether or not there is a wildcard import of all public \
144  symbols from this Container.
145  :rtype: bool
146 
147  '''
148  return self._has_wildcard_import
149 

References psyclone.psyir.symbols.containersymbol.ContainerSymbol._has_wildcard_import.

Here is the caller graph for this function:

◆ wildcard_import() [2/2]

def psyclone.psyir.symbols.containersymbol.ContainerSymbol.wildcard_import (   self,
  value 
)
Set whether or not there is a wildcard import of all public symbols
from this Container symbol.

:param bool value: whether there is or is not a wildcard import.

:raises TypeError: if the supplied `value` is not a bool.

Definition at line 151 of file containersymbol.py.

151  def wildcard_import(self, value):
152  '''
153  Set whether or not there is a wildcard import of all public symbols
154  from this Container symbol.
155 
156  :param bool value: whether there is or is not a wildcard import.
157 
158  :raises TypeError: if the supplied `value` is not a bool.
159 
160  '''
161  if not isinstance(value, bool):
162  raise TypeError(f"wildcard_import must be a bool but got: "
163  f"'{type(value).__name__}'")
164  self._has_wildcard_import = value
165 
166 

References psyclone.psyir.symbols.containersymbol.ContainerSymbol._has_wildcard_import.

Here is the caller graph for this function:

The documentation for this class was generated from the following file: