From: Brendan Hansen Date: Sun, 10 Jan 2021 16:20:59 +0000 (-0600) Subject: bug fix with invalid binary operator in modify-assignment X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=43e38c44e6753ecb81afd31bdfde1c877c5c64a4;p=onyx.git bug fix with invalid binary operator in modify-assignment --- diff --git a/bin/onyx b/bin/onyx index 3e082051..d037de2b 100755 Binary files a/bin/onyx and b/bin/onyx differ diff --git a/onyx.exe b/onyx.exe index 705afc12..e5ff0df1 100644 Binary files a/onyx.exe and b/onyx.exe differ diff --git a/src/onyxchecker.c b/src/onyxchecker.c index 104f089d..cd0147ca 100644 --- a/src/onyxchecker.c +++ b/src/onyxchecker.c @@ -594,7 +594,6 @@ CheckStatus check_binop_assignment(AstBinaryOp* binop, b32 assignment_is_ok) { binop_node->token = binop->token; binop_node->left = binop->left; binop_node->right = binop->right; - binop_node->type = binop->right->type; if (binop->operation == Binary_Op_Assign_Add) binop_node->operation = Binary_Op_Add; else if (binop->operation == Binary_Op_Assign_Minus) binop_node->operation = Binary_Op_Minus; @@ -608,10 +607,10 @@ CheckStatus check_binop_assignment(AstBinaryOp* binop, b32 assignment_is_ok) { else if (binop->operation == Binary_Op_Assign_Shr) binop_node->operation = Binary_Op_Shr; else if (binop->operation == Binary_Op_Assign_Sar) binop_node->operation = Binary_Op_Sar; + CHECK(binaryop, &binop_node, 0); + binop->right = (AstTyped *) binop_node; binop->operation = Binary_Op_Assign; - - CHECK(binaryop, &binop_node, 0); } if (!type_check_or_auto_cast(&binop->right, binop->left->type)) {