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

Inheritance diagram of ArrayReference
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:
Returns:

an ArrayReference instance.

Return type:

psyclone.psyir.nodes.ArrayReference

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.