You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2010/08/30 19:09:59 UTC

svn commit: r990866 - in /incubator/thrift/trunk: compiler/cpp/src/generate/t_st_generator.cc compiler/cpp/src/parse/t_program.h test/ThriftTest.thrift

Author: bryanduxbury
Date: Mon Aug 30 17:09:58 2010
New Revision: 990866

URL: http://svn.apache.org/viewvc?rev=990866&view=rev
Log:
THRIFT-877. compiler: smalltalk namespace doesn't work

This patch adds a special case to map 'smalltalk' to 'st' when checking for valid namespace declarations.

Patch: Bruce Lowekamp

Modified:
    incubator/thrift/trunk/compiler/cpp/src/generate/t_st_generator.cc
    incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h
    incubator/thrift/trunk/test/ThriftTest.thrift

Modified: incubator/thrift/trunk/compiler/cpp/src/generate/t_st_generator.cc
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/generate/t_st_generator.cc?rev=990866&r1=990865&r2=990866&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/generate/t_st_generator.cc (original)
+++ incubator/thrift/trunk/compiler/cpp/src/generate/t_st_generator.cc Mon Aug 30 17:09:58 2010
@@ -121,6 +121,7 @@ class t_st_generator : public t_oop_gene
   void st_accessors(std::ofstream &out, std::string cls, std::string name, std::string type);
 
   std::string class_name();
+  static bool is_valid_namespace(const std::string& sub_namespace);
   std::string client_class_name();
   std::string prefix(std::string name);
   std::string declare_field(t_field* tfield);
@@ -181,7 +182,7 @@ string t_st_generator::class_name() {
   return capitalize(program_name_);
 }
 
-static bool is_valid_namespace(const std::string& sub_namespace) {
+bool t_st_generator::is_valid_namespace(const std::string& sub_namespace) {
   return sub_namespace == "prefix" || sub_namespace == "category";
 }
 

Modified: incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h?rev=990866&r1=990865&r2=990866&view=diff
==============================================================================
--- incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h (original)
+++ incubator/thrift/trunk/compiler/cpp/src/parse/t_program.h Mon Aug 30 17:09:58 2010
@@ -164,6 +164,11 @@ class t_program : public t_doc {
     std::string base_language = language.substr(0, sub_index);
     std::string sub_namespace;
 
+    if(base_language == "smalltalk") {
+      pwarning(1, "Namespace 'smalltalk' is deprecated. Use 'st' instead");
+      base_language = "st";
+    }
+
     t_generator_registry::gen_map_t my_copy = t_generator_registry::get_generator_map();
 
     t_generator_registry::gen_map_t::iterator it;

Modified: incubator/thrift/trunk/test/ThriftTest.thrift
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/ThriftTest.thrift?rev=990866&r1=990865&r2=990866&view=diff
==============================================================================
--- incubator/thrift/trunk/test/ThriftTest.thrift (original)
+++ incubator/thrift/trunk/test/ThriftTest.thrift Mon Aug 30 17:09:58 2010
@@ -27,6 +27,7 @@ namespace rb Thrift.Test
 namespace perl ThriftTest
 namespace csharp Thrift.Test
 namespace js ThriftTest
+namespace st ThriftTest
 
 /**
  * Docstring!