THRIFT-868. Make const values work properly with typdefs

Just requires calling get_true_type in the right spot.  Because "the
right spot" is under src/parse, get_true_type had to be moed from
t_generator to t_type.

git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1004703 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/parse/t_scope.h b/compiler/cpp/src/parse/t_scope.h
index 01894aa..4617bf8 100644
--- a/compiler/cpp/src/parse/t_scope.h
+++ b/compiler/cpp/src/parse/t_scope.h
@@ -115,8 +115,11 @@
           throw "No enum value or constant found named \"" + const_val->get_identifier() + "\"!";
         }
 
-        if (constant->get_type()->is_base_type()) {
-          switch (((t_base_type*)constant->get_type())->get_base()) {
+        // Resolve typedefs to the underlying type
+        t_type* const_type = constant->get_type()->get_true_type();
+
+        if (const_type->is_base_type()) {
+          switch (((t_base_type*)const_type)->get_base()) {
             case t_base_type::TYPE_I16:
             case t_base_type::TYPE_I32:
             case t_base_type::TYPE_I64:
@@ -133,7 +136,7 @@
             case t_base_type::TYPE_VOID:
               throw "Constants cannot be of type VOID";
           }
-        } else if (constant->get_type()->is_map()) {
+        } else if (const_type->is_map()) {
           const std::map<t_const_value*, t_const_value*>& map = constant->get_value()->get_map();
           std::map<t_const_value*, t_const_value*>::const_iterator v_iter;
 
@@ -141,7 +144,7 @@
           for (v_iter = map.begin(); v_iter != map.end(); ++v_iter) {
             const_val->add_map(v_iter->first, v_iter->second);
           }
-        } else if (constant->get_type()->is_list()) {
+        } else if (const_type->is_list()) {
           const std::vector<t_const_value*>& val = constant->get_value()->get_list();
           std::vector<t_const_value*>::const_iterator v_iter;