Repository: thrift Updated Branches: refs/heads/master 73464aceb -> 91b3b1a6b
THRIFT-2558: CSharp gen tries to add str + int Client: C# Compiler Patch: Randy Abernethy The C# generator attempts to throw a str + int string in several places producing undesirable results. This patch uses stringstream to concatenate the string representations. Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/91b3b1a6 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/91b3b1a6 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/91b3b1a6 Branch: refs/heads/master Commit: 91b3b1a6b204b381d6ccea1016b6900667ac1a6c Parents: 73464ac Author: ra <[email protected]> Authored: Fri May 30 06:31:00 2014 -0700 Committer: ra <[email protected]> Committed: Fri May 30 06:31:00 2014 -0700 ---------------------------------------------------------------------- compiler/cpp/src/generate/t_csharp_generator.cc | 24 ++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/91b3b1a6/compiler/cpp/src/generate/t_csharp_generator.cc ---------------------------------------------------------------------- diff --git a/compiler/cpp/src/generate/t_csharp_generator.cc b/compiler/cpp/src/generate/t_csharp_generator.cc index 5d6fb16..617cbf0 100644 --- a/compiler/cpp/src/generate/t_csharp_generator.cc +++ b/compiler/cpp/src/generate/t_csharp_generator.cc @@ -464,7 +464,11 @@ std::string t_csharp_generator::render_const_value(ofstream& out, string name, t } break; default: - throw "compiler error: no const of base type " + tbase; + { + std::stringstream ss; + ss << "compiler error: no const of base type " << tbase; + throw ss.str(); + } } } else if (type->is_enum()) { render << type->get_name() << "." << value->get_identifier_name(); @@ -2034,7 +2038,11 @@ void t_csharp_generator::generate_deserialize_field(ofstream& out, t_field* tfie out << "ReadDouble();"; break; default: - throw "compiler error: no C# name for base type " + tbase; + { + std::stringstream ss; + ss << "compiler error: no C# name for base type " << tbase; + throw ss.str(); + } } } else if (type->is_enum()) { out << "ReadI32();"; @@ -2209,7 +2217,11 @@ void t_csharp_generator::generate_deserialize_list_element(ofstream& out, t_list out << "WriteDouble(" << nullable_name << ");"; break; default: - throw "compiler error: no C# name for base type " + tbase; + { + std::stringstream ss; + ss << "compiler error: no C# name for base type " << tbase; + throw ss.str(); + } } } else if (type->is_enum()) { out << "WriteI32((int)" << nullable_name << ");"; @@ -2453,7 +2465,11 @@ string t_csharp_generator::base_type_name(t_base_type* tbase, bool in_container, case t_base_type::TYPE_DOUBLE: return "double" + postfix; default: - throw "compiler error: no C# name for base type " + tbase->get_base(); + { + std::stringstream ss; + ss << "compiler error: no C# name for base type " << tbase->get_base(); + throw ss.str(); + } } }
