diff --git a/lib/src/functions.dart b/lib/src/functions.dart index 076f1341..33b4d140 100644 --- a/lib/src/functions.dart +++ b/lib/src/functions.dart @@ -588,6 +588,21 @@ void defineCoreFunctions(Environment environment) { return list.changeListContents(newList, separator: separator); }); + environment.defineFunction("zip", r"$lists...", (arguments) { + var lists = (arguments[0] as SassArgumentList) + .contents + .map((list) => list.asList) + .toList(); + var i = 0; + var results = []; + while (lists.every((list) => i != list.length)) { + results + .add(new SassList(lists.map((list) => list[i]), ListSeparator.space)); + i++; + } + return new SassList(results, ListSeparator.comma); + }); + // ## Introspection environment.defineFunction("inspect", r"$value", diff --git a/lib/src/visitor/perform.dart b/lib/src/visitor/perform.dart index f4535260..22d6b547 100644 --- a/lib/src/visitor/perform.dart +++ b/lib/src/visitor/perform.dart @@ -795,9 +795,12 @@ class PerformVisitor implements StatementVisitor, ExpressionVisitor { SassArgumentList argumentList; if (overload.restArgument != null) { - var rest = positional.length > declaredArguments.length - ? positional.sublist(declaredArguments.length) - : const []; + var rest = const []; + if (positional.length > declaredArguments.length) { + rest = positional.sublist(declaredArguments.length); + positional.removeRange(declaredArguments.length, positional.length); + } + argumentList = new SassArgumentList( rest, named,