interpolation of strings in idents is literal
This commit is contained in:
parent
29886d6845
commit
a6b61082fe
@ -525,9 +525,10 @@ pub(crate) fn eat_ident<I: Iterator<Item = Token>>(
|
|||||||
if kind == &'{' {
|
if kind == &'{' {
|
||||||
toks.next();
|
toks.next();
|
||||||
text.push_str(
|
text.push_str(
|
||||||
&parse_interpolation(toks, scope, super_selector)?
|
&match parse_interpolation(toks, scope, super_selector)?.node {
|
||||||
.node
|
Value::Ident(s, ..) => s,
|
||||||
.to_css_string(span)?,
|
v => v.to_css_string(span)?,
|
||||||
|
},
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return Err(("Expected identifier.", *pos).into());
|
return Err(("Expected identifier.", *pos).into());
|
||||||
|
@ -165,14 +165,10 @@ impl Value {
|
|||||||
let mut buf = String::with_capacity(string.len());
|
let mut buf = String::with_capacity(string.len());
|
||||||
for c in string.chars() {
|
for c in string.chars() {
|
||||||
match c {
|
match c {
|
||||||
// TODO: figure out what is going on here
|
'\n' => {
|
||||||
// This is adapted from the original dart-sass
|
buf.push(' ');
|
||||||
// code, but in the spec tests it seems that
|
after_newline = true;
|
||||||
// newlines are not actually treated like this.
|
}
|
||||||
// '\n' => {
|
|
||||||
// buf.push(' ');
|
|
||||||
// after_newline = true;
|
|
||||||
// }
|
|
||||||
' ' => {
|
' ' => {
|
||||||
if !after_newline {
|
if !after_newline {
|
||||||
buf.push(' ');
|
buf.push(' ');
|
||||||
|
@ -53,3 +53,8 @@ test!(
|
|||||||
"a {\n color: \"#{#{\"\\a\"}}\";\n}\n",
|
"a {\n color: \"#{#{\"\\a\"}}\";\n}\n",
|
||||||
"a {\n color: \"\\a\";\n}\n"
|
"a {\n color: \"\\a\";\n}\n"
|
||||||
);
|
);
|
||||||
|
test!(
|
||||||
|
interpolated_quoted_newline,
|
||||||
|
"a {\n color: #{\"\\a\"};\n}\n",
|
||||||
|
"a {\n color: ;\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user