Skip to content
Snippets Groups Projects
Commit 68d92ee1 authored by Pavel Spirek's avatar Pavel Spirek Committed by Ladislav Lhotka
Browse files

Added '=' operator override methods to InstanceSelector

parent a4886362
No related branches found
No related tags found
No related merge requests found
......@@ -364,6 +364,9 @@ class MemberName(InstanceSelector):
"""Return a string representation of the receiver."""
return "/" + self.name
def __eq__(self, other: "MemberName") -> bool:
return self.name == other.name
def peek_step(self, obj: ObjectValue) -> Value:
"""Return the member of `obj` addressed by the receiver.
......@@ -392,6 +395,9 @@ class EntryIndex(InstanceSelector):
"""Return a string representation of the receiver."""
return "[{0:d}]".format(self.index)
def __eq__(self, other: "EntryIndex") -> bool:
return self.index == other.index
def peek_step(self, arr: ArrayValue) -> Value:
"""Return the entry of `arr` addressed by the receiver.
......@@ -423,6 +429,9 @@ class EntryValue(InstanceSelector):
"""Return a string representation of the receiver."""
return "[.=" + str(self.value) +"]"
def __eq__(self, other: "EntryValue") -> bool:
return self.value == other.value
def peek_step(self, arr: ArrayValue) -> Value:
"""Return the entry of `arr` addressed by the receiver.
......@@ -459,6 +468,9 @@ class EntryKeys(InstanceSelector):
return "".join(["[{}={}]".format(k, repr(self.keys[k]))
for k in self.keys])
def __eq__(self, other: "EntryKeys") -> bool:
return self.keys == other.keys
def peek_step(self, arr: ArrayValue) -> Value:
"""Return the entry of `arr` addressed by the receiver.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment