mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 08:26:22 +02:00
Add additional assignment operators (#7102)
This commit is contained in:
@ -4420,6 +4420,10 @@ pub fn parse_operator(
|
||||
|
||||
let operator = match contents {
|
||||
b"=" => Operator::Assignment(Assignment::Assign),
|
||||
b"+=" => Operator::Assignment(Assignment::PlusAssign),
|
||||
b"-=" => Operator::Assignment(Assignment::MinusAssign),
|
||||
b"*=" => Operator::Assignment(Assignment::MultiplyAssign),
|
||||
b"/=" => Operator::Assignment(Assignment::DivideAssign),
|
||||
b"==" => Operator::Comparison(Comparison::Equal),
|
||||
b"!=" => Operator::Comparison(Comparison::NotEqual),
|
||||
b"<" => Operator::Comparison(Comparison::LessThan),
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::ParseError;
|
||||
use nu_protocol::{
|
||||
ast::{Assignment, Bits, Boolean, Comparison, Expr, Expression, Math, Operator},
|
||||
ast::{Bits, Boolean, Comparison, Expr, Expression, Math, Operator},
|
||||
engine::StateWorkingSet,
|
||||
Type,
|
||||
};
|
||||
@ -555,7 +555,7 @@ pub fn math_result_type(
|
||||
)
|
||||
}
|
||||
},
|
||||
Operator::Assignment(Assignment::Assign) => match (&lhs.ty, &rhs.ty) {
|
||||
Operator::Assignment(_) => match (&lhs.ty, &rhs.ty) {
|
||||
(x, y) if x == y => (Type::Nothing, None),
|
||||
(Type::Any, _) => (Type::Nothing, None),
|
||||
(_, Type::Any) => (Type::Nothing, None),
|
||||
|
Reference in New Issue
Block a user