fix: add tkAssign and compound assignment operators to C codegen

- Map tkAssign to '=' in operatorToC
- Add tkAmpAssign, tkPipeAssign, tkCaretAssign, tkShlAssign, tkShrAssign
- Fibonacci program now works correctly with while loops and assignment
This commit is contained in:
2026-05-30 23:02:33 +03:00
parent 782aaa729d
commit bbb7e60042
+6
View File
@@ -110,11 +110,17 @@ proc operatorToC(op: TokenKind): string =
of tkTilde: return "~"
of tkPlusPlus: return "++"
of tkMinusMinus: return "--"
of tkAssign: return "="
of tkPlusAssign: return "+="
of tkMinusAssign: return "-="
of tkStarAssign: return "*="
of tkSlashAssign: return "/="
of tkPercentAssign: return "%="
of tkAmpAssign: return "&="
of tkPipeAssign: return "|="
of tkCaretAssign: return "^="
of tkShlAssign: return "<<="
of tkShrAssign: return ">>="
else: return "?"
# Forward declaration