Skip to content

Commit

Permalink
Fix context-exists inside control blocks
Browse files Browse the repository at this point in the history
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
  • Loading branch information
xzyfer committed Mar 16, 2019
1 parent c1417f1 commit 36c7b4a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2200,7 +2200,8 @@ namespace Sass {
lex< identifier >();
std::string name(lexed);

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

ParserState call_pos = pstate;
Expand Down

0 comments on commit 36c7b4a

Please sign in to comment.