Set the value of a struct element. This evaluates to a new struct with the changed value. Use together with Undef to initialize a fresh struct value (see Undef for more details).
| 1751 | |
| 1752 | @final |
| 1753 | class SetElement(RegisterOp): |
| 1754 | """Set the value of a struct element. |
| 1755 | |
| 1756 | This evaluates to a new struct with the changed value. |
| 1757 | |
| 1758 | Use together with Undef to initialize a fresh struct value |
| 1759 | (see Undef for more details). |
| 1760 | """ |
| 1761 | |
| 1762 | error_kind = ERR_NEVER |
| 1763 | |
| 1764 | def __init__(self, src: Value, field: str, item: Value, line: int = -1) -> None: |
| 1765 | super().__init__(line) |
| 1766 | assert isinstance(src.type, (RStruct, RVec)), src.type |
| 1767 | self.type = src.type |
| 1768 | self.src = src |
| 1769 | self.item = item |
| 1770 | self.field = field |
| 1771 | |
| 1772 | def sources(self) -> list[Value]: |
| 1773 | return [self.src] |
| 1774 | |
| 1775 | def set_sources(self, new: list[Value]) -> None: |
| 1776 | (self.src,) = new |
| 1777 | |
| 1778 | def stolen(self) -> list[Value]: |
| 1779 | return [self.src] |
| 1780 | |
| 1781 | def accept(self, visitor: OpVisitor[T]) -> T: |
| 1782 | return visitor.visit_set_element(self) |
| 1783 | |
| 1784 | |
| 1785 | @final |
no outgoing calls
searching dependent graphs…