Skip to content
Snippets Groups Projects
Commit 57ab61ac authored by Jan Hoenig's avatar Jan Hoenig
Browse files

Fixed bugs after the DataType transition

parent 0168aaed
No related merge requests found
...@@ -222,6 +222,7 @@ def resolveFieldAccesses(astNode, readOnlyFieldNames=set(), fieldToBasePointerIn ...@@ -222,6 +222,7 @@ def resolveFieldAccesses(astNode, readOnlyFieldNames=set(), fieldToBasePointerIn
dtype = DataType(field.dtype) dtype = DataType(field.dtype)
dtype.alias = False dtype.alias = False
dtype.ptr = True
if field.name in readOnlyFieldNames: if field.name in readOnlyFieldNames:
dtype.const = True dtype.const = True
......
...@@ -22,7 +22,7 @@ class TypedSymbol(sp.Symbol): ...@@ -22,7 +22,7 @@ class TypedSymbol(sp.Symbol):
def _hashable_content(self): def _hashable_content(self):
superClassContents = list(super(TypedSymbol, self)._hashable_content()) superClassContents = list(super(TypedSymbol, self)._hashable_content())
t = tuple(superClassContents + [hash(self._dtype)]) t = tuple(superClassContents + [hash(repr(self._dtype))])
return t return t
def __getnewargs__(self): def __getnewargs__(self):
...@@ -37,10 +37,12 @@ class DataType(object): ...@@ -37,10 +37,12 @@ class DataType(object):
def __init__(self, dtype): def __init__(self, dtype):
self.alias = True self.alias = True
self.const = False self.const = False
self.ptr = False
if isinstance(dtype, str): if isinstance(dtype, str):
self.dtype = _dtype_dict[dtype] self.dtype = _dtype_dict[dtype]
else: else:
self.dtype = dtype self.dtype = dtype
def __repr__(self): 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 "")
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment