Bad AS3 syntax in constructors that set default values
------------------------------------------------------
Key: THRIFT-835
URL: https://issues.apache.org/jira/browse/THRIFT-835
Project: Thrift
Issue Type: Bug
Affects Versions: 0.3
Environment: Any.
Reporter: Justin Florentine
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();
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.