Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
Restore old compound extend behavior (with deprecation)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgreter committed Jun 16, 2019
1 parent f964dcd commit 3e8e941
Showing 1 changed file with 27 additions and 21 deletions.
48 changes: 27 additions & 21 deletions src/expand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,38 +669,44 @@ namespace Sass {
// evaluate the selector
e->selector(eval(e->selector()));

if (e->selector()) {

for (auto complex : e->selector()->elements()) {

auto list = e->selector();
if (list) {
for (auto complex : list->elements()) {
if (complex->length() != 1) {
error("complex selectors may not be extended.", complex->pstate(), traces);
}

if (complex->length() != 1) {
std::cerr << "complex selectors may not be extended." << "\n"; exit(1);
}
if (auto compound = complex->first()->getCompound()) {

if (auto compound = complex->first()->getCompound()) {
if (compound->length() != 1) {

if (compound->length() != 1) {
std::cerr <<
"compound selectors may no longer be extended.\n"
"Consider `@extend ${compound.components.join(', ')}` instead.\n"
"See http://bit.ly/ExtendCompound for details.\n";
}
std::cerr <<
"compound selectors may no longer be extended.\n"
"Consider `@extend ${compound.components.join(', ')}` instead.\n"
"See http://bit.ly/ExtendCompound for details.\n";

// Pass every selector we ever see to extender (to make them findable for extend)
ctx.extender.addExtension(selector(), compound->first(), e, mediaStack.back());
// Make this an error once deprecation is over
for (SimpleSelectorObj simple : compound->elements()) {
// Pass every selector we ever see to extender (to make them findable for extend)
ctx.extender.addExtension(selector(), simple, e, mediaStack.back());
}

}
else {
std::cerr << "complex selectors may not be extended." << "\n"; exit(1);
}
else {
// Pass every selector we ever see to extender (to make them findable for extend)
ctx.extender.addExtension(selector(), compound->first(), e, mediaStack.back());
}

}
else {
error("complex selectors may not be extended.", complex->pstate(), traces);
}
}
}
}
return nullptr;


return nullptr;

}

Statement* Expand::operator()(Definition* d)
Expand Down

0 comments on commit 3e8e941

Please sign in to comment.