Add unary not (#5111)

This commit is contained in:
JT
2022-04-07 07:10:25 +12:00
committed by GitHub
parent 12d3e4e424
commit 591fb4bd36
8 changed files with 115 additions and 1 deletions

View File

@ -113,6 +113,7 @@ impl Expression {
Expr::BinaryOp(left, _, right) => {
left.has_in_variable(working_set) || right.has_in_variable(working_set)
}
Expr::UnaryNot(expr) => expr.has_in_variable(working_set),
Expr::Block(block_id) => {
let block = working_set.get_block(*block_id);
@ -264,6 +265,9 @@ impl Expression {
left.replace_in_variable(working_set, new_var_id);
right.replace_in_variable(working_set, new_var_id);
}
Expr::UnaryNot(expr) => {
expr.replace_in_variable(working_set, new_var_id);
}
Expr::Block(block_id) => {
let block = working_set.get_block(*block_id);
@ -425,6 +429,9 @@ impl Expression {
left.replace_span(working_set, replaced, new_span);
right.replace_span(working_set, replaced, new_span);
}
Expr::UnaryNot(expr) => {
expr.replace_span(working_set, replaced, new_span);
}
Expr::Block(block_id) => {
let mut block = working_set.get_block(*block_id).clone();