remove unwrap in Value::is_null

This commit is contained in:
ConnorSkees 2020-05-24 16:41:09 -04:00
parent 3c129780d0
commit d90d998ccd
2 changed files with 10 additions and 1 deletions

View File

@ -116,7 +116,12 @@ impl Value {
self.clone().eval(span)?.is_null(span)?
}
Self::List(v, _, Brackets::Bracketed) if v.is_empty() => false,
Self::List(v, ..) => v.iter().all(|f| f.is_null(span).unwrap()),
Self::List(v, ..) => v
.iter()
.map(|f| Ok(f.is_null(span)?))
.collect::<SassResult<Vec<bool>>>()?
.into_iter()
.all(|f| f),
_ => false,
})
}

View File

@ -230,3 +230,7 @@ error!(
"a {color: \"", "Error: Expected \"."
);
error!(nothing_after_sgl_quote, "a {color: '", "Error: Expected '.");
error!(
invalid_binop_in_list,
"a {color: foo % bar, baz;}", "Error: Undefined operation \"foo % bar\"."
);