Decrease reference count and free object if zero (dec_ref src). The is_xdec flag says to use an XDECREF, which checks if the pointer is NULL first.
| 600 | |
| 601 | @final |
| 602 | class DecRef(RegisterOp): |
| 603 | """Decrease reference count and free object if zero (dec_ref src). |
| 604 | |
| 605 | The is_xdec flag says to use an XDECREF, which checks if the |
| 606 | pointer is NULL first. |
| 607 | """ |
| 608 | |
| 609 | error_kind = ERR_NEVER |
| 610 | |
| 611 | def __init__(self, src: Value, is_xdec: bool = False, line: int = -1) -> None: |
| 612 | assert src.type.is_refcounted |
| 613 | super().__init__(line) |
| 614 | self.src = src |
| 615 | self.is_xdec = is_xdec |
| 616 | |
| 617 | def __repr__(self) -> str: |
| 618 | return "<{}DecRef {!r}>".format("X" if self.is_xdec else "", self.src) |
| 619 | |
| 620 | def sources(self) -> list[Value]: |
| 621 | return [self.src] |
| 622 | |
| 623 | def set_sources(self, new: list[Value]) -> None: |
| 624 | (self.src,) = new |
| 625 | |
| 626 | def accept(self, visitor: OpVisitor[T]) -> T: |
| 627 | return visitor.visit_dec_ref(self) |
| 628 | |
| 629 | |
| 630 | @final |
no outgoing calls
searching dependent graphs…