MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / do_render

Method do_render

src/include/minja/minja.hpp:1135–1149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1133 SetNode(const Location & loc, const std::string & ns, const std::vector<std::string> & vns, std::shared_ptr<Expression> && v)
1134 : TemplateNode(loc), ns(ns), var_names(vns), value(std::move(v)) {}
1135 void do_render(std::ostringstream &, const std::shared_ptr<Context> & context) const override {
1136 if (!value) throw std::runtime_error("SetNode.value is null");
1137 if (!ns.empty()) {
1138 if (var_names.size() != 1) {
1139 throw std::runtime_error("Namespaced set only supports a single variable name");
1140 }
1141 auto & name = var_names[0];
1142 auto ns_value = context->get(ns);
1143 if (!ns_value.is_object()) throw std::runtime_error("Namespace '" + ns + "' is not an object");
1144 ns_value.set(name, this->value->evaluate(context));
1145 } else {
1146 auto val = value->evaluate(context);
1147 destructuring_assign(var_names, context, val);
1148 }
1149 }
1150};
1151
1152class SetTemplateNode : public TemplateNode {

Callers

nothing calls this directly

Calls 7

destructuring_assignFunction · 0.85
is_objectMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45
getMethod · 0.45
setMethod · 0.45
evaluateMethod · 0.45

Tested by

no test coverage detected