| 919 | public: |
| 920 | ExpressionNode(const Location & loc, std::shared_ptr<Expression> && e) : TemplateNode(loc), expr(std::move(e)) {} |
| 921 | void do_render(std::ostringstream & out, const std::shared_ptr<Context> & context) const override { |
| 922 | if (!expr) throw std::runtime_error("ExpressionNode.expr is null"); |
| 923 | auto result = expr->evaluate(context); |
| 924 | if (result.is_string()) { |
| 925 | out << result.get<std::string>(); |
| 926 | } else if (result.is_boolean()) { |
| 927 | out << (result.get<bool>() ? "True" : "False"); |
| 928 | } else if (!result.is_null()) { |
| 929 | out << result.dump(); |
| 930 | } |
| 931 | } |
| 932 | }; |
| 933 | |
| 934 | class IfNode : public TemplateNode { |
nothing calls this directly
no test coverage detected