Skip to content

Commit

Permalink
Merge pull request #835 from xzyfer/feat/remove-compact
Browse files Browse the repository at this point in the history
Remove the non-standard compact function
  • Loading branch information
xzyfer committed Feb 16, 2015
2 parents c0a015b + 3372964 commit 003d3dc
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1233,25 +1233,8 @@ namespace Sass {
Signature compact_sig = "compact($values...)";
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);
if (!arglist) {
List* result = new (ctx.mem) List(pstate, 1, List::COMMA);
*result << the_arg;
return result;
}
sep = arglist->separator();
}
List* result = new (ctx.mem) List(pstate, 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;
*result << arglist->value_at_index(i);
}
return result;
error("`compact` has been removed from libsass because it's not part of the Sass spec", pstate);
return 0;
}

Signature list_separator_sig = "list_separator($list)";
Expand Down

0 comments on commit 003d3dc

Please sign in to comment.