Skip to content

Commit ed5b844

Browse files
committed
Fix is_optional flag propagation for selector schema
1 parent 7f58761 commit ed5b844

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

src/ast.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,10 +1275,10 @@ namespace Sass {
12751275
if ((*this)[i]->head()->is_empty_reference()) {
12761276
// simply move to the next tail if we have "no" combinator
12771277
if ((*this)[i]->combinator() == Complex_Selector::ANCESTOR_OF) {
1278-
if ((*this)[i]->tail() && (*this)[i]->has_line_feed()) {
1279-
(*this)[i]->tail()->has_line_feed(true);
1280-
}
12811278
if ((*this)[i]->tail() != NULL) {
1279+
if ((*this)[i]->has_line_feed()) {
1280+
(*this)[i]->tail()->has_line_feed(true);
1281+
}
12821282
(*this)[i] = (*this)[i]->tail();
12831283
}
12841284
}

src/eval.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,6 +1683,7 @@ namespace Sass {
16831683
std::vector<Selector_List*> rv;
16841684
Selector_List* sl = SASS_MEMORY_NEW(ctx.mem, Selector_List, s->pstate());
16851685
sl->media_block(s->media_block());
1686+
sl->is_optional(s->is_optional());
16861687
for (size_t i = 0, iL = s->length(); i < iL; ++i) {
16871688
rv.push_back(operator()((*s)[i]));
16881689
}

src/expand.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ namespace Sass {
593593
error("Can't extend " + sel_str + ": can't extend nested selectors", c->pstate(), backtrace());
594594
}
595595
Compound_Selector* placeholder = c->head();
596-
placeholder->is_optional(s->is_optional());
596+
if (contextualized->is_optional()) placeholder->is_optional(true);
597597
for (size_t i = 0, L = extender->length(); i < L; ++i) {
598598
Complex_Selector* sel = (*extender)[i];
599599
if (!(sel->head() && sel->head()->length() > 0 &&

0 commit comments

Comments
 (0)