🐐 Negation

This commit is contained in:
2026-03-31 22:02:22 +02:00
parent 4aac6b4c2c
commit cdad648f58
3 changed files with 23 additions and 2 deletions

View File

@@ -330,6 +330,18 @@ class BinOp(Node):
raise Exception(self.op)
class UnaryMinus(Node):
def __init__(self, expr):
self.expr = expr
def __repr__(self):
return f"UnaryMinus({self.expr!r})"
def _eval(self, vtable):
vtable, val = self.expr.eval(vtable)
return vtable, ValInt(-val.value())
class SiStatement(Node):
def __init__(self, test, statements, else_part) -> None:
self.test = test