error messages for values beginnning with #
prior to this commit, error messages that occurred within idents beginning with interpolation would be swallowed by error messages for hex (largely, "Expected identifier.")
This commit is contained in:
parent
f3e7abdaba
commit
697ff3d12f
@ -722,15 +722,17 @@ impl Value {
|
||||
})
|
||||
}
|
||||
'#' => {
|
||||
if let Ok(s) = Self::ident(toks, scope, super_selector) {
|
||||
s
|
||||
} else {
|
||||
if let Some(Token { kind: '{', .. }) = toks.peek_forward(1) {
|
||||
toks.reset_view();
|
||||
return Some(Self::ident(toks, scope, super_selector));
|
||||
}
|
||||
toks.reset_view();
|
||||
toks.next();
|
||||
IntermediateValue::Value(match parse_hex(toks, scope, super_selector, span) {
|
||||
Ok(v) => v,
|
||||
Err(e) => return Some(Err(e)),
|
||||
})
|
||||
}
|
||||
}
|
||||
q @ '"' | q @ '\'' => {
|
||||
let span_start = toks.next().unwrap().pos();
|
||||
let Spanned { node, span } =
|
||||
|
@ -73,3 +73,7 @@ test!(
|
||||
"$f: foo;\na {\n color: #{$f}(a, 1+2, c);\n}\n",
|
||||
"a {\n color: foo(a, 3, c);\n}\n"
|
||||
);
|
||||
error!(
|
||||
error_message_when_at_start_of_value,
|
||||
"a {\n color: #{2px*5px};\n}\n", "Error: 10px*px isn't a valid CSS value."
|
||||
);
|
||||
|
Loading…
x
Reference in New Issue
Block a user