From 6e676c8030851becf71a7eb3d4a249e3ccd4b934 Mon Sep 17 00:00:00 2001 From: ochafik Date: Wed, 29 Jan 2025 20:31:28 +0000 Subject: [PATCH] sync: minja --- common/minja.hpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/common/minja.hpp b/common/minja.hpp index a36ebf72c..f0e80fd7c 100644 --- a/common/minja.hpp +++ b/common/minja.hpp @@ -628,7 +628,7 @@ class Context : public std::enable_shared_from_this { 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)); }