Skip to content

Commit

Permalink
Fix sass function bug with restargs and nested arglists
Browse files Browse the repository at this point in the history
Fixes sass#1171
  • Loading branch information
mgreter committed Sep 4, 2015
1 parent 9b07cbd commit 5629489
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions src/bind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,33 @@ namespace Sass {
List* ls = dynamic_cast<List*>(a->value());
// skip any list completely if empty
if (ls && ls->empty()) continue;
// check if we have rest argument
(*arglist) << SASS_MEMORY_NEW(ctx.mem, Argument,
a->pstate(),
a->value(),
a->name(),
false,
false);
// flatten all nested arglists
if (ls && ls->is_arglist()) {
for (size_t i = 0, L = ls->size(); i < L; ++i) {
// already have a wrapped argument
if (Argument* arg = dynamic_cast<Argument*>((*ls)[i])) {
(*arglist) << SASS_MEMORY_NEW(ctx.mem, Argument, *arg);
}
// have some other value type
else {
(*arglist) << SASS_MEMORY_NEW(ctx.mem, Argument,
(*ls)[i]->pstate(),
(*ls)[i],
"",
false,
false);
}
}
}
else {
// check if we have rest argument
(*arglist) << SASS_MEMORY_NEW(ctx.mem, Argument,
a->pstate(),
a->value(),
a->name(),
false,
false);
}
// check if we have rest argument
if (a->is_rest_argument()) {
// preserve the list separator from rest args
Expand Down

0 comments on commit 5629489

Please sign in to comment.