You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ns...@apache.org on 2016/09/25 16:43:44 UTC

[55/55] [abbrv] thrift git commit: THRIFT-3929 php namespace remove tail "\\"

THRIFT-3929 php namespace remove tail "\\"

This closes #1089


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

Branch: refs/heads/master
Commit: 346e23149573dc00da5eb7f415057b0266230010
Parents: 22ec64f
Author: Robert Lu <ro...@gmail.com>
Authored: Thu Sep 15 10:48:16 2016 +0800
Committer: Nobuaki Sukegawa <ns...@apache.org>
Committed: Mon Sep 26 01:42:03 2016 +0900

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


http://git-wip-us.apache.org/repos/asf/thrift/blob/346e2314/compiler/cpp/src/thrift/generate/t_php_generator.cc
----------------------------------------------------------------------
diff --git a/compiler/cpp/src/thrift/generate/t_php_generator.cc b/compiler/cpp/src/thrift/generate/t_php_generator.cc
index ba52781..515e165 100644
--- a/compiler/cpp/src/thrift/generate/t_php_generator.cc
+++ b/compiler/cpp/src/thrift/generate/t_php_generator.cc
@@ -227,11 +227,14 @@ public:
     return (nsglobal_.size() ? NSGLOBAL_AB : NSGLOBAL_B) + (ns.size() ? (ns + "\\") : "");
   }
 
-  // setting the namespace of a file: my\namespace
+  // return the namespace of a file:
+  // global\ns\sub\ns or global\ns or sub\ns
   string php_namespace_suffix(const t_program* p) {
     string ns = php_namespace_base(p);
 
-    return (nsglobal_.size() ? NSGLOBAL_B : NSGLOBAL) + ns;
+    return NSGLOBAL
+      + (ns.size() && NSGLOBAL.size() ? "\\" : "")
+      + ns;
   }
 
   // add a directory to already existing namespace