sync: minja

This commit is contained in:
ochafik 2025-01-28 23:49:04 +00:00
parent 4f257550a2
commit d603d067d5

View file

@ -1270,6 +1270,11 @@ public:
}
auto r = right->evaluate(context);
if (op != Op::Eq && op != Op::Ne) {
if (r.is_null() || (l.is_null() && (op != Op::In && op != Op::NotIn))) {
throw std::runtime_error("unsupported operand type(s)");
}
}
switch (op) {
case Op::StrConcat: return l.to_str() + r.to_str();
case Op::Add: return l + r;
@ -2147,11 +2152,11 @@ private:
}
std::runtime_error unexpected(const TemplateToken & token) const {
return std::runtime_error("Unexpected " + TemplateToken::typeToString(token.type)
return std::runtime_error("Encountered unknown tag '" + TemplateToken::typeToString(token.type) + "'"
+ error_location_suffix(*template_str, token.location.pos));
}
std::runtime_error unterminated(const TemplateToken & token) const {
return std::runtime_error("Unterminated " + TemplateToken::typeToString(token.type)
return std::runtime_error("Unexpected end of template. Jinja was looking for the following tags: '" + TemplateToken::typeToString(token.type) + "'"
+ error_location_suffix(*template_str, token.location.pos));
}