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 2011/06/09 23:35:11 UTC

svn commit: r1134093 - /thrift/trunk/compiler/cpp/src/generate/t_js_generator.cc

Author: roger
Date: Thu Jun  9 21:35:11 2011
New Revision: 1134093

URL: http://svn.apache.org/viewvc?rev=1134093&view=rev
Log:
THRIFT-1200 js: JS compiler generates code that clobbers existing namespaces
fix broken build(jslint) introduced with original patch

Modified:
    thrift/trunk/compiler/cpp/src/generate/t_js_generator.cc

Modified: thrift/trunk/compiler/cpp/src/generate/t_js_generator.cc
URL: http://svn.apache.org/viewvc/thrift/trunk/compiler/cpp/src/generate/t_js_generator.cc?rev=1134093&r1=1134092&r2=1134093&view=diff
==============================================================================
--- thrift/trunk/compiler/cpp/src/generate/t_js_generator.cc (original)
+++ thrift/trunk/compiler/cpp/src/generate/t_js_generator.cc Thu Jun  9 21:35:11 2011
@@ -277,7 +277,9 @@ void t_js_generator::init_generator() {
   if( ns_pieces.size() > 0){
     for(size_t i = 0; i < ns_pieces.size(); ++i) {
       pns += ((i == 0) ? "" : ".") + ns_pieces[i];
-      f_types_ << "if (typeof " << pns << " === 'undefined') " << pns << " = {};" << endl;
+      f_types_ << "if (typeof " << pns << " === 'undefined') {" << endl;
+        f_types_ << "  " << pns << " = {};" << endl;
+        f_types_ << "}" << endl;
     }
   }