Skip to content

Commit

Permalink
Fix media query stack and eval issue
Browse files Browse the repository at this point in the history
Fixes #2341
  • Loading branch information
mgreter committed Feb 25, 2017
1 parent e33894e commit dd9b61e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1329,7 +1329,7 @@ namespace Sass {
return ee;
}

Expression_Ptr Eval::operator()(Media_Query_Ptr q)
Media_Query_Ptr Eval::operator()(Media_Query_Ptr q)
{
String_Obj t = q->media_type();
t = static_cast<String_Ptr>(t.isNull() ? 0 : t->perform(this));
Expand Down
2 changes: 1 addition & 1 deletion src/eval.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace Sass {
Expression_Ptr operator()(String_Quoted_Ptr);
Expression_Ptr operator()(String_Constant_Ptr);
// Expression_Ptr operator()(Selector_List_Ptr);
Expression_Ptr operator()(Media_Query_Ptr);
Media_Query_Ptr operator()(Media_Query_Ptr);
Expression_Ptr operator()(Media_Query_Expression_Ptr);
Expression_Ptr operator()(At_Root_Query_Ptr);
Expression_Ptr operator()(Supports_Operator_Ptr);
Expand Down
9 changes: 5 additions & 4 deletions src/expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,18 +176,19 @@ namespace Sass {

Statement_Ptr Expand::operator()(Media_Block_Ptr m)
{
media_block_stack.push_back(m);
Expression_Obj mq = m->media_queries()->perform(&eval);
Media_Block_Ptr cpy = m->copy();
Expression_Obj mq = eval(m->media_queries());
std::string str_mq(mq->to_string(ctx.c_options));
char* str = sass_copy_c_string(str_mq.c_str());
ctx.strings.push_back(str);
Parser p(Parser::from_c_str(str, ctx, mq->pstate()));
mq = p.parse_media_queries(); // re-assign now
List_Obj ls = Cast<List>(mq->perform(&eval));
cpy->media_queries(mq);
media_block_stack.push_back(cpy);
Block_Obj blk = operator()(m->block());
Media_Block_Ptr mm = SASS_MEMORY_NEW(Media_Block,
m->pstate(),
ls,
mq,
blk);
media_block_stack.pop_back();
mm->tabs(m->tabs());
Expand Down

0 comments on commit dd9b61e

Please sign in to comment.