diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 504161d..1d1200c 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -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()), diff --git a/tests/each.rs b/tests/each.rs index aa406c7..51511dd 100644 --- a/tests/each.rs +++ b/tests/each.rs @@ -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 \"}\"."