mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-27 04:34:59 +01:00
Add zip().
This commit is contained in:
parent
f7fbbb075a
commit
6debf1e39a
@ -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 = <SassList>[];
|
||||
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",
|
||||
|
@ -795,9 +795,12 @@ class PerformVisitor implements StatementVisitor, ExpressionVisitor<Value> {
|
||||
|
||||
SassArgumentList argumentList;
|
||||
if (overload.restArgument != null) {
|
||||
var rest = positional.length > declaredArguments.length
|
||||
? positional.sublist(declaredArguments.length)
|
||||
: const <Value>[];
|
||||
var rest = const <Value>[];
|
||||
if (positional.length > declaredArguments.length) {
|
||||
rest = positional.sublist(declaredArguments.length);
|
||||
positional.removeRange(declaredArguments.length, positional.length);
|
||||
}
|
||||
|
||||
argumentList = new SassArgumentList(
|
||||
rest,
|
||||
named,
|
||||
|
Loading…
Reference in New Issue
Block a user