emit proper error for map as lhs of addition
This commit is contained in:
parent
368f0cf596
commit
80e32b4290
@ -256,7 +256,14 @@ impl Value {
|
||||
}
|
||||
let precedence = Op::Plus.precedence();
|
||||
Ok(match self {
|
||||
Self::Function(..) | Self::ArgList(..) | Self::Map(..) => todo!(),
|
||||
Self::Map(..) => {
|
||||
return Err((
|
||||
format!("{} isn't a valid CSS value.", self.inspect(span)?),
|
||||
span,
|
||||
)
|
||||
.into())
|
||||
}
|
||||
Self::Function(..) | Self::ArgList(..) => todo!(),
|
||||
Self::Important | Self::True | Self::False => match other {
|
||||
Self::String(s, QuoteKind::Quoted) => Value::String(
|
||||
format!("{}{}", self.to_css_string(span)?, s),
|
||||
|
@ -124,7 +124,10 @@ error!(
|
||||
);
|
||||
error!(toplevel_hash, "#", "Error: expected \"{\".");
|
||||
error!(toplevel_at, "@", "Error: Expected identifier.");
|
||||
error!(toplevel_ampersand, "& {}", "Error: Top-level selectors may not contain the parent selector \"&\".");
|
||||
error!(
|
||||
toplevel_ampersand,
|
||||
"& {}", "Error: Top-level selectors may not contain the parent selector \"&\"."
|
||||
);
|
||||
error!(toplevel_backslash, "\\", "Error: expected \"}\".");
|
||||
error!(toplevel_var_no_colon, "$r", "Error: expected \":\".");
|
||||
error!(bar_in_value, "a {color: a|b;}", "Error: expected \";\".");
|
||||
@ -164,3 +167,7 @@ error!(
|
||||
operator_mul,
|
||||
"a {color: 5 - *;}", "Error: Expected expression."
|
||||
);
|
||||
error!(
|
||||
map_lhs_add,
|
||||
"a {color: (a: b) + 1;}", "Error: (a: b) isn't a valid CSS value."
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user