fixed bug with overloaded operators not discarding ignored return values
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 19 Apr 2021 17:51:37 +0000 (12:51 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 19 Apr 2021 17:51:37 +0000 (12:51 -0500)
bin/onyx
src/onyxchecker.c

index c7d579b5b06ced6b2e0f836ae578b5c7911d6af0..084335c70c369ccb3bef3e0f215c66972f7617d2 100755 (executable)
Binary files a/bin/onyx and b/bin/onyx differ
index 7e5bdaf46975bd8c451f2e99cc8dc3b096d9edb0..3a401869c819d7cbc2c51d15c67a7c8a485d6095 100644 (file)
@@ -1464,8 +1464,9 @@ CheckStatus check_statement(AstNode** pstmt) {
         case Ast_Kind_Defer:      return check_statement(&((AstDefer *) stmt)->stmt);
 
         case Ast_Kind_Binary_Op:
-            stmt->flags |= Ast_Flag_Expr_Ignored;
-            return check_binaryop((AstBinaryOp **) pstmt, 1);
+            CHECK(binaryop, (AstBinaryOp **) pstmt, 1);
+            (*pstmt)->flags |= Ast_Flag_Expr_Ignored;
+            return Check_Success;
 
         // NOTE: Local variable declarations used to be removed after the symbol
         // resolution phase because long long ago, all locals needed to be known
@@ -1475,8 +1476,9 @@ CheckStatus check_statement(AstNode** pstmt) {
         case Ast_Kind_Local: return Check_Success;
 
         default:
-            stmt->flags |= Ast_Flag_Expr_Ignored;
-            return check_expression((AstTyped **) pstmt);
+            CHECK(expression, (AstTyped **) pstmt);
+            (*pstmt)->flags |= Ast_Flag_Expr_Ignored;
+            return Check_Success;
     }
 }