Skip to content

Commit 8ae3917

Browse files
committed
Fix some edge case with parent selector evaluation
Fixes #1170
1 parent 66631c0 commit 8ae3917

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

debugger.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ inline void debug_ast(AST_Node* node, string ind = "", Env* env = 0)
264264
cerr << ind << "If " << block;
265265
cerr << " (" << pstate_source_position(node) << ")";
266266
cerr << " " << block->tabs() << endl;
267+
debug_ast(block->predicate(), ind + " = ");
268+
debug_ast(block->consequent(), ind + " <>");
269+
debug_ast(block->alternative(), ind + " ><");
267270
} else if (dynamic_cast<Return*>(node)) {
268271
Return* block = dynamic_cast<Return*>(node);
269272
cerr << ind << "Return " << block;

eval.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,9 +1047,13 @@ namespace Sass {
10471047

10481048
Expression* Eval::operator()(Parent_Selector* p)
10491049
{
1050+
// no idea why both calls are needed
10501051
Selector* s = p->perform(contextualize);
1052+
if (!s) s = p->selector()->perform(contextualize);
10511053
// access to parent selector may return 0
10521054
Selector_List* l = static_cast<Selector_List*>(s);
1055+
// some spec tests cause this (might be a valid case!)
1056+
// if (!s) { cerr << "Parent Selector eval error" << endl; }
10531057
if (!s) { l = new (ctx.mem) Selector_List(p->pstate()); }
10541058
return l->perform(listize);
10551059
}

0 commit comments

Comments
 (0)