Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
blacken stack.py
  • Loading branch information
markshannon committed Aug 8, 2024
commit d331371fa404a1a9989e22d3cf7edad87a0c1570
21 changes: 10 additions & 11 deletions Tools/cases_generator/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,16 @@ def condition(self) -> str | None:
def is_array(self) -> bool:
return self.item.is_array()


return Local(self.item, self.cached, self.in_memory, self.defined)

def __eq__(self, other: object) -> bool:
if not isinstance(other, Local):
return NotImplemented
return (
self.item is other.item and
self.cached is other.cached and
self.in_memory is other.in_memory and
self.defined is other.defined
self.item is other.item
and self.cached is other.cached
and self.in_memory is other.in_memory
and self.defined is other.defined
)


Expand Down Expand Up @@ -178,12 +177,12 @@ def __eq__(self, other: object) -> bool:
return NotImplemented
return self.to_c() == other.to_c()


class StackError(Exception):
pass


class Stack:

def __init__(self) -> None:
self.top_offset = StackOffset.empty()
self.base_offset = StackOffset.empty()
Expand Down Expand Up @@ -366,18 +365,18 @@ def copy(self) -> Stack:
other = Stack()
other.top_offset = self.top_offset.copy()
other.base_offset = self.base_offset.copy()
other.variables = [ var.copy() for var in self.variables ]
other.variables = [var.copy() for var in self.variables]
other.defined = set(self.defined)
return other

def __eq__(self, other: object) -> bool:
if not isinstance(other, Stack):
return NotImplemented
return (
self.top_offset == other.top_offset and
self.base_offset == other.base_offset and
self.variables == other.variables and
self.defined == other.defined
self.top_offset == other.top_offset
and self.base_offset == other.base_offset
and self.variables == other.variables
and self.defined == other.defined
)


Expand Down