Fix short-circuiting operators (SQUASH)
This commit is contained in:
parent
ac6eacd80b
commit
b8658816b4
1 changed files with 2 additions and 2 deletions
|
|
@ -136,7 +136,7 @@ namespace pslang::ir
|
||||||
|
|
||||||
if (node.type == ast::binary_operation_type::logical_and)
|
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();
|
auto result = last();
|
||||||
mcontext.nodes->emplace_back(jump_if_zero{result});
|
mcontext.nodes->emplace_back(jump_if_zero{result});
|
||||||
auto jump = last();
|
auto jump = last();
|
||||||
|
|
@ -150,7 +150,7 @@ namespace pslang::ir
|
||||||
|
|
||||||
if (node.type == ast::binary_operation_type::logical_or)
|
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();
|
auto result = last();
|
||||||
mcontext.nodes->emplace_back(unary_operation{ast::unary_operation_type::logical_not, result}, node.inferred_type);
|
mcontext.nodes->emplace_back(unary_operation{ast::unary_operation_type::logical_not, result}, node.inferred_type);
|
||||||
mcontext.nodes->emplace_back(jump_if_zero{last()});
|
mcontext.nodes->emplace_back(jump_if_zero{last()});
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue