handle edge case of single list containing map used in @each
This commit is contained in:
parent
aa8f120824
commit
7c320ae9a2
@ -911,14 +911,13 @@ impl<'a> Parser<'a> {
|
||||
let mut stmts = Vec::new();
|
||||
|
||||
for row in iter {
|
||||
let this_iterator = row.as_list();
|
||||
|
||||
let this_iterator = row.clone().as_list();
|
||||
if vars.len() == 1 {
|
||||
if this_iterator.len() == 1 {
|
||||
self.scopes.last_mut().insert_var(
|
||||
&vars[0].node,
|
||||
Spanned {
|
||||
node: this_iterator[0].clone(),
|
||||
node: row,
|
||||
span: vars[0].span,
|
||||
},
|
||||
);
|
||||
@ -932,7 +931,7 @@ impl<'a> Parser<'a> {
|
||||
);
|
||||
}
|
||||
} else {
|
||||
for (var, val) in vars.clone().into_iter().zip(
|
||||
for (var, val) in vars.iter().zip(
|
||||
this_iterator
|
||||
.into_iter()
|
||||
.chain(std::iter::once(Value::Null).cycle()),
|
||||
|
@ -48,6 +48,15 @@ test!(
|
||||
"a {\n @each $i in 1 2 3 {\n color: type-of($i);\n }\n}\n",
|
||||
"a {\n color: number;\n color: number;\n color: number;\n}\n"
|
||||
);
|
||||
error!(
|
||||
list_of_single_map,
|
||||
"a {
|
||||
@each $a in [(a: b)] {
|
||||
color: $a;
|
||||
}
|
||||
}",
|
||||
"Error: (a: b) isn't a valid CSS value."
|
||||
);
|
||||
error!(
|
||||
missing_closing_curly_brace,
|
||||
"@each $i in 1 {", "Error: expected \"}\"."
|
||||
|
Loading…
x
Reference in New Issue
Block a user