diff --git a/compiler/cpp/src/thrift/generate/t_netstd_generator.cc b/compiler/cpp/src/thrift/generate/t_netstd_generator.cc index 975f33b92f9..88f8da417f7 100644 --- a/compiler/cpp/src/thrift/generate/t_netstd_generator.cc +++ b/compiler/cpp/src/thrift/generate/t_netstd_generator.cc @@ -1926,16 +1926,7 @@ void t_netstd_generator::generate_service_interface(ostream& out, t_service* tse } } - auto iter = (*f_iter)->annotations_.find("deprecated"); - if( (*f_iter)->annotations_.end() != iter) { - out << indent() << "[Obsolete"; - // empty annotation values end up with "1" somewhere, ignore these as well - if ((iter->second.length() > 0) && (iter->second != "1")) { - out << "(" << make_csharp_string_literal(iter->second) << ")"; - } - out << "]" << endl; - } - + generate_deprecation_attribute(out, *f_iter); out << indent() << function_signature_async(*f_iter) << ";" << endl << endl; } indent_down(); @@ -1943,6 +1934,19 @@ void t_netstd_generator::generate_service_interface(ostream& out, t_service* tse cleanup_member_name_mapping(tservice); } +void t_netstd_generator::generate_deprecation_attribute(ostream& out, t_function* func) +{ + auto iter = func->annotations_.find("deprecated"); + if( func->annotations_.end() != iter) { + out << indent() << "[Obsolete"; + // empty annotation values end up with "1" somewhere, ignore these as well + if ((iter->second.length() > 0) && (iter->second != "1")) { + out << "(" << make_csharp_string_literal(iter->second) << ")"; + } + out << "]" << endl; + } +} + void t_netstd_generator::generate_service_helpers(ostream& out, t_service* tservice) { vector functions = tservice->get_functions(); @@ -2006,6 +2010,7 @@ void t_netstd_generator::generate_service_client(ostream& out, t_service* tservi string function_name = raw_func_name + (add_async_postfix ? "Async" : ""); // async + generate_deprecation_attribute(out, *functions_iterator); out << indent() << "public async " << function_signature_async(*functions_iterator, "") << endl << indent() << "{" << endl; indent_up(); @@ -2023,6 +2028,7 @@ void t_netstd_generator::generate_service_client(ostream& out, t_service* tservi out << indent() << "}" << endl << endl; // async send + generate_deprecation_attribute(out, *functions_iterator); out << indent() << "public async " << function_signature_async(*functions_iterator, "send_", MODE_NO_RETURN) << endl << indent() << "{" << endl; indent_up(); @@ -2063,6 +2069,7 @@ void t_netstd_generator::generate_service_client(ostream& out, t_service* tservi if (!(*functions_iterator)->is_oneway()) { // async recv + generate_deprecation_attribute(out, *functions_iterator); out << indent() << "public async " << function_signature_async(*functions_iterator, "recv_", MODE_NO_ARGS) << endl << indent() << "{" << endl; indent_up(); diff --git a/compiler/cpp/src/thrift/generate/t_netstd_generator.h b/compiler/cpp/src/thrift/generate/t_netstd_generator.h index 0b65a789af4..47a7042800c 100644 --- a/compiler/cpp/src/thrift/generate/t_netstd_generator.h +++ b/compiler/cpp/src/thrift/generate/t_netstd_generator.h @@ -105,6 +105,7 @@ class t_netstd_generator : public t_oop_generator void generate_netstd_union_reader(ostream& out, t_struct* tunion); void generate_function_helpers(ostream& out, t_function* tfunction); void generate_service_interface(ostream& out, t_service* tservice); + void generate_deprecation_attribute(ostream& out, t_function* func); void generate_service_helpers(ostream& out, t_service* tservice); void generate_service_client(ostream& out, t_service* tservice); void generate_service_server(ostream& out, t_service* tservice);