mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 17:25:15 +02:00
Add unary not (#5111)
This commit is contained in:
@ -22,6 +22,7 @@ pub enum Expr {
|
||||
ExternalCall(Box<Expression>, Vec<Expression>),
|
||||
Operator(Operator),
|
||||
RowCondition(BlockId),
|
||||
UnaryNot(Box<Expression>),
|
||||
BinaryOp(Box<Expression>, Box<Expression>, Box<Expression>), //lhs, op, rhs
|
||||
Subexpression(BlockId),
|
||||
Block(BlockId),
|
||||
|
@ -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();
|
||||
|
||||
|
Reference in New Issue
Block a user