Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
0.3
-
None
-
Any.
-
Patch Available
Description
If your thrift definition declares static default values, such as:
struct Chat {
1: MessageType type = EVENT_CHAT,
2: i32 eventId,
3: string message,
4: Date at
}
The generated AS3 object won't compile since the compiler uses the same function that generates member declarations. Patch is below.
Index: compiler/cpp/src/generate/t_as3_generator.cc =================================================================== --- compiler/cpp/src/generate/t_as3_generator.cc (revision 981076) +++ compiler/cpp/src/generate/t_as3_generator.cc (working copy) @@ -696,7 +696,8 @@ for (m_iter = members.begin(); m_iter != members.end(); ++m_iter) { t_type* t = get_true_type((*m_iter)->get_type()); if ((*m_iter)->get_value() != NULL) { - print_const_value(out, "this." + (*m_iter)->get_name(), t, (*m_iter)->get_value(), true, true); + indent(out) << "this._" << (*m_iter)->get_name() << " = " << (*m_iter)->get_value()->get_integer() << ";" << + endl; } } indent_down();