hyc

Hydrogen Compiler written in C
git clone git://git.kocotian.pl/hyc.git
Log | Files | Refs | README | LICENSE

commit eb52f35653b6c08bd84c110810925a6043cdf988
parent c99315862babaefef24b9cc5254a4573d6b4f2bf
Author: kocotian <kocotian@kocotian.pl>
Date:   Sun,  1 Aug 2021 22:25:16 +0000

Pre{in,de}crementation

Diffstat:
Mtarget/x86_64-linux.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/target/x86_64-linux.c b/target/x86_64-linux.c @@ -262,11 +262,17 @@ compileExpressionUnaryValuefrom(Compiler *compiler, ASTExpressionUnary expr, int static void compileExpressionUnaryPreincrement(Compiler *compiler, ASTExpressionUnary expr, int lvalue) { + if (lvalue) die("Incrementation operation will not give lvalue"); /* TODO: error() */ + compileExpression(compiler, expr.expr, 1); + asmTextAppend(compiler, "\tadd QWORD [r15], 1"); } static void compileExpressionUnaryPredecrement(Compiler *compiler, ASTExpressionUnary expr, int lvalue) { + if (lvalue) die("Decrementation operation will not give lvalue"); /* TODO: error() */ + compileExpression(compiler, expr.expr, 1); + asmTextAppend(compiler, "\tsub QWORD [r15], 1"); } static char *