You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by br...@apache.org on 2011/06/09 02:40:47 UTC
svn commit: r1133617 -
/thrift/trunk/compiler/cpp/src/generate/t_as3_generator.cc
Author: bryanduxbury
Date: Thu Jun 9 00:40:47 2011
New Revision: 1133617
URL: http://svn.apache.org/viewvc?rev=1133617&view=rev
Log:
THRIFT-1180. as3: AS3 compiler generates uncompilable code for binary types.
Switch to ByteArray.
Patch: Ethan Urie
Modified:
thrift/trunk/compiler/cpp/src/generate/t_as3_generator.cc
Modified: thrift/trunk/compiler/cpp/src/generate/t_as3_generator.cc
URL: http://svn.apache.org/viewvc/thrift/trunk/compiler/cpp/src/generate/t_as3_generator.cc?rev=1133617&r1=1133616&r2=1133617&view=diff
==============================================================================
--- thrift/trunk/compiler/cpp/src/generate/t_as3_generator.cc (original)
+++ thrift/trunk/compiler/cpp/src/generate/t_as3_generator.cc Thu Jun 9 00:40:47 2011
@@ -260,6 +260,7 @@ string t_as3_generator::as3_type_imports
return
string() +
"import org.apache.thrift.Set;\n" +
+ "import flash.utils.ByteArray;\n" +
"import flash.utils.Dictionary;\n\n";
}
@@ -864,7 +865,7 @@ void t_as3_generator::generate_as3_struc
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 @@ string t_as3_generator::type_name(t_type
}
/**
- * 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 @@ string t_as3_generator::base_type_name(t
return "void";
case t_base_type::TYPE_STRING:
if (type->is_binary()) {
- return "byte[]";
+ return "ByteArray";
} else {
return "String";
}