Thrift-1432: Javascript struct constants declared in the same file as their struct...
authorJake Farrell <jfarrell@apache.org>
Mon, 21 Nov 2011 13:52:51 +0000 (13:52 +0000)
committerJake Farrell <jfarrell@apache.org>
Mon, 21 Nov 2011 13:52:51 +0000 (13:52 +0000)
Client: js
Patch: Mike Riley

Flips print out of constants and structs within the generator to allow for use of constants within the structs.

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1204495 13f79535-47bb-0310-9956-ffa450edef68

compiler/cpp/src/generate/t_generator.cc

index c91929c..67a3e78 100644 (file)
@@ -45,10 +45,6 @@ void t_generator::generate_program() {
     generate_typedef(*td_iter);
   }
 
-  // Generate constants
-  vector<t_const*> consts = program_->get_consts();
-  generate_consts(consts);
-
   // Generate structs, exceptions, and unions in declared order
   vector<t_struct*> objects = program_->get_objects();
   vector<t_struct*>::iterator o_iter;
@@ -60,6 +56,10 @@ void t_generator::generate_program() {
     }
   }
 
+  // Generate constants
+  vector<t_const*> consts = program_->get_consts();
+  generate_consts(consts);
+
   // Generate services
   vector<t_service*> services = program_->get_services();
   vector<t_service*>::iterator sv_iter;