Skip to content

Commit

Permalink
Add another fix for media query boundaries
Browse files Browse the repository at this point in the history
Evaluate the actual queries against each other.
We probably need to implement a better test here!
  • Loading branch information
mgreter committed Mar 8, 2015
1 parent 49862a6 commit 6294ec3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions extend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1679,9 +1679,17 @@ namespace Sass {
for (ExtensionPair ext : entries) {
// check if both selectors have the same media block parent
if (ext.first->media_block() == pComplexSelector->media_block()) continue;
To_String to_string(&ctx);
if (ext.first->media_block() && ext.first->media_block()->media_queries() &&
pComplexSelector->media_block() && pComplexSelector->media_block()->media_queries())
{
string query_left(ext.first->media_block()->media_queries()->perform(&to_string));
string query_right(pComplexSelector->media_block()->media_queries()->perform(&to_string));
if (query_left == query_right) continue;
}

// fail if one goes across media block boundaries
stringstream err;
To_String to_string(&ctx);
string cwd(Sass::File::get_cwd());
ParserState pstate(ext.second->pstate());
string rel_path(Sass::File::resolve_relative_path(pstate.path, cwd, cwd));
Expand Down Expand Up @@ -1709,7 +1717,7 @@ namespace Sass {
break;
}
}
if (!pExtendSelector->is_optional()) {
if (!pExtendSelector || !pExtendSelector->is_optional()) {
string sel2(pExtendSelector ? pExtendSelector->perform(&to_string) : "[unknown]");
err << "\"" << sel1 << "\" failed to @extend \"" << sel2 << "\"\n";
err << "The selector \"" << sel2 << "\" was not found.\n";
Expand Down
2 changes: 1 addition & 1 deletion parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ namespace Sass {
bool semicolon = false;
Selector_Lookahead lookahead_result;
Block* block = new (ctx.mem) Block(pstate);
lex< spaces_and_comments >();
// lex< zero_plus < alternatives < space, line_comment > > >();
// JMA - ensure that a block containing only block_comments is parsed
while (lex< block_comment >()) {
bool is_important = lexed.begin[2] == '!';
Expand Down

0 comments on commit 6294ec3

Please sign in to comment.