THRIFT-1180. as3: AS3 compiler generates uncompilable code for binary types.
Switch to ByteArray.
Patch: Ethan Urie
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1133617 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/compiler/cpp/src/generate/t_as3_generator.cc b/compiler/cpp/src/generate/t_as3_generator.cc
index e8d99ff..422af07 100644
--- a/compiler/cpp/src/generate/t_as3_generator.cc
+++ b/compiler/cpp/src/generate/t_as3_generator.cc
@@ -260,6 +260,7 @@
return
string() +
"import org.apache.thrift.Set;\n" +
+ "import flash.utils.ByteArray;\n" +
"import flash.utils.Dictionary;\n\n";
}
@@ -864,7 +865,7 @@
for (f_iter = fields.begin(); f_iter != fields.end(); ++f_iter) {
if ((*f_iter)->get_req() == t_field::T_REQUIRED && !type_can_be_null((*f_iter)->get_type())) {
out <<
- indent() << "if (!__isset." << (*f_iter)->get_name() << ") {" << endl <<
+ indent() << "if (!__isset_" << (*f_iter)->get_name() << ") {" << endl <<
indent() << " throw new TProtocolError(TProtocolError.UNKNOWN, \"Required field '" << (*f_iter)->get_name() << "' was not found in serialized data! Struct: \" + toString());" << endl <<
indent() << "}" << endl;
}
@@ -2423,7 +2424,7 @@
}
/**
- * Returns the C++ type that corresponds to the thrift type.
+ * Returns the AS3 type that corresponds to the thrift type.
*
* @param tbase The base type
* @param container Is it going in a As3 container?
@@ -2438,7 +2439,7 @@
return "void";
case t_base_type::TYPE_STRING:
if (type->is_binary()) {
- return "byte[]";
+ return "ByteArray";
} else {
return "String";
}