diff --git a/src/ast_sel_weave.cpp b/src/ast_sel_weave.cpp index 2785ea370..c792d0f8a 100644 --- a/src/ast_sel_weave.cpp +++ b/src/ast_sel_weave.cpp @@ -576,8 +576,12 @@ namespace Sass { // Prepare data structures choices.push_back(expanded); choices.push_back({ group }); - groups1.erase(groups1.begin()); - groups2.erase(groups2.begin()); + if (!groups1.empty()) { + groups1.erase(groups1.begin()); + } + if (!groups2.empty()) { + groups2.erase(groups2.begin()); + } } diff --git a/src/eval.cpp b/src/eval.cpp index 67f079869..93bce0acc 100644 --- a/src/eval.cpp +++ b/src/eval.cpp @@ -690,9 +690,9 @@ namespace Sass { b->op(), s_l->last(), b->right()); bin_ex->is_delayed(b->left()->is_delayed() || b->right()->is_delayed()); // unverified for (size_t i = 0; i < s_l->length() - 1; ++i) { - ret_schema->append(Cast(s_l->at(i)->perform(this))); + ret_schema->append(s_l->at(i)->perform(this)); } - ret_schema->append(Cast(bin_ex->perform(this))); + ret_schema->append(bin_ex->perform(this)); return ret_schema->perform(this); } } @@ -703,9 +703,9 @@ namespace Sass { Binary_Expression_Obj bin_ex = SASS_MEMORY_NEW(Binary_Expression, b->pstate(), b->op(), b->left(), s_r->first()); bin_ex->is_delayed(b->left()->is_delayed() || b->right()->is_delayed()); // verified - ret_schema->append(Cast(bin_ex->perform(this))); + ret_schema->append(bin_ex->perform(this)); for (size_t i = 1; i < s_r->length(); ++i) { - ret_schema->append(Cast(s_r->at(i)->perform(this))); + ret_schema->append(s_r->at(i)->perform(this)); } return ret_schema->perform(this); } diff --git a/src/parser_selectors.cpp b/src/parser_selectors.cpp index d76dd2ca7..3b4a6e2d9 100644 --- a/src/parser_selectors.cpp +++ b/src/parser_selectors.cpp @@ -140,10 +140,12 @@ namespace Sass { // parent selector only allowed at start // upcoming Sass may allow also trailing ParserState state(pstate); - SimpleSelectorObj prev = (*seq)[seq->length()-1]; - std::string sel(prev->to_string({ NESTED, 5 })); std::string found("&"); - if (lex < identifier >()) { found += std::string(lexed); } + if (lex < identifier >()) { + found += std::string(lexed); + } + std::string sel(seq->hasRealParent() ? "&" : ""); + if (!seq->empty()) { sel = seq->last()->to_string({ NESTED, 5 }); } // ToDo: parser should throw parser exceptions error("Invalid CSS after \"" + sel + "\": expected \"{\", was \"" + found + "\"\n\n" "\"" + found + "\" may only be used at the beginning of a compound selector.", state);