Skip to content

Commit

Permalink
Merge pull request #1608 from mgreter/bugfix/issue_1584
Browse files Browse the repository at this point in the history
Improve at-root handling with mixins
  • Loading branch information
mgreter committed Oct 19, 2015
2 parents cba7bdc + 2874410 commit 1e3ee36
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/ast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2118,7 +2118,10 @@ namespace Sass {
Compound_Selector* h = 0,
Complex_Selector* t = 0,
String* r = 0)
: Selector(pstate), combinator_(c), head_(h), tail_(t), reference_(r)
: Selector(pstate),
combinator_(c),
head_(h), tail_(t),
reference_(r)
{
if ((h && h->has_reference()) || (t && t->has_reference())) has_reference(true);
if ((h && h->has_placeholder()) || (t && t->has_placeholder())) has_placeholder(true);
Expand Down
3 changes: 2 additions & 1 deletion src/debugger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ inline void debug_ast(AST_Node* node, std::string ind, Env* env)
std::cerr << " (" << pstate_source_position(node) << ")";
std::cerr << " " << root_block->tabs();
std::cerr << std::endl;
if (root_block->block()) for(auto i : root_block->block()->elements()) { debug_ast(i, ind + " ", env); }
debug_ast(root_block->expression(), ind + ":", env);
debug_ast(root_block->block(), ind + " ", env);
} else if (dynamic_cast<Selector_List*>(node)) {
Selector_List* selector = dynamic_cast<Selector_List*>(node);
std::cerr << ind << "Selector_List " << selector;
Expand Down
9 changes: 8 additions & 1 deletion src/expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -625,11 +625,18 @@ namespace Sass {
Env* env = environment();
// convert @content directives into mixin calls to the underlying thunk
if (!env->has("@content[m]")) return 0;
if (block_stack.back()->is_root()) {
selector_stack.push_back(0);
}
Mixin_Call* call = SASS_MEMORY_NEW(ctx.mem, Mixin_Call,
c->pstate(),
"@content",
SASS_MEMORY_NEW(ctx.mem, Arguments, c->pstate()));
return call->perform(this);
Statement* stm = call->perform(this);
if (block_stack.back()->is_root()) {
selector_stack.pop_back();
}
return stm;
}

// produce an error if something is not implemented
Expand Down

0 comments on commit 1e3ee36

Please sign in to comment.