parse selectors that grow larger from interpolation
This commit is contained in:
parent
2db3398fe2
commit
2d0a9abb13
@ -285,13 +285,7 @@ impl Selector {
|
|||||||
|
|
||||||
let mut sel_toks = Vec::new();
|
let mut sel_toks = Vec::new();
|
||||||
|
|
||||||
let mut current_pos = 0;
|
sel_toks.extend(string.chars().map(|x| Token::new(span, x)));
|
||||||
sel_toks.extend(string.chars().map(|x| {
|
|
||||||
let len = x.len_utf8() as u64;
|
|
||||||
let tok = Token::new(span.subspan(current_pos, current_pos + len), x);
|
|
||||||
current_pos += len;
|
|
||||||
tok
|
|
||||||
}));
|
|
||||||
|
|
||||||
let mut iter = sel_toks.into_iter().peekmore();
|
let mut iter = sel_toks.into_iter().peekmore();
|
||||||
|
|
||||||
|
@ -512,3 +512,11 @@ test!(
|
|||||||
"\\61 {\n color: red;\n}\n",
|
"\\61 {\n color: red;\n}\n",
|
||||||
"a {\n color: red;\n}\n"
|
"a {\n color: red;\n}\n"
|
||||||
);
|
);
|
||||||
|
/// this checks for a bug in which the selector
|
||||||
|
/// contents get longer as a result of interpolation,
|
||||||
|
/// which interferes with span information.
|
||||||
|
test!(
|
||||||
|
selector_span_gets_larger,
|
||||||
|
"$a: aaaaaaaaaaa;\n\n#{$a} {\n color: foo;\n}\n",
|
||||||
|
"aaaaaaaaaaa {\n color: foo;\n}\n"
|
||||||
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user