From 473292500dc553e537aad0544f9fbb31d0fbf3d0 Mon Sep 17 00:00:00 2001 From: David Reiss Date: Tue, 24 Mar 2009 20:01:02 +0000 Subject: [PATCH] THRIFT-136. s/async/oneway/ in compiler variables This is an internal-only change. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@757989 13f79535-47bb-0310-9956-ffa450edef68 --- .../cpp/src/generate/t_cocoa_generator.cc | 6 ++--- compiler/cpp/src/generate/t_cpp_generator.cc | 22 ++++++++--------- .../cpp/src/generate/t_csharp_generator.cc | 16 ++++++------- compiler/cpp/src/generate/t_erl_generator.cc | 2 +- compiler/cpp/src/generate/t_hs_generator.cc | 18 +++++++------- compiler/cpp/src/generate/t_java_generator.cc | 18 +++++++------- .../cpp/src/generate/t_ocaml_generator.cc | 12 +++++----- compiler/cpp/src/generate/t_perl_generator.cc | 14 +++++------ compiler/cpp/src/generate/t_php_generator.cc | 16 ++++++------- compiler/cpp/src/generate/t_py_generator.cc | 24 +++++++++---------- compiler/cpp/src/generate/t_rb_generator.cc | 14 +++++------ compiler/cpp/src/generate/t_st_generator.cc | 4 ++-- compiler/cpp/src/parse/t_function.h | 16 ++++++------- 13 files changed, 91 insertions(+), 91 deletions(-) diff --git a/compiler/cpp/src/generate/t_cocoa_generator.cc b/compiler/cpp/src/generate/t_cocoa_generator.cc index 6da56337..f2121ca8 100644 --- a/compiler/cpp/src/generate/t_cocoa_generator.cc +++ b/compiler/cpp/src/generate/t_cocoa_generator.cc @@ -969,7 +969,7 @@ string t_cocoa_generator::function_result_helper_struct_type(t_function* tfuncti * @param tfunction The function */ void t_cocoa_generator::generate_function_helpers(t_function* tfunction) { - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { return; } @@ -1137,7 +1137,7 @@ void t_cocoa_generator::generate_cocoa_service_client_implementation(ofstream& o scope_down(out); out << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { t_struct noargs(program_); t_function recv_function((*f_iter)->get_returntype(), string("recv_") + (*f_iter)->get_name(), @@ -1220,7 +1220,7 @@ void t_cocoa_generator::generate_cocoa_service_client_implementation(ofstream& o } out << "];" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { out << indent(); if (!(*f_iter)->get_returntype()->is_void()) { out << "return "; diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc index 8761f965..788f7acd 100644 --- a/compiler/cpp/src/generate/t_cpp_generator.cc +++ b/compiler/cpp/src/generate/t_cpp_generator.cc @@ -1590,7 +1590,7 @@ void t_cpp_generator::generate_service_client(t_service* tservice) { (*f_iter)->get_arglist()); indent(f_header_) << function_signature(*f_iter) << ";" << endl; indent(f_header_) << function_signature(&send_function) << ";" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { t_struct noargs(program_); t_function recv_function((*f_iter)->get_returntype(), string("recv_") + (*f_iter)->get_name(), @@ -1646,7 +1646,7 @@ void t_cpp_generator::generate_service_client(t_service* tservice) { } f_service_ << ");" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { f_service_ << indent(); if (!(*f_iter)->get_returntype()->is_void()) { if (is_complex_type((*f_iter)->get_returntype())) { @@ -1699,7 +1699,7 @@ void t_cpp_generator::generate_service_client(t_service* tservice) { f_service_ << endl; // Generate recv function only if not an async function - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { t_struct noargs(program_); t_function recv_function((*f_iter)->get_returntype(), string("recv_") + (*f_iter)->get_name(), @@ -1965,7 +1965,7 @@ void t_cpp_generator::generate_service_processor(t_service* tservice) { */ void t_cpp_generator::generate_function_helpers(t_service* tservice, t_function* tfunction) { - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { return; } @@ -2021,7 +2021,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, vector::const_iterator x_iter; // Declare result - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { f_service_ << indent() << resultname << " result;" << endl; } @@ -2038,7 +2038,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, bool first = true; f_service_ << indent(); - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()) { + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()) { if (is_complex_type(tfunction->get_returntype())) { first = false; f_service_ << "iface_->" << tfunction->get_name() << "(result.success"; @@ -2060,7 +2060,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, f_service_ << ");" << endl; // Set isset on success field - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()) { + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()) { f_service_ << indent() << "result.__isset.success = true;" << endl; } @@ -2068,10 +2068,10 @@ void t_cpp_generator::generate_process_function(t_service* tservice, indent_down(); f_service_ << indent() << "}"; - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) { f_service_ << " catch (" << type_name((*x_iter)->get_type()) << " &" << (*x_iter)->get_name() << ") {" << endl; - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { indent_up(); f_service_ << indent() << "result." << (*x_iter)->get_name() << " = " << (*x_iter)->get_name() << ";" << endl << @@ -2086,7 +2086,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, f_service_ << " catch (const std::exception& e) {" << endl; - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { indent_up(); f_service_ << indent() << "apache::thrift::TApplicationException x(e.what());" << endl << @@ -2101,7 +2101,7 @@ void t_cpp_generator::generate_process_function(t_service* tservice, f_service_ << indent() << "}" << endl; // Shortcut out here for async functions - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { f_service_ << indent() << "return;" << endl; indent_down(); diff --git a/compiler/cpp/src/generate/t_csharp_generator.cc b/compiler/cpp/src/generate/t_csharp_generator.cc index 9c073dcc..63879064 100644 --- a/compiler/cpp/src/generate/t_csharp_generator.cc +++ b/compiler/cpp/src/generate/t_csharp_generator.cc @@ -859,7 +859,7 @@ void t_csharp_generator::generate_service_client(t_service* tservice) { } f_service_ << ");" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { f_service_ << indent(); if (!(*f_iter)->get_returntype()->is_void()) { f_service_ << "return "; @@ -897,7 +897,7 @@ void t_csharp_generator::generate_service_client(t_service* tservice) { scope_down(f_service_); f_service_ << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { string resultname = (*f_iter)->get_name() + "_result"; t_struct noargs(program_); @@ -1066,7 +1066,7 @@ void t_csharp_generator::generate_service_server(t_service* tservice) { } void t_csharp_generator::generate_function_helpers(t_function* tfunction) { - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { return; } @@ -1103,7 +1103,7 @@ void t_csharp_generator::generate_process_function(t_service* tservice, t_functi const std::vector& xceptions = xs->get_members(); vector::const_iterator x_iter; - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { f_service_ << indent() << resultname << " result = new " << resultname << "();" << endl; } @@ -1119,7 +1119,7 @@ void t_csharp_generator::generate_process_function(t_service* tservice, t_functi vector::const_iterator f_iter; f_service_ << indent(); - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()) { + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()) { f_service_ << "result.Success = "; } f_service_ << @@ -1135,12 +1135,12 @@ void t_csharp_generator::generate_process_function(t_service* tservice, t_functi } f_service_ << ");" << endl; - if (!tfunction->is_async() && xceptions.size() > 0) { + if (!tfunction->is_oneway() && xceptions.size() > 0) { indent_down(); f_service_ << indent() << "}"; for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) { f_service_ << " catch (" << type_name((*x_iter)->get_type(), false, false) << " " << (*x_iter)->get_name() << ") {" << endl; - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { indent_up(); f_service_ << indent() << "result." << prop_name(*x_iter) << " = " << (*x_iter)->get_name() << ";" << endl; @@ -1153,7 +1153,7 @@ void t_csharp_generator::generate_process_function(t_service* tservice, t_functi f_service_ << endl; } - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { f_service_ << indent() << "return;" << endl; scope_down(f_service_); diff --git a/compiler/cpp/src/generate/t_erl_generator.cc b/compiler/cpp/src/generate/t_erl_generator.cc index c70152ab..90e95bed 100644 --- a/compiler/cpp/src/generate/t_erl_generator.cc +++ b/compiler/cpp/src/generate/t_erl_generator.cc @@ -675,7 +675,7 @@ void t_erl_generator::generate_function_info(t_service* tservice, if (!tfunction->get_returntype()->is_void()) indent(f_service_) << generate_type_term(tfunction->get_returntype(), false) << ";" << endl; - else if (tfunction->is_async()) + else if (tfunction->is_oneway()) indent(f_service_) << "async_void;" << endl; else indent(f_service_) << "{struct, []}" << ";" << endl; diff --git a/compiler/cpp/src/generate/t_hs_generator.cc b/compiler/cpp/src/generate/t_hs_generator.cc index 95f04ffe..bcc5ff55 100644 --- a/compiler/cpp/src/generate/t_hs_generator.cc +++ b/compiler/cpp/src/generate/t_hs_generator.cc @@ -766,7 +766,7 @@ void t_hs_generator::generate_service_client(t_service* tservice) { f_client_ << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { f_client_ << indent(); f_client_ << "recv_" << funname << " ip" << endl; @@ -801,7 +801,7 @@ void t_hs_generator::generate_service_client(t_service* tservice) { indent_down(); - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { std::string resultname = capitalize((*f_iter)->get_name() + "_result"); t_struct noargs(program_); @@ -958,7 +958,7 @@ void t_hs_generator::generate_process_function(t_service* tservice, const std::vector& xceptions = xs->get_members(); vector::const_iterator x_iter; int n = xceptions.size(); - if (!tfunction->is_async()){ + if (!tfunction->is_oneway()){ if(!tfunction->get_returntype()->is_void()){ n++; } @@ -983,7 +983,7 @@ void t_hs_generator::generate_process_function(t_service* tservice, f_service_ << "(do" << endl; indent_up(); f_service_ << indent(); - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()){ + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()){ f_service_ << "res <- "; } f_service_ << "Iface." << tfunction->get_name() << " handler"; @@ -992,21 +992,21 @@ void t_hs_generator::generate_process_function(t_service* tservice, } - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()){ + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()){ f_service_ << endl; indent(f_service_) << "return rs{f_"<is_async()){ + } else if (!tfunction->is_oneway()){ f_service_ << endl; indent(f_service_) << "return rs"; } f_service_ << ")" << endl; indent_down(); - if (xceptions.size() > 0 && !tfunction->is_async()) { + if (xceptions.size() > 0 && !tfunction->is_oneway()) { for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) { indent(f_service_) << "(\\e -> " <is_async()){ + if(!tfunction->is_oneway()){ f_service_ << indent() << "return rs{f_"<get_name() << " =Just e}"; } else { @@ -1021,7 +1021,7 @@ void t_hs_generator::generate_process_function(t_service* tservice, // Shortcut out here for async functions - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { f_service_ << indent() << "return ()" << endl; indent_down(); diff --git a/compiler/cpp/src/generate/t_java_generator.cc b/compiler/cpp/src/generate/t_java_generator.cc index 65f3661a..057e6ce0 100644 --- a/compiler/cpp/src/generate/t_java_generator.cc +++ b/compiler/cpp/src/generate/t_java_generator.cc @@ -1807,7 +1807,7 @@ void t_java_generator::generate_service_client(t_service* tservice) { } f_service_ << ");" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { f_service_ << indent(); if (!(*f_iter)->get_returntype()->is_void()) { f_service_ << "return "; @@ -1847,7 +1847,7 @@ void t_java_generator::generate_service_client(t_service* tservice) { scope_down(f_service_); f_service_ << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { string resultname = (*f_iter)->get_name() + "_result"; t_struct noargs(program_); @@ -2017,7 +2017,7 @@ void t_java_generator::generate_service_server(t_service* tservice) { * @param tfunction The function */ void t_java_generator::generate_function_helpers(t_function* tfunction) { - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { return; } @@ -2067,7 +2067,7 @@ void t_java_generator::generate_process_function(t_service* tservice, vector::const_iterator x_iter; // Declare result for non async function - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { f_service_ << indent() << resultname << " result = new " << resultname << "();" << endl; } @@ -2085,7 +2085,7 @@ void t_java_generator::generate_process_function(t_service* tservice, vector::const_iterator f_iter; f_service_ << indent(); - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()) { + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()) { f_service_ << "result.success = "; } f_service_ << @@ -2102,17 +2102,17 @@ void t_java_generator::generate_process_function(t_service* tservice, f_service_ << ");" << endl; // Set isset on success field - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void() && !type_can_be_null(tfunction->get_returntype())) { + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void() && !type_can_be_null(tfunction->get_returntype())) { f_service_ << indent() << "result.__isset.success = true;" << endl; } - if (!tfunction->is_async() && xceptions.size() > 0) { + if (!tfunction->is_oneway() && xceptions.size() > 0) { indent_down(); f_service_ << indent() << "}"; for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) { f_service_ << " catch (" << type_name((*x_iter)->get_type(), false, false) << " " << (*x_iter)->get_name() << ") {" << endl; - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { indent_up(); f_service_ << indent() << "result." << (*x_iter)->get_name() << " = " << (*x_iter)->get_name() << ";" << endl; @@ -2126,7 +2126,7 @@ void t_java_generator::generate_process_function(t_service* tservice, } // Shortcut out here for async functions - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { f_service_ << indent() << "return;" << endl; scope_down(f_service_); diff --git a/compiler/cpp/src/generate/t_ocaml_generator.cc b/compiler/cpp/src/generate/t_ocaml_generator.cc index 97f9b930..1464618e 100644 --- a/compiler/cpp/src/generate/t_ocaml_generator.cc +++ b/compiler/cpp/src/generate/t_ocaml_generator.cc @@ -861,7 +861,7 @@ void t_ocaml_generator::generate_service_client(t_service* tservice) { } f_service_ << ";" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { f_service_ << indent(); f_service_ << "self#recv_" << funname << endl; @@ -896,7 +896,7 @@ void t_ocaml_generator::generate_service_client(t_service* tservice) { indent_down(); indent_down(); - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { std::string resultname = decapitalize((*f_iter)->get_name() + "_result"); t_struct noargs(program_); @@ -1097,7 +1097,7 @@ void t_ocaml_generator::generate_process_function(t_service* tservice, vector::const_iterator x_iter; // Declare result for non async function - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { f_service_ << indent() << "let result = new " << resultname << " in" << endl; indent_up(); @@ -1114,7 +1114,7 @@ void t_ocaml_generator::generate_process_function(t_service* tservice, f_service_ << indent(); - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()) { + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()) { f_service_ << "result#set_success "; } f_service_ << @@ -1134,7 +1134,7 @@ void t_ocaml_generator::generate_process_function(t_service* tservice, indent() << "| " << capitalize(type_name((*x_iter)->get_type())) << " " << (*x_iter)->get_name() << " -> " << endl; indent_up(); indent_up(); - if(!tfunction->is_async()){ + if(!tfunction->is_oneway()){ f_service_ << indent() << "result#set_" << (*x_iter)->get_name() << " " << (*x_iter)->get_name() << endl; } else { @@ -1150,7 +1150,7 @@ void t_ocaml_generator::generate_process_function(t_service* tservice, // Shortcut out here for async functions - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { f_service_ << indent() << "()" << endl; indent_down(); diff --git a/compiler/cpp/src/generate/t_perl_generator.cc b/compiler/cpp/src/generate/t_perl_generator.cc index 05cdb9f5..9a6535d2 100644 --- a/compiler/cpp/src/generate/t_perl_generator.cc +++ b/compiler/cpp/src/generate/t_perl_generator.cc @@ -825,7 +825,7 @@ void t_perl_generator::generate_process_function(t_service* tservice, vector::const_iterator x_iter; // Declare result for non async function - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { f_service_ << indent() << "my $result = new " << resultname << "();" << endl; } @@ -843,7 +843,7 @@ void t_perl_generator::generate_process_function(t_service* tservice, vector::const_iterator f_iter; f_service_ << indent(); - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()) { + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()) { f_service_ << "$result->{success} = "; } f_service_ << @@ -859,13 +859,13 @@ void t_perl_generator::generate_process_function(t_service* tservice, } f_service_ << ");" << endl; - if (!tfunction->is_async() && xceptions.size() > 0) { + if (!tfunction->is_oneway() && xceptions.size() > 0) { indent_down(); for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) { f_service_ << indent() << "}; if( UNIVERSAL::isa($@,'"<<(*x_iter)->get_type()->get_name()<<"') ){ "<is_async()) { + if (!tfunction->is_oneway()) { indent_up(); f_service_ << indent() << "$result->{" << (*x_iter)->get_name() << "} = $@;" << endl; @@ -878,7 +878,7 @@ void t_perl_generator::generate_process_function(t_service* tservice, } // Shortcut out here for async functions - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { f_service_ << indent() << "return;" << endl; indent_down(); @@ -1120,7 +1120,7 @@ void t_perl_generator::generate_service_client(t_service* tservice) { } f_service_ << ");" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { f_service_ << indent(); if (!(*f_iter)->get_returntype()->is_void()) { f_service_ << "return "; @@ -1164,7 +1164,7 @@ void t_perl_generator::generate_service_client(t_service* tservice) { f_service_ << "}" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { std::string resultname = perl_namespace(tservice->get_program()) + service_name_ + "_" + (*f_iter)->get_name() + "_result"; t_struct noargs(program_); diff --git a/compiler/cpp/src/generate/t_php_generator.cc b/compiler/cpp/src/generate/t_php_generator.cc index a8394437..b0e4ac62 100644 --- a/compiler/cpp/src/generate/t_php_generator.cc +++ b/compiler/cpp/src/generate/t_php_generator.cc @@ -1058,7 +1058,7 @@ void t_php_generator::generate_process_function(t_service* tservice, vector::const_iterator x_iter; // Declare result for non async function - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { f_service_ << indent() << "$result = new " << resultname << "();" << endl; } @@ -1076,7 +1076,7 @@ void t_php_generator::generate_process_function(t_service* tservice, vector::const_iterator f_iter; f_service_ << indent(); - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()) { + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()) { f_service_ << "$result->success = "; } f_service_ << @@ -1092,12 +1092,12 @@ void t_php_generator::generate_process_function(t_service* tservice, } f_service_ << ");" << endl; - if (!tfunction->is_async() && xceptions.size() > 0) { + if (!tfunction->is_oneway() && xceptions.size() > 0) { indent_down(); for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) { f_service_ << indent() << "} catch (" << php_namespace((*x_iter)->get_type()->get_program()) << (*x_iter)->get_type()->get_name() << " $" << (*x_iter)->get_name() << ") {" << endl; - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { indent_up(); f_service_ << indent() << "$result->" << (*x_iter)->get_name() << " = $" << (*x_iter)->get_name() << ";" << endl; @@ -1109,7 +1109,7 @@ void t_php_generator::generate_process_function(t_service* tservice, } // Shortcut out here for async functions - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { f_service_ << indent() << "return;" << endl; indent_down(); @@ -1169,7 +1169,7 @@ void t_php_generator::generate_service_helpers(t_service* tservice) { * @param tfunction The function */ void t_php_generator::generate_php_function_helpers(t_function* tfunction) { - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { t_struct result(program_, service_name_ + "_" + tfunction->get_name() + "_result"); t_field success(tfunction->get_returntype(), "success", 0); if (!tfunction->get_returntype()->is_void()) { @@ -1376,7 +1376,7 @@ void t_php_generator::_generate_service_client(ofstream& out, t_service* tservic } out << ");" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { out << indent(); if (!(*f_iter)->get_returntype()->is_void()) { out << "return "; @@ -1446,7 +1446,7 @@ void t_php_generator::_generate_service_client(ofstream& out, t_service* tservic scope_down(out); - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { std::string resultname = php_namespace(tservice->get_program()) + service_name_ + "_" + (*f_iter)->get_name() + "_result"; t_struct noargs(program_); diff --git a/compiler/cpp/src/generate/t_py_generator.cc b/compiler/cpp/src/generate/t_py_generator.cc index aaee9325..52e29924 100644 --- a/compiler/cpp/src/generate/t_py_generator.cc +++ b/compiler/cpp/src/generate/t_py_generator.cc @@ -866,7 +866,7 @@ void t_py_generator::generate_service_helpers(t_service* tservice) { * @param tfunction The function */ void t_py_generator::generate_py_function_helpers(t_function* tfunction) { - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { t_struct result(program_, tfunction->get_name() + "_result"); t_field success(tfunction->get_returntype(), "success", 0); if (!tfunction->get_returntype()->is_void()) { @@ -1003,7 +1003,7 @@ void t_py_generator::generate_service_client(t_service* tservice) { indent_up(); if (gen_twisted_) { indent(f_service_) << "self._seqid += 1" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { indent(f_service_) << "d = self._reqs[self._seqid] = defer.Deferred()" << endl; } @@ -1023,7 +1023,7 @@ void t_py_generator::generate_service_client(t_service* tservice) { } f_service_ << ")" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { f_service_ << indent(); if (gen_twisted_) { f_service_ << "return d" << endl; @@ -1085,7 +1085,7 @@ void t_py_generator::generate_service_client(t_service* tservice) { indent_down(); - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { std::string resultname = (*f_iter)->get_name() + "_result"; // Open function f_service_ << @@ -1495,7 +1495,7 @@ void t_py_generator::generate_process_function(t_service* tservice, vector::const_iterator x_iter; // Declare result for non async function - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { f_service_ << indent() << "result = " << resultname << "()" << endl; } @@ -1521,7 +1521,7 @@ void t_py_generator::generate_process_function(t_service* tservice, f_service_ << ")" << endl; // Shortcut out here for async functions - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { f_service_ << indent() << "return d" << endl; indent_down(); @@ -1562,7 +1562,7 @@ void t_py_generator::generate_process_function(t_service* tservice, f_service_ << endl; // Try block for a function with exceptions - if (!tfunction->is_async() && xceptions.size() > 0) { + if (!tfunction->is_oneway() && xceptions.size() > 0) { indent(f_service_) << "def write_results_exception_" << tfunction->get_name() << "(self, error, result, seqid, oprot):" << endl; @@ -1576,7 +1576,7 @@ void t_py_generator::generate_process_function(t_service* tservice, for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) { f_service_ << indent() << "except " << type_name((*x_iter)->get_type()) << ", " << (*x_iter)->get_name() << ":" << endl; - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { indent_up(); f_service_ << indent() << "result." << (*x_iter)->get_name() << " = " << (*x_iter)->get_name() << endl; @@ -1610,7 +1610,7 @@ void t_py_generator::generate_process_function(t_service* tservice, vector::const_iterator f_iter; f_service_ << indent(); - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()) { + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()) { f_service_ << "result.success = "; } f_service_ << @@ -1626,12 +1626,12 @@ void t_py_generator::generate_process_function(t_service* tservice, } f_service_ << ")" << endl; - if (!tfunction->is_async() && xceptions.size() > 0) { + if (!tfunction->is_oneway() && xceptions.size() > 0) { indent_down(); for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) { f_service_ << indent() << "except " << type_name((*x_iter)->get_type()) << ", " << (*x_iter)->get_name() << ":" << endl; - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { indent_up(); f_service_ << indent() << "result." << (*x_iter)->get_name() << " = " << (*x_iter)->get_name() << endl; @@ -1644,7 +1644,7 @@ void t_py_generator::generate_process_function(t_service* tservice, } // Shortcut out here for async functions - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { f_service_ << indent() << "return" << endl; indent_down(); diff --git a/compiler/cpp/src/generate/t_rb_generator.cc b/compiler/cpp/src/generate/t_rb_generator.cc index d23b14a8..6b057f0f 100644 --- a/compiler/cpp/src/generate/t_rb_generator.cc +++ b/compiler/cpp/src/generate/t_rb_generator.cc @@ -744,7 +744,7 @@ void t_rb_generator::generate_service_client(t_service* tservice) { } f_service_ << ")" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { f_service_ << indent(); if (!(*f_iter)->get_returntype()->is_void()) { f_service_ << "return "; @@ -773,7 +773,7 @@ void t_rb_generator::generate_service_client(t_service* tservice) { indent_down(); indent(f_service_) << "end" << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { std::string resultname = capitalize((*f_iter)->get_name() + "_result"); t_struct noargs(program_); @@ -884,7 +884,7 @@ void t_rb_generator::generate_process_function(t_service* tservice, vector::const_iterator x_iter; // Declare result for non async function - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { f_service_ << indent() << "result = " << resultname << ".new()" << endl; } @@ -902,7 +902,7 @@ void t_rb_generator::generate_process_function(t_service* tservice, vector::const_iterator f_iter; f_service_ << indent(); - if (!tfunction->is_async() && !tfunction->get_returntype()->is_void()) { + if (!tfunction->is_oneway() && !tfunction->get_returntype()->is_void()) { f_service_ << "result.success = "; } f_service_ << @@ -918,12 +918,12 @@ void t_rb_generator::generate_process_function(t_service* tservice, } f_service_ << ")" << endl; - if (!tfunction->is_async() && xceptions.size() > 0) { + if (!tfunction->is_oneway() && xceptions.size() > 0) { indent_down(); for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) { f_service_ << indent() << "rescue " << full_type_name((*x_iter)->get_type()) << " => " << (*x_iter)->get_name() << endl; - if (!tfunction->is_async()) { + if (!tfunction->is_oneway()) { indent_up(); f_service_ << indent() << "result." << (*x_iter)->get_name() << " = " << (*x_iter)->get_name() << endl; @@ -934,7 +934,7 @@ void t_rb_generator::generate_process_function(t_service* tservice, } // Shortcut out here for async functions - if (tfunction->is_async()) { + if (tfunction->is_oneway()) { f_service_ << indent() << "return" << endl; indent_down(); diff --git a/compiler/cpp/src/generate/t_st_generator.cc b/compiler/cpp/src/generate/t_st_generator.cc index 576c11e2..960db633 100644 --- a/compiler/cpp/src/generate/t_st_generator.cc +++ b/compiler/cpp/src/generate/t_st_generator.cc @@ -937,14 +937,14 @@ void t_st_generator::generate_service_client(t_service* tservice) { f_ << function_types_comment(*f_iter) << endl << indent() << "self send" << capitalize(signature) << "." << endl; - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { f_ << indent() << "^ self recv" << capitalize(funname) << " success " << endl; } st_close_method(f_); generate_send_method(*f_iter); - if (!(*f_iter)->is_async()) { + if (!(*f_iter)->is_oneway()) { generate_recv_method(*f_iter); } } diff --git a/compiler/cpp/src/parse/t_function.h b/compiler/cpp/src/parse/t_function.h index 4cdd0792..c437d0e2 100644 --- a/compiler/cpp/src/parse/t_function.h +++ b/compiler/cpp/src/parse/t_function.h @@ -23,11 +23,11 @@ class t_function : public t_doc { t_function(t_type* returntype, std::string name, t_struct* arglist, - bool async=false) : + bool oneway=false) : returntype_(returntype), name_(name), arglist_(arglist), - async_(async) { + oneway_(oneway) { xceptions_ = new t_struct(NULL); } @@ -35,14 +35,14 @@ class t_function : public t_doc { std::string name, t_struct* arglist, t_struct* xceptions, - bool async=false) : + bool oneway=false) : returntype_(returntype), name_(name), arglist_(arglist), xceptions_(xceptions), - async_(async) + oneway_(oneway) { - if (async_ && !xceptions_->get_members().empty()) { + if (oneway_ && !xceptions_->get_members().empty()) { throw std::string("Async methods can't throw exceptions."); } } @@ -65,8 +65,8 @@ class t_function : public t_doc { return xceptions_; } - bool is_async() const { - return async_; + bool is_oneway() const { + return oneway_; } private: @@ -74,7 +74,7 @@ class t_function : public t_doc { std::string name_; t_struct* arglist_; t_struct* xceptions_; - bool async_; + bool oneway_; }; #endif -- 2.17.1