diff --git a/td/generate/tl_writer_c.h b/td/generate/tl_writer_c.h index b48c7d93..a83688f0 100644 --- a/td/generate/tl_writer_c.h +++ b/td/generate/tl_writer_c.h @@ -1029,7 +1029,7 @@ class TlWriterCCommon : public tl::TL_writer { } std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, - const std::string &parent_class_name, int arity, + const std::string &parent_class_name, int arity, int field_num, std::vector &vars, int parser_type) const override { return ""; } diff --git a/td/generate/tl_writer_cpp.cpp b/td/generate/tl_writer_cpp.cpp index 5bfc251e..738f13b9 100644 --- a/td/generate/tl_writer_cpp.cpp +++ b/td/generate/tl_writer_cpp.cpp @@ -506,7 +506,7 @@ std::string TD_TL_writer_cpp::gen_function_result_type(const tl::tl_tree *result } std::string TD_TL_writer_cpp::gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, - const std::string &parent_class_name, int arity, + const std::string &parent_class_name, int arity, int field_num, std::vector &vars, int parser_type) const { for (std::size_t i = 0; i < vars.size(); i++) { assert(vars[i].is_stored == false); diff --git a/td/generate/tl_writer_cpp.h b/td/generate/tl_writer_cpp.h index d626a34a..c643df66 100644 --- a/td/generate/tl_writer_cpp.h +++ b/td/generate/tl_writer_cpp.h @@ -77,7 +77,7 @@ class TD_TL_writer_cpp : public TD_TL_writer { std::string gen_function_result_type(const tl::tl_tree *result) const override; std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, - const std::string &parent_class_name, int arity, + const std::string &parent_class_name, int arity, int field_num, std::vector &vars, int parser_type) const override; std::string gen_fetch_function_end(bool has_parent, int field_num, const std::vector &vars, int parser_type) const override; diff --git a/td/generate/tl_writer_dotnet.h b/td/generate/tl_writer_dotnet.h index f41500d2..09934285 100644 --- a/td/generate/tl_writer_dotnet.h +++ b/td/generate/tl_writer_dotnet.h @@ -471,7 +471,7 @@ class TlWriterDotNet : public TL_writer { } std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, - const std::string &parent_class_name, int arity, + const std::string &parent_class_name, int arity, int field_num, std::vector &vars, int parser_type) const override { return ""; } diff --git a/td/generate/tl_writer_h.cpp b/td/generate/tl_writer_h.cpp index 473f919f..1bae4887 100644 --- a/td/generate/tl_writer_h.cpp +++ b/td/generate/tl_writer_h.cpp @@ -253,7 +253,7 @@ std::string TD_TL_writer_h::gen_function_result_type(const tl::tl_tree *result) } std::string TD_TL_writer_h::gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, - const std::string &parent_class_name, int arity, + const std::string &parent_class_name, int arity, int field_num, std::vector &vars, int parser_type) const { std::string returned_type = "object_ptr<" + parent_class_name + "> "; diff --git a/td/generate/tl_writer_h.h b/td/generate/tl_writer_h.h index bdedd0d7..1ff7d8ba 100644 --- a/td/generate/tl_writer_h.h +++ b/td/generate/tl_writer_h.h @@ -63,7 +63,7 @@ class TD_TL_writer_h : public TD_TL_writer { std::string gen_function_result_type(const tl::tl_tree *result) const override; std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, - const std::string &parent_class_name, int arity, + const std::string &parent_class_name, int arity, int field_num, std::vector &vars, int parser_type) const override; std::string gen_fetch_function_end(bool has_parent, int field_num, const std::vector &vars, int parser_type) const override; diff --git a/td/generate/tl_writer_hpp.cpp b/td/generate/tl_writer_hpp.cpp index 6a2557c5..c42c6d71 100644 --- a/td/generate/tl_writer_hpp.cpp +++ b/td/generate/tl_writer_hpp.cpp @@ -138,7 +138,7 @@ std::string TD_TL_writer_hpp::gen_function_result_type(const tl::tl_tree *result } std::string TD_TL_writer_hpp::gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, - const std::string &parent_class_name, int arity, + const std::string &parent_class_name, int arity, int field_num, std::vector &vars, int parser_type) const { return ""; } diff --git a/td/generate/tl_writer_hpp.h b/td/generate/tl_writer_hpp.h index 9e87ee84..3f9b9e64 100644 --- a/td/generate/tl_writer_hpp.h +++ b/td/generate/tl_writer_hpp.h @@ -64,7 +64,7 @@ class TD_TL_writer_hpp : public TD_TL_writer { std::string gen_function_result_type(const tl::tl_tree *result) const override; std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, - const std::string &parent_class_name, int arity, + const std::string &parent_class_name, int arity, int field_num, std::vector &vars, int parser_type) const override; std::string gen_fetch_function_end(bool has_parent, int field_num, const std::vector &vars, int parser_type) const override; diff --git a/td/generate/tl_writer_java.cpp b/td/generate/tl_writer_java.cpp index 629d7a74..11e72113 100644 --- a/td/generate/tl_writer_java.cpp +++ b/td/generate/tl_writer_java.cpp @@ -346,7 +346,7 @@ std::string TD_TL_writer_java::gen_function_result_type(const tl::tl_tree *resul } std::string TD_TL_writer_java::gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, - const std::string &parent_class_name, int arity, + const std::string &parent_class_name, int arity, int field_num, std::vector &vars, int parser_type) const { return ""; } diff --git a/td/generate/tl_writer_java.h b/td/generate/tl_writer_java.h index 84eb8c2b..ed5d5bf1 100644 --- a/td/generate/tl_writer_java.h +++ b/td/generate/tl_writer_java.h @@ -88,7 +88,7 @@ class TD_TL_writer_java : public tl::TL_writer { std::string gen_function_result_type(const tl::tl_tree *result) const override; std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, - const std::string &parent_class_name, int arity, + const std::string &parent_class_name, int arity, int field_num, std::vector &vars, int parser_type) const override; std::string gen_fetch_function_end(bool has_parent, int field_num, const std::vector &vars, int parser_type) const override; diff --git a/td/generate/tl_writer_jni_cpp.cpp b/td/generate/tl_writer_jni_cpp.cpp index 2dee197b..3a32d8a1 100644 --- a/td/generate/tl_writer_jni_cpp.cpp +++ b/td/generate/tl_writer_jni_cpp.cpp @@ -380,7 +380,7 @@ std::string TD_TL_writer_jni_cpp::gen_get_id(const std::string &class_name, std: std::string TD_TL_writer_jni_cpp::gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, const std::string &parent_class_name, int arity, - std::vector &vars, + int field_num, std::vector &vars, int parser_type) const { for (std::size_t i = 0; i < vars.size(); i++) { assert(vars[i].is_stored == false); diff --git a/td/generate/tl_writer_jni_cpp.h b/td/generate/tl_writer_jni_cpp.h index 40103d5f..8f434419 100644 --- a/td/generate/tl_writer_jni_cpp.h +++ b/td/generate/tl_writer_jni_cpp.h @@ -74,7 +74,7 @@ class TD_TL_writer_jni_cpp : public TD_TL_writer_cpp { std::string gen_get_id(const std::string &class_name, std::int32_t id, bool is_proxy) const override; std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, - const std::string &parent_class_name, int arity, + const std::string &parent_class_name, int arity, int field_num, std::vector &vars, int parser_type) const override; std::string gen_fetch_function_end(bool has_parent, int field_num, const std::vector &vars, int parser_type) const override; diff --git a/tdtl/td/tl/tl_generate.cpp b/tdtl/td/tl/tl_generate.cpp index e3072cea..576f8a22 100644 --- a/tdtl/td/tl/tl_generate.cpp +++ b/tdtl/td/tl/tl_generate.cpp @@ -92,7 +92,7 @@ static void write_function_fetch(tl_outputer &out, const std::string &parser_nam return; } - out.append(w.gen_fetch_function_begin(parser_name, class_name, class_name, 0, vars, parser_type)); + out.append(w.gen_fetch_function_begin(parser_name, class_name, class_name, 0, t->args.size(), vars, parser_type)); out.append(w.gen_vars(t, NULL, vars)); int field_num = 0; for (std::size_t i = 0; i < t->args.size(); i++) { @@ -176,7 +176,8 @@ static void write_constructor_fetch(tl_outputer &out, const std::string &parser_ } out.append(w.gen_fetch_function_begin(parser_name, class_name, parent_class_name, - static_cast(result_type->children.size()), vars, parser_type)); + static_cast(result_type->children.size()), t->args.size(), vars, + parser_type)); out.append(w.gen_vars(t, result_type, vars)); out.append(w.gen_uni(result_type, vars, true)); int field_num = 0; @@ -369,7 +370,7 @@ void write_class(tl_outputer &out, const tl_type *t, const std::set continue; } - out.append(w.gen_fetch_function_begin(parsers[i], class_name, class_name, t->arity, empty_vars, -1)); + out.append(w.gen_fetch_function_begin(parsers[i], class_name, class_name, t->arity, -1, empty_vars, -1)); out.append(w.gen_fetch_switch_begin()); for (std::size_t j = 0; j < t->constructors_num; j++) { if (w.is_combinator_supported(t->constructors[j])) { @@ -652,7 +653,7 @@ void write_tl(const tl_config &config, tl_outputer &out, const TL_writer &w) { } out.append(w.gen_fetch_function_begin(parsers[j], w.gen_base_type_class_name(i), w.gen_base_type_class_name(i), i, - empty_vars, -1)); + -1, empty_vars, -1)); out.append(w.gen_fetch_switch_begin()); for (std::size_t type = 0; type < types_n; type++) { tl_type *t = config.get_type_by_num(type); @@ -727,7 +728,7 @@ void write_tl(const tl_config &config, tl_outputer &out, const TL_writer &w) { } out.append(w.gen_fetch_function_begin(parsers[j], w.gen_base_function_class_name(), - w.gen_base_function_class_name(), 0, empty_vars, -1)); + w.gen_base_function_class_name(), 0, -1, empty_vars, -1)); out.append(w.gen_fetch_switch_begin()); for (std::size_t function = 0; function < functions_n; function++) { tl_combinator *t = config.get_function_by_num(function); diff --git a/tdtl/td/tl/tl_writer.h b/tdtl/td/tl/tl_writer.h index b6abbc2f..27fdaee2 100644 --- a/tdtl/td/tl/tl_writer.h +++ b/tdtl/td/tl/tl_writer.h @@ -120,7 +120,7 @@ class TL_writer { virtual std::string gen_function_result_type(const tl_tree *result) const = 0; virtual std::string gen_fetch_function_begin(const std::string &parser_name, const std::string &class_name, - const std::string &parent_class_name, int arity, + const std::string &parent_class_name, int arity, int field_num, std::vector &vars, int parser_type) const = 0; virtual std::string gen_fetch_function_end(bool has_parent, int field_num, const std::vector &vars, int parser_type) const = 0;