psyclone.psyir.nodes.array_reference#
This module contains the implementation of the ArrayReference node.
Classes#
ArrayReference: Node representing a reference to an element or elements of an Array.
- class psyclone.psyir.nodes.array_reference.ArrayReference(symbol, **kwargs)[source]#
Node representing a reference to an element or elements of an Array. The array-index expressions are stored as the children of this node.
Inheritance

- static create(symbol, indices)[source]#
Create an ArrayReference instance given a symbol and a list of Node array indices. The special value “:” can be used as an index to create the corresponding PSyIR Range that represents “:”.
- Parameters:
symbol (
psyclone.psyir.symbols.DataSymbol) – the symbol that this array is associated with.indices (List[Union[
psyclone.psyir.nodes.Node,”:”]]) – a list of Nodes or “:” describing the array indices.
- Returns:
an ArrayReference instance.
- Return type:
- Raises:
GenerationError – if the arguments to the create method are not of the expected type.
- property datatype: DataType#
Note that if the resulting datatype is an ArrayType, this will convert Extent attributes to the appropriate inquiry intrinsic, which is convenient to directly use the resulting expression as executable code. Use node.symbol.datatype to obtain the type declaration of the array symbol (with its Extent attributes).
- Returns:
the resulting datatype of the array access expression.