(self, other: "Storage", out: CWriter)
| 604 | return self.stack.is_flushed() |
| 605 | |
| 606 | def merge(self, other: "Storage", out: CWriter) -> None: |
| 607 | self.sanity_check() |
| 608 | if len(self.inputs) != len(other.inputs): |
| 609 | self.clear_dead_inputs() |
| 610 | other.clear_dead_inputs() |
| 611 | if len(self.inputs) != len(other.inputs) and self.check_liveness: |
| 612 | diff = self.inputs[-1] if len(self.inputs) > len(other.inputs) else other.inputs[-1] |
| 613 | self._print(out) |
| 614 | other._print(out) |
| 615 | raise StackError(f"Unmergeable inputs. Differing state of '{diff.name}'") |
| 616 | for var, other_var in zip(self.inputs, other.inputs): |
| 617 | if var.in_local != other_var.in_local: |
| 618 | raise StackError(f"'{var.name}' is cleared on some paths, but not all") |
| 619 | if len(self.outputs) != len(other.outputs): |
| 620 | self._push_defined_outputs() |
| 621 | other._push_defined_outputs() |
| 622 | if len(self.outputs) != len(other.outputs): |
| 623 | var = self.outputs[0] if len(self.outputs) > len(other.outputs) else other.outputs[0] |
| 624 | raise StackError(f"'{var.name}' is set on some paths, but not all") |
| 625 | for var, other_var in zip(self.outputs, other.outputs): |
| 626 | if var.memory_offset is None: |
| 627 | other_var.memory_offset = None |
| 628 | elif other_var.memory_offset is None: |
| 629 | var.memory_offset = None |
| 630 | self.stack.merge(other.stack, out) |
| 631 | self.sanity_check() |
| 632 | |
| 633 | def push_outputs(self) -> None: |
| 634 | if self.spilled: |
nothing calls this directly
no test coverage detected