throw "compiler error: no const of base type " + tbase;
}
} else if (type->is_enum()) {
- render << value->get_integer();
+ render << "(" << type->get_name() << ")" << value->get_integer();
} else {
string t = tmp("tmp");
indent(out) << type_name(type) << " " << t << ";" << endl;
while (t->is_typedef()) {
t = ((t_typedef*)t)->get_type();
}
- if (t->is_base_type() || t->is_enum()) {
+ if (t->is_base_type()) {
string dval;
if (t->is_enum()) {
dval += "(" + t->get_name() + ")";
}
out << " {" << endl;
indent_up();
+ // TODO(dreiss): When everything else in Thrift is perfect,
+ // do more of these in the initializer list.
for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) {
t_type* t = (*m_iter)->get_type();
while (t->is_typedef()) {
"using namespace facebook::thrift::protocol;" << endl <<
"using namespace facebook::thrift::transport;" << endl <<
"using namespace facebook::thrift::server;" << endl <<
+ endl <<
+ "using boost::shared_ptr;" << endl <<
endl;
if (!ns.empty()) {
TWO = 2
}
-const map<i32,string> GEN_ENUM_NAMES = {ONE : "HOWDY", TWO: PARTNER}
+struct thing2 {
+ 1: constants val = TWO
+}
+
+const map<constants,string> GEN_ENUM_NAMES = {ONE : "HOWDY", TWO: PARTNER}
const i32 hex_const = 0x0001F