From 57ab61ac41992f1d3b47de6f6742860c62786366 Mon Sep 17 00:00:00 2001 From: Jan Hoenig <hrominium@gmail.com> Date: Thu, 8 Dec 2016 10:44:34 +0100 Subject: [PATCH] Fixed bugs after the DataType transition --- transformations.py | 1 + types.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/transformations.py b/transformations.py index f83fa9c64..b39bd92b2 100644 --- a/transformations.py +++ b/transformations.py @@ -222,6 +222,7 @@ def resolveFieldAccesses(astNode, readOnlyFieldNames=set(), fieldToBasePointerIn dtype = DataType(field.dtype) dtype.alias = False + dtype.ptr = True if field.name in readOnlyFieldNames: dtype.const = True diff --git a/types.py b/types.py index e4f579e68..2da1e3fc4 100644 --- a/types.py +++ b/types.py @@ -22,7 +22,7 @@ class TypedSymbol(sp.Symbol): def _hashable_content(self): superClassContents = list(super(TypedSymbol, self)._hashable_content()) - t = tuple(superClassContents + [hash(self._dtype)]) + t = tuple(superClassContents + [hash(repr(self._dtype))]) return t def __getnewargs__(self): @@ -37,10 +37,12 @@ class DataType(object): def __init__(self, dtype): self.alias = True self.const = False + self.ptr = False if isinstance(dtype, str): self.dtype = _dtype_dict[dtype] else: self.dtype = dtype def __repr__(self): - return "{!s} {!s} {!s}".format("const" if self.const else "", "__restrict__" if not self.alias else "", _c_dtype_dict[self.dtype]) + return "{!s} {!s}{!s} {!s}".format("const" if self.const else "", _c_dtype_dict[self.dtype], + "*" if self.ptr else "", "__restrict__" if not self.alias else "") -- GitLab