sync: minja

This commit is contained in:
ochafik 2025-01-29 20:31:28 +00:00
parent ba27e98582
commit 6e676c8030

View file

@ -628,7 +628,7 @@ class Context : public std::enable_shared_from_this<Context> {
if (parent_) return parent_->contains(key);
return false;
}
virtual void set(const Value & key, Value & value) {
virtual void set(const Value & key, const Value & value) {
values_.set(key, value);
}
};
@ -1270,11 +1270,6 @@ 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): " + l.type() + " and " + r.type());
// }
// }
switch (op) {
case Op::StrConcat: return l.to_str() + r.to_str();
case Op::Add: return l + r;
@ -2152,11 +2147,11 @@ private:
}
std::runtime_error unexpected(const TemplateToken & token) const {
return std::runtime_error("Encountered unknown tag '" + TemplateToken::typeToString(token.type) + "'"
return std::runtime_error("Unexpected " + TemplateToken::typeToString(token.type)
+ error_location_suffix(*template_str, token.location.pos));
}
std::runtime_error unterminated(const TemplateToken & token) const {
return std::runtime_error("Unexpected end of template. Jinja was looking for the following tags: '" + TemplateToken::typeToString(token.type) + "'"
return std::runtime_error("Unterminated " + TemplateToken::typeToString(token.type)
+ error_location_suffix(*template_str, token.location.pos));
}