From: Bryan Duxbury Date: Thu, 9 Jun 2011 00:40:47 +0000 (+0000) Subject: THRIFT-1180. as3: AS3 compiler generates uncompilable code for binary types. X-Git-Tag: 0.7.0~71 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=7a79d39957376b7435a713227963dcb90a7ef3f5;p=common%2Fthrift.git 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 e8d99ffc..422af07d 100644 --- a/compiler/cpp/src/generate/t_as3_generator.cc +++ b/compiler/cpp/src/generate/t_as3_generator.cc @@ -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_struct_reader(ofstream& out, 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* ttype, bool in_container, bool in_init } /** - * 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_base_type* type, return "void"; case t_base_type::TYPE_STRING: if (type->is_binary()) { - return "byte[]"; + return "ByteArray"; } else { return "String"; }