You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by je...@apache.org on 2014/01/13 19:56:08 UTC

git commit: THRIFT-2311 Go: invalid code generated when exception name is a go keyword

Updated Branches:
  refs/heads/master 0240572c4 -> a16737a87


THRIFT-2311 Go: invalid code generated when exception name is a go keyword

Patch: Krzysztof Godlewski


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/a16737a8
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/a16737a8
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/a16737a8

Branch: refs/heads/master
Commit: a16737a87f74d5642869d3315f6b44a6b0fc91d3
Parents: 0240572
Author: Jens Geyer <je...@apache.org>
Authored: Mon Jan 13 19:55:44 2014 +0100
Committer: Jens Geyer <je...@apache.org>
Committed: Mon Jan 13 19:55:44 2014 +0100

----------------------------------------------------------------------
 compiler/cpp/src/generate/t_go_generator.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/a16737a8/compiler/cpp/src/generate/t_go_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_go_generator.cc b/compiler/cpp/src/generate/t_go_generator.cc
index bf1a03a..f3d9100 100644
--- a/compiler/cpp/src/generate/t_go_generator.cc
+++ b/compiler/cpp/src/generate/t_go_generator.cc
@@ -1746,9 +1746,12 @@ void t_go_generator::generate_service_client(t_service* tservice)
             vector<t_field*>::const_iterator x_iter;
 
             for (x_iter = xceptions.begin(); x_iter != xceptions.end(); ++x_iter) {
+                const std::string varname = variable_name_to_go_name((*x_iter)->get_name());
+                const std::string pubname = publicize(varname);
+
                 f_service_ <<
-                           indent() << "if " << result << "." << publicize((*x_iter)->get_name()) << " != nil {" << endl <<
-                           indent() << "  " << (*x_iter)->get_name() << " = " << result << "." << publicize((*x_iter)->get_name()) << endl <<
+                           indent() << "if " << result << "." << pubname << " != nil {" << endl <<
+                           indent() << "  " << varname << " = " << result << "." << pubname << endl <<
                            indent() << "}" << endl;
             }