Remove everything to do with Hashing

I forgot to remove this during the previous commit
This commit is contained in:
germax26 2024-08-12 00:05:01 +10:00
parent 238980d602
commit 1efac4b8e5
Signed by: germax26
SSH Key Fingerprint: SHA256:N3w+8798IMWBt7SYH8G1C0iJlIa2HIIcRCXwILT5FvM
2 changed files with 0 additions and 45 deletions

View File

@ -11,9 +11,6 @@ class Object(ABC):
@abstractmethod @abstractmethod
def get_type(self) -> Type: ... def get_type(self) -> Type: ...
def hash(self) -> 'Hashable':
assert False, f"{self.get_type().represent()} cannot be hashed."
@dataclass @dataclass
class Int(Object): class Int(Object):
num: int num: int
@ -26,9 +23,6 @@ class Str(Object):
def get_type(self) -> Type: return StrType def get_type(self) -> Type: return StrType
def hash(self) -> 'HStr':
return HStr(self.str)
@dataclass @dataclass
class Bool(Object): class Bool(Object):
value: bool value: bool
@ -89,45 +83,9 @@ class EnumValue(Object):
def get_type(self) -> Type: return self.type def get_type(self) -> Type: return self.type
def hash(self) -> 'HEnumValue':
return HEnumValue(self.type, self.name, [value.hash() for value in self.values])
@dataclass @dataclass
class Struct(Object): class Struct(Object):
type: StructType type: StructType
fields: Dict[str, Object] fields: Dict[str, Object]
def get_type(self) -> Type: return self.type def get_type(self) -> Type: return self.type
class Hashable(ABC):
@abstractmethod
def __hash__(self) -> int: ...
@abstractmethod
def get_object(self) -> Object: ...
@dataclass
class HInt(Hashable):
num: int
@dataclass
class HStr(Hashable):
str: str
def __hash__(self) -> int:
return hash(('object', 'str', self.str))
def get_object(self) -> Object:
return Str(self.str)
@dataclass
class HEnumValue(Hashable):
type: EnumType
name: str
values: List_[Hashable]
def __hash__(self) -> int:
return hash(('object', 'enum', self.type, self.name, tuple(self.values)))
def get_object(self) -> Object:
return EnumValue(self.type, self.name, [value.get_object() for value in self.values])

View File

@ -227,9 +227,6 @@ class EnumType(Type):
is_new = is_new or is_new_member is_new = is_new or is_new_member
return (is_new, EnumType(self.name, new_members, self.generics) if is_new else self) return (is_new, EnumType(self.name, new_members, self.generics) if is_new else self)
def __hash__(self) -> int:
return hash(('type', 'enum', self.name, tuple([(member, tuple(self.members[member])) for member in self.members]), tuple(self.generics)))
@dataclass @dataclass
class StructType(Type): class StructType(Type):
name: str name: str