set-nth correctly recognizes arglists

This commit is contained in:
Connor Skees 2020-08-16 20:33:53 -04:00
parent c35fa2b8eb
commit 790b0685cb
2 changed files with 16 additions and 0 deletions

View File

@ -81,6 +81,11 @@ pub(crate) fn set_nth(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult
args.max_args(3)?;
let (mut list, sep, brackets) = match args.get_err(0, "list")? {
Value::List(v, sep, b) => (v, sep, b),
Value::ArgList(v) => (
v.into_iter().map(|val| val.node).collect(),
ListSeparator::Comma,
Brackets::None,
),
Value::Map(m) => (m.as_list(), ListSeparator::Comma, Brackets::None),
v => (vec![v], ListSeparator::Space, Brackets::None),
};

View File

@ -91,6 +91,17 @@ test!(
"a {\n color: set-nth((c: d, e: f, g: h), 2, i);\n}\n",
"a {\n color: c d, i, g h;\n}\n"
);
test!(
set_nth_arglist,
"@mixin foo($args...) {
color: set-nth($args, 2, 0);
}
a {
@include foo(1, 2, 3, 4);
}",
"a {\n color: 1, 0, 3, 4;\n}\n"
);
test!(
append_space_separated,
"a {\n color: append(a b, c);\n}\n",