Skip to content

Commit 53a9a0f

Browse files
committed
Error when mixin ruleset in root has parent selector
1 parent acd2b40 commit 53a9a0f

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;
@@ -741,8 +741,14 @@ namespace Sass {
741741
Trace_Obj trace = SASS_MEMORY_NEW(Trace, c->pstate(), c->name(), trace_block);
742742

743743
env->set_global("is_in_mixin", bool_true);
744+
if (Block_Ptr pr = block_stack.back()) {
745+
trace_block->is_root(pr->is_root());
746+
}
744747
block_stack.push_back(trace_block);
745748
for (auto bb : body->elements()) {
749+
if (Ruleset_Ptr r = Cast<Ruleset>(bb)) {
750+
r->is_root(trace_block->is_root());
751+
}
746752
Statement_Obj ith = bb->perform(this);
747753
if (ith) trace->block()->append(ith);
748754
}

0 commit comments

Comments
 (0)