diff --git a/src/expand.cpp b/src/expand.cpp index 844199849c..eaf26cb5c1 100644 --- a/src/expand.cpp +++ b/src/expand.cpp @@ -663,38 +663,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)