From b8658816b4667c1ad71e3f60c7f8f3195c419a88 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Mon, 30 Mar 2026 20:29:25 +0300 Subject: [PATCH] Fix short-circuiting operators (SQUASH) --- libs/ir/source/compiler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/ir/source/compiler.cpp b/libs/ir/source/compiler.cpp index 6daf306..4b77e15 100644 --- a/libs/ir/source/compiler.cpp +++ b/libs/ir/source/compiler.cpp @@ -136,7 +136,7 @@ namespace pslang::ir if (node.type == ast::binary_operation_type::logical_and) { - mcontext.nodes->emplace_back(copy{arg1}); + mcontext.nodes->emplace_back(copy{arg1}, ast::get_type(*node.arg1)); auto result = last(); mcontext.nodes->emplace_back(jump_if_zero{result}); auto jump = last(); @@ -150,7 +150,7 @@ namespace pslang::ir if (node.type == ast::binary_operation_type::logical_or) { - mcontext.nodes->emplace_back(copy{arg1}); + mcontext.nodes->emplace_back(copy{arg1}, ast::get_type(*node.arg1)); auto result = last(); mcontext.nodes->emplace_back(unary_operation{ast::unary_operation_type::logical_not, result}, node.inferred_type); mcontext.nodes->emplace_back(jump_if_zero{last()});