psyclone.psyir.nodes.array_of_structures_mixin#

This module contains the implementation of the abstract ArrayOfStructuresMixin.

Classes#

class psyclone.psyir.nodes.array_of_structures_mixin.ArrayOfStructuresMixin[source]#

Abstract class that combines the ArrayMixin and the StructureAccessorMixin. As such, it has a member (as child 0) and indices (starting from child 1)

Inheritance

Inheritance diagram of ArrayOfStructuresMixin
get_signature_and_indices()[source]#
Returns:

the Signature of this array of structure reference, and a list of lists of the indices used for each component.

Return type:

tuple(psyclone.core.Signature, list of lists of indices)

index_of(node)[source]#

If the given node is one of the index expressions of the array, it returns the zero-indexed dimension of the array that it belongs to. Note that this is different to node.position because ArraysOfStructures have a Member child, and it is different from array.indices.index(node) because that would use the equality operator, but sibling indices may be equal and provide unexpected results.

Parameters:

node (psyclone.psyir.nodes.Node) – the node to get the index of.

Returns:

the index of the given node in the array.

Return type:

int

Raises:

ValueError – if node is not an index of the array.

property indices: Tuple[Node]#

Supports semantic-navigation by returning the list of nodes representing the index expressions for this array reference.

Returns:

the PSyIR nodes representing the array-index expressions.

Return type:

list of psyclone.psyir.nodes.Node

Raises:

InternalError – if this node does not have at least two children.