Skip to content

Commit

Permalink
#1960 improve readability of array_reference.datatype
Browse files Browse the repository at this point in the history
  • Loading branch information
arporter committed Jan 30, 2024
1 parent 094249a commit 643b238
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/psyclone/psyir/nodes/array_reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ def datatype(self):
shape = self._get_effective_shape()
if shape:
if type(self.symbol) is Symbol:
orig_shape = []
# We don't have any information on the shape of the original
# declaration.
orig_shape = None
elif isinstance(self.symbol.datatype, ArrayType):
# We have full type information so we know the shape of the
# original declaration.
Expand All @@ -143,8 +145,8 @@ def datatype(self):
else:
# We don't have any information on the shape of the original
# declaration.
orig_shape = []
if (len(shape) == len(orig_shape) and
orig_shape = None
if (orig_shape is not None and len(shape) == len(orig_shape) and
all(self.is_full_range(idx) for idx in range(len(shape)))):
# Although this access has a shape, it is in fact for the
# whole array and therefore the type of the result is just
Expand Down

0 comments on commit 643b238

Please sign in to comment.