You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@thrift.apache.org by GitBox <gi...@apache.org> on 2021/01/14 12:54:01 UTC

[GitHub] [thrift] lsjbd commented on a change in pull request #369: THRIFT-2189 add union support for go generator

lsjbd commented on a change in pull request #369:
URL: https://github.com/apache/thrift/pull/369#discussion_r557373465



##########
File path: compiler/cpp/src/generate/t_go_generator.cc
##########
@@ -1233,6 +1249,46 @@ void t_go_generator::generate_isset_helpers(ofstream& out,
   }
 }
 
+/**
+ * Generates the CountSetFields helper method for a struct
+ */
+void t_go_generator::generate_countsetfields_helper(ofstream& out,
+                                            t_struct* tstruct,
+                                            const string& tstruct_name,
+                                            bool is_result) {
+  (void)is_result;
+  const vector<t_field*>& fields = tstruct->get_members();
+  vector<t_field*>::const_iterator f_iter;
+  const string escaped_tstruct_name(escape_string(tstruct->get_name()));
+
+  out << indent() << "func (p *" << tstruct_name << ") CountSetFields" << tstruct_name

Review comment:
       What is the purpose to use the struct name as a suffix for the method? To avoid name confliction?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org