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,14 +722,16 @@ impl Value {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
'#' => {
|
'#' => {
|
||||||
if let Ok(s) = Self::ident(toks, scope, super_selector) {
|
if let Some(Token { kind: '{', .. }) = toks.peek_forward(1) {
|
||||||
s
|
toks.reset_view();
|
||||||
} else {
|
return Some(Self::ident(toks, scope, super_selector));
|
||||||
IntermediateValue::Value(match parse_hex(toks, scope, super_selector, span) {
|
|
||||||
Ok(v) => v,
|
|
||||||
Err(e) => return Some(Err(e)),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
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 @ '\'' => {
|
q @ '"' | q @ '\'' => {
|
||||||
let span_start = toks.next().unwrap().pos();
|
let span_start = toks.next().unwrap().pos();
|
||||||
|
@ -73,3 +73,7 @@ test!(
|
|||||||
"$f: foo;\na {\n color: #{$f}(a, 1+2, c);\n}\n",
|
"$f: foo;\na {\n color: #{$f}(a, 1+2, c);\n}\n",
|
||||||
"a {\n color: foo(a, 3, 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