diff options
author | Joe George <joe@zeroc.com> | 2019-03-13 13:45:00 -0400 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2019-03-13 13:45:00 -0400 |
commit | 0455a7b70838f3113b158cd8bf2f4dd3b3d710ad (patch) | |
tree | 24d84665223d8b476b06143c49e3806f7f7173de /cpp/src/slice2swift/Gen.cpp | |
parent | More proxy operation fixes (diff) | |
download | ice-0455a7b70838f3113b158cd8bf2f4dd3b3d710ad.tar.bz2 ice-0455a7b70838f3113b158cd8bf2f4dd3b3d710ad.tar.xz ice-0455a7b70838f3113b158cd8bf2f4dd3b3d710ad.zip |
Fix optional return unmarshaling
Diffstat (limited to 'cpp/src/slice2swift/Gen.cpp')
-rw-r--r-- | cpp/src/slice2swift/Gen.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp index 172609663f8..4122956577b 100644 --- a/cpp/src/slice2swift/Gen.cpp +++ b/cpp/src/slice2swift/Gen.cpp @@ -994,7 +994,7 @@ Gen::ProxyVisitor::visitOperation(const OperationPtr& op) // Unmarshal parameters // 1. required // 2. return - // 3. optional + // 3. optional (including optional return) // if(useInputStream) { @@ -1007,18 +1007,24 @@ Gen::ProxyVisitor::visitOperation(const OperationPtr& op) returnVals.push_back((*q)->name()); } - if(returnType) + if(returnType && !op->returnIsOptional()) { - int tag = op->returnIsOptional() ? op->returnTag() : -1; - writeMarshalUnmarshalCode(out, returnType, typeToString(returnType, op), "ret", false, true, false, tag); + writeMarshalUnmarshalCode(out, returnType, typeToString(returnType, op), "ret", false, true, false); returnVals.push_front("ret"); } for(ParamDeclList::const_iterator q = optionalOutParams.begin(); q != optionalOutParams.end(); ++q) { ParamDeclPtr param = *q; - ContainedPtr topLevel = getTopLevelModule(ContainedPtr::dynamicCast(param)); assert(param->optional()); + + if(returnType && op->returnIsOptional() && op->returnTag() < param->tag()) + { + writeMarshalUnmarshalCode(out, returnType, typeToString(returnType, op), "ret", false, true, false, op->returnTag()); + returnVals.push_front("ret"); + } + + ContainedPtr topLevel = getTopLevelModule(ContainedPtr::dynamicCast(param)); writeMarshalUnmarshalCode(out, param, topLevel, false, true, false, param->tag()); returnVals.push_back((*q)->name()); } |