Skip to content

Commit

Permalink
Merge pull request #1837 from mgreter/bugfix/each-parent-selector-list
Browse files Browse the repository at this point in the history
Fix iterating over parent selector list with `@each`
  • Loading branch information
mgreter committed Jan 9, 2016
2 parents a227315 + 490cd67 commit 92ddab3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ namespace Sass {
Expression* expr = e->list()->perform(this);
Env env(environment(), true);
exp.env_stack.push_back(&env);
List* list = 0;
Vectorized<Expression*>* list = 0;
Map* map = 0;
if (expr->concrete_type() == Expression::MAP) {
map = static_cast<Map*>(expr);
Expand Down Expand Up @@ -252,6 +252,9 @@ namespace Sass {
}
}
else {
if (list->length() == 1 && dynamic_cast<Selector_List*>(list)) {
list = dynamic_cast<Vectorized<Expression*>*>(list);
}
for (size_t i = 0, L = list->length(); i < L; ++i) {
Expression* e = (*list)[i];
// unwrap value if the expression is an argument
Expand Down
5 changes: 4 additions & 1 deletion src/expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ namespace Sass {
{
std::vector<std::string> variables(e->variables());
Expression* expr = e->list()->perform(&eval);
List* list = 0;
Vectorized<Expression*>* list = 0;
Map* map = 0;
if (expr->concrete_type() == Expression::MAP) {
map = static_cast<Map*>(expr);
Expand Down Expand Up @@ -478,6 +478,9 @@ namespace Sass {
}
else {
// bool arglist = list->is_arglist();
if (list->length() == 1 && dynamic_cast<Selector_List*>(list)) {
list = dynamic_cast<Vectorized<Expression*>*>(list);
}
for (size_t i = 0, L = list->length(); i < L; ++i) {
Expression* e = (*list)[i];
// unwrap value if the expression is an argument
Expand Down

0 comments on commit 92ddab3

Please sign in to comment.