MCPcopy Create free account
hub / github.com/TelegramMessenger/cocoon / gen_function_vars

Method gen_function_vars

tl/generate/tl_writer_cpp.cpp:103–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103std::string TD_TL_writer_cpp::gen_function_vars(const tl::tl_combinator *t,
104 std::vector<tl::var_description> &vars) const {
105 for (std::size_t i = 0; i < vars.size(); i++) {
106 vars[i].index = static_cast<int>(i);
107 vars[i].is_stored = false;
108 vars[i].is_type = false;
109 vars[i].parameter_num = -1;
110 vars[i].function_arg_num = -1;
111 }
112
113 for (std::size_t i = 0; i < t->args.size(); i++) {
114 const tl::arg &a = t->args[i];
115
116 int arg_type = a.type->get_type();
117 if (arg_type == tl::NODE_TYPE_VAR_TYPE) {
118 const tl::tl_tree_var_type *var_type = static_cast<const tl::tl_tree_var_type *>(a.type);
119 assert(a.flags & tl::FLAG_EXCL);
120 assert(var_type->var_num >= 0);
121 assert(!vars[var_type->var_num].is_type);
122 vars[var_type->var_num].is_type = true;
123 vars[var_type->var_num].function_arg_num = static_cast<int>(i);
124 }
125 }
126
127 return "";
128}
129
130std::string TD_TL_writer_cpp::gen_uni(const tl::tl_tree_type *result_type, std::vector<tl::var_description> &vars,
131 bool check_negative) const {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected