aboutsummaryrefslogtreecommitdiffhomepage
path: root/tdtl
diff options
context:
space:
mode:
authorAndrea Cavalli <andrea@cavallium.it>2022-03-14 14:29:17 +0100
committerGitHub <noreply@github.com>2022-03-14 16:29:17 +0300
commit48a93aadb9f807c8b485ffa66b1f936fa213e6f9 (patch)
tree02c47bdc1f289f73c49c7feb2fb950cf48690628 /tdtl
parentccf2da28650d8d1db8514855ca847550a3b2267a (diff)
Support function generic result type (#1809)
Fixes #1708
Diffstat (limited to 'tdtl')
-rw-r--r--tdtl/td/tl/tl_generate.cpp10
-rw-r--r--tdtl/td/tl/tl_writer.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/tdtl/td/tl/tl_generate.cpp b/tdtl/td/tl/tl_generate.cpp
index 015c09a49..d2d7528ea 100644
--- a/tdtl/td/tl/tl_generate.cpp
+++ b/tdtl/td/tl/tl_generate.cpp
@@ -245,7 +245,7 @@ static void write_function(tl_outputer &out, const tl_combinator *t, const std::
std::string class_name = w.gen_class_name(t->name);
- out.append(w.gen_class_begin(class_name, w.gen_base_function_class_name(), false));
+ out.append(w.gen_class_begin(class_name, w.gen_base_function_class_name(), false, t->result));
int required_args = gen_field_definitions(out, t, class_name, w);
out.append(w.gen_flags_definitions(t, true));
@@ -302,7 +302,7 @@ static void write_constructor(tl_outputer &out, const tl_combinator *t, const st
std::string class_name = w.gen_class_name(t->name);
- out.append(w.gen_class_begin(class_name, base_class, is_proxy));
+ out.append(w.gen_class_begin(class_name, base_class, is_proxy, t->result));
int required_args = gen_field_definitions(out, t, class_name, w);
bool can_be_parsed = false;
@@ -386,7 +386,7 @@ void write_class(tl_outputer &out, const tl_type *t, const std::set<std::string>
std::vector<var_description> empty_vars;
bool optimize_one_constructor = (t->simple_constructors == 1);
if (!optimize_one_constructor) {
- out.append(w.gen_class_begin(class_name, base_class, true));
+ out.append(w.gen_class_begin(class_name, base_class, true, nullptr));
out.append(w.gen_get_id(class_name, 0, true));
@@ -648,7 +648,7 @@ void write_tl(const tl_config &config, tl_outputer &out, const TL_writer &w) {
// write base classes
std::vector<var_description> empty_vars;
for (int i = 0; i <= w.get_max_arity(); i++) {
- out.append(w.gen_class_begin(w.gen_base_type_class_name(i), w.gen_base_tl_class_name(), true));
+ out.append(w.gen_class_begin(w.gen_base_type_class_name(i), w.gen_base_tl_class_name(), true, nullptr));
out.append(w.gen_get_id(w.gen_base_type_class_name(i), 0, true));
@@ -742,7 +742,7 @@ void write_tl(const tl_config &config, tl_outputer &out, const TL_writer &w) {
}
{
- out.append(w.gen_class_begin(w.gen_base_function_class_name(), w.gen_base_tl_class_name(), true));
+ out.append(w.gen_class_begin(w.gen_base_function_class_name(), w.gen_base_tl_class_name(), true, nullptr));
out.append(w.gen_get_id(w.gen_base_function_class_name(), 0, true));
diff --git a/tdtl/td/tl/tl_writer.h b/tdtl/td/tl/tl_writer.h
index ef99eddc1..e074bb26b 100644
--- a/tdtl/td/tl/tl_writer.h
+++ b/tdtl/td/tl/tl_writer.h
@@ -89,7 +89,7 @@ class TL_writer {
virtual std::string gen_forward_class_declaration(const std::string &class_name, bool is_proxy) const = 0;
virtual std::string gen_class_begin(const std::string &class_name, const std::string &base_class_name,
- bool is_proxy) const = 0;
+ bool is_proxy, const tl_tree *result) const = 0;
virtual std::string gen_class_end() const = 0;
virtual std::string gen_class_alias(const std::string &class_name, const std::string &alias_name) const = 0;