Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit cd1b2b1

Browse files
committed
Improve selector argument error messages
1 parent df25b09 commit cd1b2b1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/fn_utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,27 +121,27 @@ namespace Sass {
121121
std::stringstream msg;
122122
msg << argname << ": null is not a valid selector: it must be a string,\n";
123123
msg << "a list of strings, or a list of lists of strings for `" << function_name(sig) << "'";
124-
error(msg.str(), pstate, traces);
124+
error(msg.str(), exp->pstate(), traces);
125125
}
126126
if (String_Constant_Ptr str = Cast<String_Constant>(exp)) {
127127
str->quote_mark(0);
128128
}
129129
std::string exp_src = exp->to_string(ctx.c_options);
130-
return Parser::parse_selector(exp_src.c_str(), ctx, traces);
130+
return Parser::parse_selector(exp_src.c_str(), ctx, traces, exp->pstate(), pstate.src);
131131
}
132132

133133
Compound_Selector_Obj get_arg_sel(const std::string& argname, Env& env, Signature sig, ParserState pstate, Backtraces traces, Context& ctx) {
134134
Expression_Obj exp = ARG(argname, Expression);
135135
if (exp->concrete_type() == Expression::NULL_VAL) {
136136
std::stringstream msg;
137137
msg << argname << ": null is not a string for `" << function_name(sig) << "'";
138-
error(msg.str(), pstate, traces);
138+
error(msg.str(), exp->pstate(), traces);
139139
}
140140
if (String_Constant_Ptr str = Cast<String_Constant>(exp)) {
141141
str->quote_mark(0);
142142
}
143143
std::string exp_src = exp->to_string(ctx.c_options);
144-
Selector_List_Obj sel_list = Parser::parse_selector(exp_src.c_str(), ctx, traces);
144+
Selector_List_Obj sel_list = Parser::parse_selector(exp_src.c_str(), ctx, traces, exp->pstate(), pstate.src);
145145
if (sel_list->length() == 0) return {};
146146
Complex_Selector_Obj first = sel_list->first();
147147
if (!first->tail()) return first->head();

0 commit comments

Comments
 (0)