You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jk...@apache.org on 2018/09/13 11:50:34 UTC

[thrift] branch master updated: Better consistency with module names, fix module name for Errors

This is an automated email from the ASF dual-hosted git repository.

jking pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/thrift.git


The following commit(s) were added to refs/heads/master by this push:
     new 612fdd8  Better consistency with module names, fix module name for Errors
612fdd8 is described below

commit 612fdd871c9f4ac9249bf134e4162f408faa8851
Author: Chris Simpson <ap...@gmail.com>
AuthorDate: Tue Sep 4 14:40:30 2018 -0400

    Better consistency with module names, fix module name for Errors
---
 compiler/cpp/src/thrift/generate/t_swift_generator.cc | 17 ++++++++++++-----
 lib/swift/README.md                                   |  2 --
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/compiler/cpp/src/thrift/generate/t_swift_generator.cc b/compiler/cpp/src/thrift/generate/t_swift_generator.cc
index a1d3211..31db04d 100644
--- a/compiler/cpp/src/thrift/generate/t_swift_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_swift_generator.cc
@@ -299,10 +299,10 @@ void t_swift_generator::init_generator() {
   string module = get_real_swift_module(program_);
   string out_dir = get_out_dir();
   string module_path = out_dir;
-  string name = capitalize(program_name_);
+  string name = program_name_;
   if (namespaced_ && !module.empty()) {
     module_path = module_path + "/" + module;
-    name = capitalize(module);
+    name = module;
   }
   MKDIR(module_path.c_str());
 
@@ -1060,7 +1060,7 @@ void t_swift_generator::generate_swift_union_reader(ostream& out, t_struct* tstr
   const vector<t_field*>& fields = tstruct->get_members();
   vector<t_field*>::const_iterator f_iter;
   for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-    indent(out) << "case (" << (*f_iter)->get_key() << ", " << type_to_enum((*f_iter)->get_type()) << "):";// << endl;
+    indent(out) << "case (" << (*f_iter)->get_key() << ", " << type_to_enum((*f_iter)->get_type()) << "):";
     string padding = "";
 
     t_type* type = get_true_type((*f_iter)->get_type());
@@ -1165,7 +1165,7 @@ void t_swift_generator::generate_swift_struct_reader(ostream& out,
 
     // Generate deserialization code for known cases
     for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
-      indent(out) << "case (" << (*f_iter)->get_key() << ", " << type_to_enum((*f_iter)->get_type()) << "):";// << endl;
+      indent(out) << "case (" << (*f_iter)->get_key() << ", " << type_to_enum((*f_iter)->get_type()) << "):";
       string padding = "";
 
       t_type* type = get_true_type((*f_iter)->get_type());
@@ -2414,7 +2414,14 @@ void t_swift_generator::generate_swift_service_server_implementation(ostream& ou
 
       if (!gen_cocoa_) {
         for (x_iter = xfields.begin(); x_iter != xfields.end(); ++x_iter) {
-          indent(out) << "catch let error as " << (*x_iter)->get_type()->get_name();
+          indent(out) << "catch let error as ";
+
+          t_program* program = (*x_iter)->get_type()->get_program();
+          if ((*x_iter)->get_type()->get_name() == "Error" && namespaced_ && program != program_) {
+            out << get_real_swift_module(program) << ".";
+          }
+          out << (*x_iter)->get_type()->get_name();
+
           out << " { result." << (*x_iter)->get_name() << " = error }" << endl;
         }
 
diff --git a/lib/swift/README.md b/lib/swift/README.md
index 2ad88d6..4fdeacf 100644
--- a/lib/swift/README.md
+++ b/lib/swift/README.md
@@ -20,8 +20,6 @@ KIND, either express or implied. See the License for the
 specific language governing permissions and limitations
 under the License.
 
-Brought to you by [FiscalNote, Inc](http://www.fiscalnote.com/)
-
 
 ## Build