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/11/28 00:55:40 UTC

thrift git commit: THRIFT-2857 C# generator creates uncompilable code for struct constants Client: C# Patch: Jens Geyer Thanks: Stig Bakken for catching this

Repository: thrift
Updated Branches:
  refs/heads/master 1e7971cff -> eed6a6d65


THRIFT-2857 C# generator creates uncompilable code for struct constants
Client: C#
Patch: Jens Geyer
Thanks: Stig Bakken for catching this

This closes #289

C#: constant assignments where values are structs did not properly
uppercase field names in the Constants constructor


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

Branch: refs/heads/master
Commit: eed6a6d657a131fde14b994fc8f18491c058bfe4
Parents: 1e7971c
Author: Jens Geyer <je...@apache.org>
Authored: Wed Nov 26 20:56:58 2014 +0100
Committer: Jens Geyer <je...@apache.org>
Committed: Fri Nov 28 00:54:55 2014 +0100

----------------------------------------------------------------------
 compiler/cpp/src/generate/t_csharp_generator.cc | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/eed6a6d6/compiler/cpp/src/generate/t_csharp_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_csharp_generator.cc b/compiler/cpp/src/generate/t_csharp_generator.cc
index 4762873..05a084a 100644
--- a/compiler/cpp/src/generate/t_csharp_generator.cc
+++ b/compiler/cpp/src/generate/t_csharp_generator.cc
@@ -503,6 +503,7 @@ void t_csharp_generator::print_const_def_value(std::ofstream& out,
     vector<t_field*>::const_iterator f_iter;
     const map<t_const_value*, t_const_value*>& val = value->get_map();
     map<t_const_value*, t_const_value*>::const_iterator v_iter;
+    prepare_member_name_mapping((t_struct*)type);
     for (v_iter = val.begin(); v_iter != val.end(); ++v_iter) {
       t_field* field = NULL;
       for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
@@ -517,6 +518,7 @@ void t_csharp_generator::print_const_def_value(std::ofstream& out,
       string val = render_const_value(out, name, field_type, v_iter->second);
       indent(out) << name << "." << prop_name(field) << " = " << val << ";" << endl;
     }
+    cleanup_member_name_mapping((t_struct*)type);
   } else if (type->is_map()) {
     t_type* ktype = ((t_map*)type)->get_key_type();
     t_type* vtype = ((t_map*)type)->get_val_type();