error(item.key.pos, "Invalid struct field identifier")
item.key = IdentifierStringNode(item.key.pos, value="<error>")
else:
- member = dst_type.scope.lookup_here(item.key.value)
+ key = str(item.key.value) # converts string literals to unicode in Py3
+ member = dst_type.scope.lookup_here(key)
if not member:
- error(item.key.pos, "struct '%s' has no field '%s'" % (dst_type, item.key.value))
+ error(item.key.pos, "struct '%s' has no field '%s'" % (dst_type, key))
else:
value = item.value
if isinstance(value, CoerceToPyTypeNode):
def __eq__(self, other):
try:
- return self.name == other.name
+ return (isinstance(other, CStructOrUnionType) and
+ self.name == other.name)
except AttributeError:
return False
# *some* kind of order
return False
+ def __hash__(self):
+ try:
+ return self.__hashval
+ except AttributeError:
+ hashval = self.__hashval = hash(self.cname) ^ (sum([
+ hash(field.name) for field in self.scope.var_entries]) % 0xffff)
+ return hashval
+
def is_complete(self):
return self.scope is not None