addition between number and unary ops

This commit is contained in:
ConnorSkees 2020-04-20 02:16:22 -04:00
parent 23390238b9
commit b6cf00c87b
2 changed files with 7 additions and 0 deletions

View File

@ -9,6 +9,8 @@ impl Value {
pub fn add(self, mut other: Self, span: Span) -> SassResult<Self> { pub fn add(self, mut other: Self, span: Span) -> SassResult<Self> {
if let Self::Paren(..) = other { if let Self::Paren(..) = other {
other = other.eval(span)?.node other = other.eval(span)?.node
} else if let Self::UnaryOp(..) = other {
other = other.eval(span)?.node
} }
let precedence = Op::Plus.precedence(); let precedence = Op::Plus.precedence();
Ok(match self { Ok(match self {

View File

@ -263,3 +263,8 @@ test!(
"a {\n color: 1 + false;\n}\n", "a {\n color: 1 + false;\n}\n",
"a {\n color: 1false;\n}\n" "a {\n color: 1false;\n}\n"
); );
test!(
num_plus_unary_not,
"a {\n color: 1 + not 2;\n}\n",
"a {\n color: 1false;\n}\n"
);