Skip to content

Commit 302f3e3

Browse files
committed
Make some error messages more consistent with Ruby Sass
Fixes #1941 Spec sass/sass-spec#738
1 parent c10d020 commit 302f3e3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/parser.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ namespace Sass {
200200

201201
// abort if we are in function context and have nothing parsed yet
202202
else if (stack.back() == Scope::Function) {
203-
error("Functions can only contain variable declarations and control directives", pstate);
203+
error("Functions can only contain variable declarations and control directives.", pstate);
204204
}
205205

206206
// parse imports to process later
@@ -340,7 +340,12 @@ namespace Sass {
340340
{
341341
Scope parent = stack.empty() ? Scope::Rules : stack.back();
342342
if (parent != Scope::Root && parent != Scope::Rules && parent != Scope::Function) {
343-
error("Functions may not be defined within control directives or other mixins.", pstate);
343+
if (which_type == Definition::FUNCTION) {
344+
error("Functions may not be defined within control directives or other mixins.", pstate);
345+
} else {
346+
error("Mixins may not be defined within control directives or other mixins.", pstate);
347+
}
348+
344349
}
345350
std::string which_str(lexed);
346351
if (!lex< identifier >()) error("invalid name in " + which_str + " definition", pstate);

0 commit comments

Comments
 (0)