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/parse.cc b/compiler/cpp/src/parse/parse.cc
index 2570c37..a655652 100644
--- a/compiler/cpp/src/parse/parse.cc
+++ b/compiler/cpp/src/parse/parse.cc
@@ -1,4 +1,5 @@
#include "t_type.h"
+#include "t_typedef.h"
#include "md5.h"
@@ -9,3 +10,11 @@
md5_append(&ctx, (md5_byte_t*)(material.data()), (int)material.size());
md5_finish(&ctx, (md5_byte_t*)fingerprint_);
}
+
+t_type* t_type::get_true_type() {
+ t_type* type = this;
+ while (type->is_typedef()) {
+ type = ((t_typedef*)type)->get_type();
+ }
+ return type;
+}