[ 
https://issues.apache.org/jira/browse/THRIFT-4558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16441435#comment-16441435
 ] 

ASF GitHub Bot commented on THRIFT-4558:
----------------------------------------

Jens-G closed pull request #1546: THRIFT-4558: normalize name in C# constructor
URL: https://github.com/apache/thrift/pull/1546
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/compiler/cpp/src/thrift/generate/t_csharp_generator.cc 
b/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
index b108c45643..cc2567b7d8 100644
--- a/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_csharp_generator.cc
@@ -843,7 +843,7 @@ void 
t_csharp_generator::generate_csharp_struct_definition(ofstream& out,
         } else {
           out << ", ";
         }
-        out << type_name((*m_iter)->get_type()) << " " << 
(*m_iter)->get_name();
+        out << type_name((*m_iter)->get_type()) << " " << 
normalize_name((*m_iter)->get_name());
       }
     }
     out << ") : this() {" << endl;
@@ -851,7 +851,7 @@ void 
t_csharp_generator::generate_csharp_struct_definition(ofstream& out,
 
     for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
       if (field_is_required((*m_iter))) {
-        indent(out) << "this." << prop_name((*m_iter)) << " = " << 
(*m_iter)->get_name() << ";"
+        indent(out) << "this." << prop_name((*m_iter)) << " = " << 
normalize_name((*m_iter)->get_name()) << ";"
                     << endl;
       }
     }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> reserved Csharp keyword are not escaped when field is required
> --------------------------------------------------------------
>
>                 Key: THRIFT-4558
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4558
>             Project: Thrift
>          Issue Type: Bug
>          Components: C# - Compiler
>    Affects Versions: 0.9.3
>            Reporter: Pierre Mignolet
>            Assignee: Jens Geyer
>            Priority: Major
>
> {code:java}
> struct MeMessage {
>  1: optional string fixed
>  7: required string unchecked
> }{code}
> Here reserved fixed C# keyword is escaped via @ but unchecked is not escaped 
> in C# code so code is just not compilable
> ----
> I had a look in t_csharp_generator.cc and keyword are present and method 
> normalize_name should make the escape



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to