Skip to content

Commit e42c03a

Browse files
committed
Fix context-exists inside control blocks
It's not enough to check the head of the stack to determine if we're within a mixin. Spec sass/sass-spec#1361 Fixes #2842
1 parent 189aeb9 commit e42c03a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/parser.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -2200,7 +2200,8 @@ namespace Sass {
22002200
lex< identifier >();
22012201
std::string name(lexed);
22022202

2203-
if (Util::normalize_underscores(name) == "content-exists" && stack.back() != Scope::Mixin)
2203+
bool in_mixin = std::find(stack.begin(), stack.end(), Scope::Mixin) != stack.end();
2204+
if (Util::normalize_underscores(name) == "content-exists" && !in_mixin)
22042205
{ error("Cannot call content-exists() except within a mixin."); }
22052206

22062207
ParserState call_pos = pstate;

0 commit comments

Comments
 (0)