Skip to content

Commit

Permalink
Merge pull request #310 from utkarshkukreti/fix-separator-in-append-a…
Browse files Browse the repository at this point in the history
…nd-compact

Fix separator in append() and compact()
  • Loading branch information
Aaron Leung committed Mar 4, 2014
2 parents 236f1ad + dfb2287 commit 1122ead
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ namespace Sass {
l = new (ctx.mem) List(path, position, 1);
*l << ARG("$list", Expression);
}
List* result = new (ctx.mem) List(path, position, l->length() + 1);
List* result = new (ctx.mem) List(path, position, l->length() + 1, l->separator());
string sep_str(unquote(sep->value()));
if (sep_str == "space") result->separator(List::SPACE);
else if (sep_str == "comma") result->separator(List::COMMA);
Expand Down Expand Up @@ -898,6 +898,7 @@ namespace Sass {
BUILT_IN(compact)
{
List* arglist = ARG("$values", List);
List::Separator sep = List::COMMA;
if (arglist->length() == 1) {
Expression* the_arg = arglist->value_at_index(0);
arglist = dynamic_cast<List*>(the_arg);
Expand All @@ -906,8 +907,9 @@ namespace Sass {
*result << the_arg;
return result;
}
sep = arglist->separator();
}
List* result = new (ctx.mem) List(path, position, 0, List::COMMA);
List* result = new (ctx.mem) List(path, position, 0, sep);
for (size_t i = 0, L = arglist->length(); i < L; ++i) {
Boolean* ith = dynamic_cast<Boolean*>(arglist->value_at_index(i));
if (ith && ith->value() == false) continue;
Expand Down

0 comments on commit 1122ead

Please sign in to comment.