You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2014/07/16 20:16:43 UTC

[2/3] git commit: THRIFT-2627:erlang backend doesn't support corecursive structs client: erlang patch: anthony molinari

THRIFT-2627:erlang backend doesn't support corecursive structs client: erlang patch: anthony molinari

add additional type specifications to generated erlang files to support
corecursive structs


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

Branch: refs/heads/master
Commit: c437cff08f0013aa832d2efa871539f5d2a04891
Parents: cb3f3f3
Author: alisdair sullivan <al...@yahoo.ca>
Authored: Mon Jul 14 21:57:14 2014 -0700
Committer: Roger Meier <ro...@apache.org>
Committed: Wed Jul 16 20:09:49 2014 +0200

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


http://git-wip-us.apache.org/repos/asf/thrift/blob/c437cff0/compiler/cpp/src/generate/t_erl_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/generate/t_erl_generator.cc b/compiler/cpp/src/generate/t_erl_generator.cc
index ae1a122..67242ea 100644
--- a/compiler/cpp/src/generate/t_erl_generator.cc
+++ b/compiler/cpp/src/generate/t_erl_generator.cc
@@ -508,7 +508,7 @@ string t_erl_generator::render_member_type(t_field * field) {
   } else if (type->is_enum()) {
     return "integer()";
   } else if (type->is_struct() || type->is_xception()) {
-    return "#" + uncapitalize(type->get_name()) + "{}";
+    return uncapitalize(type->get_name()) + "()";
   } else if (type->is_map()) {
     return "dict()";
   } else if (type->is_set()) {
@@ -577,7 +577,10 @@ void t_erl_generator::generate_erl_struct_definition(ostream& out, t_struct* tst
   }
   buf << "}).";
 
-  out << buf.str() << endl << endl;
+  out << buf.str() << endl;
+  out <<
+    "-type "+type_name (tstruct) << "() :: #" + type_name (tstruct) + "{}."
+      << endl << endl;
 }
 
 /**