summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cs/Gen.cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2017-05-19 23:53:29 +0200
committerJose <jose@zeroc.com>2017-05-19 23:53:29 +0200
commit13cf84d9b97b376e6e6b4614c1e70faac7a74fbc (patch)
treedfb0434a6de561222d3449a4fa8e6e75d25f32f4 /cpp/src/slice2cs/Gen.cpp
parentICE-7167 - Review javadoc (diff)
downloadice-13cf84d9b97b376e6e6b4614c1e70faac7a74fbc.tar.bz2
ice-13cf84d9b97b376e6e6b4614c1e70faac7a74fbc.tar.xz
ice-13cf84d9b97b376e6e6b4614c1e70faac7a74fbc.zip
Fix slice2cs bug, result struct was not always generated
Diffstat (limited to 'cpp/src/slice2cs/Gen.cpp')
-rw-r--r--cpp/src/slice2cs/Gen.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index bffe8d58049..69d6a3e8c18 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -3392,8 +3392,11 @@ Slice::Gen::ResultVisitor::ResultVisitor(::IceUtilInternal::Output& out)
{
}
+namespace
+{
+
bool
-Slice::Gen::ResultVisitor::visitModuleStart(const ModulePtr& p)
+hasResultType(const ModulePtr& p)
{
ClassList classes = p->classes();
for(ClassList::const_iterator i = classes.begin(); i != classes.end(); ++i)
@@ -3409,13 +3412,35 @@ Slice::Gen::ResultVisitor::visitModuleStart(const ModulePtr& p)
TypePtr ret = op->returnType();
if(outParams.size() > 1 || (ret && outParams.size() > 0))
{
- _out << sp << nl << "namespace " << fixId(p->name());
- _out << sb;
return true;
}
}
}
}
+
+ ModuleList modules = p->modules();
+ for(ModuleList::const_iterator i = modules.begin(); i != modules.end(); ++i)
+ {
+ if(hasResultType(*i))
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+}
+
+bool
+Slice::Gen::ResultVisitor::visitModuleStart(const ModulePtr& p)
+{
+ if(hasResultType(p))
+ {
+ _out << sp << nl << "namespace " << fixId(p->name());
+ _out << sb;
+ return true;
+ }
return false;
}