Skip to content

Commit 57c5da5

Browse files
authored
Merge pull request #2532 from mgreter/bugfix/root-mixin-with-parent-error
Error when mixin ruleset in root has parent selector
2 parents 3336e9a + 53a9a0f commit 57c5da5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/expand.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ namespace Sass {
117117
if (sel) sel = sel->eval(eval);
118118

119119
// check for parent selectors in base level rules
120-
if (r->is_root()) {
120+
if (r->is_root() || (block_stack.back() && block_stack.back()->is_root())) {
121121
if (Selector_List_Ptr selector_list = Cast<Selector_List>(r->selector())) {
122122
for (Complex_Selector_Obj complex_selector : selector_list->elements()) {
123123
Complex_Selector_Ptr tail = complex_selector;
@@ -743,8 +743,14 @@ namespace Sass {
743743
Trace_Obj trace = SASS_MEMORY_NEW(Trace, c->pstate(), c->name(), trace_block);
744744

745745
env->set_global("is_in_mixin", bool_true);
746+
if (Block_Ptr pr = block_stack.back()) {
747+
trace_block->is_root(pr->is_root());
748+
}
746749
block_stack.push_back(trace_block);
747750
for (auto bb : body->elements()) {
751+
if (Ruleset_Ptr r = Cast<Ruleset>(bb)) {
752+
r->is_root(trace_block->is_root());
753+
}
748754
Statement_Obj ith = bb->perform(this);
749755
if (ith) trace->block()->append(ith);
750756
}

0 commit comments

Comments
 (0)