diff options
author | Jose <jose@zeroc.com> | 2019-04-20 00:44:40 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2019-04-20 00:44:40 +0200 |
commit | 7b881d593363ebb21cef24a3dcb0ec32c05798b3 (patch) | |
tree | 730610b82e784847c9b9f587daa18462e21bb635 /cpp/src/slice2swift/SwiftUtil.cpp | |
parent | Ice/objects test fixes (diff) | |
download | ice-7b881d593363ebb21cef24a3dcb0ec32c05798b3.tar.bz2 ice-7b881d593363ebb21cef24a3dcb0ec32c05798b3.tar.xz ice-7b881d593363ebb21cef24a3dcb0ec32c05798b3.zip |
Fix dispatch marshal ordering
Diffstat (limited to 'cpp/src/slice2swift/SwiftUtil.cpp')
-rw-r--r-- | cpp/src/slice2swift/SwiftUtil.cpp | 60 |
1 files changed, 23 insertions, 37 deletions
diff --git a/cpp/src/slice2swift/SwiftUtil.cpp b/cpp/src/slice2swift/SwiftUtil.cpp index 0d467ad576a..af725c68660 100644 --- a/cpp/src/slice2swift/SwiftUtil.cpp +++ b/cpp/src/slice2swift/SwiftUtil.cpp @@ -1426,18 +1426,6 @@ SwiftGenerator::getAllOutParams(const OperationPtr& op) ParamDeclList params = op->outParameters(); ParamInfoList l; - if(op->returnType()) - { - ParamInfo info; - info.name = operationReturnTypeLabel(op); - info.fixedName = info.name; - info.type = op->returnType(); - info.typeStr = typeToString(info.type, op, op->getMetaData(), op->returnIsOptional()); - info.optional = op->returnIsOptional(); - info.tag = op->returnTag(); - l.push_back(info); - } - for(ParamDeclList::const_iterator p = params.begin(); p != params.end(); ++p) { ParamInfo info; @@ -1451,6 +1439,18 @@ SwiftGenerator::getAllOutParams(const OperationPtr& op) l.push_back(info); } + if(op->returnType()) + { + ParamInfo info; + info.name = operationReturnTypeLabel(op); + info.fixedName = info.name; + info.type = op->returnType(); + info.typeStr = typeToString(info.type, op, op->getMetaData(), op->returnIsOptional()); + info.optional = op->returnIsOptional(); + info.tag = op->returnTag(); + l.push_back(info); + } + return l; } @@ -1567,36 +1567,17 @@ SwiftGenerator::writeUnmarshalOutParams(::IceUtilInternal::Output& out, const Op out.inc(); for(ParamInfoList::const_iterator q = requiredOutParams.begin(); q != requiredOutParams.end(); ++q) { - if(q->param) - { - string param; - if(isClassType(q->type)) - { - out << nl << "var " << q->fixedName << ": " << q->typeStr; - param = q->fixedName; - } - else - { - param = "let " + q->fixedName + ": " + q->typeStr; - } - writeMarshalUnmarshalCode(out, q->type, op, param, false); - } - } - - if(returnType && !op->returnIsOptional()) - { - ParamInfo r = requiredOutParams.front(); string param; - if(isClassType(r.type)) + if(isClassType(q->type)) { - out << nl << "var " << r.fixedName << ": " << r.typeStr; - param = r.fixedName; + out << nl << "var " << q->fixedName << ": " << q->typeStr; + param = q->fixedName; } else { - param = "let " + r.fixedName + ": " + r.typeStr; + param = "let " + q->fixedName + ": " + q->typeStr; } - writeMarshalUnmarshalCode(out, r.type, op, param, false); + writeMarshalUnmarshalCode(out, q->type, op, param, false); } for(ParamInfoList::const_iterator q = optionalOutParams.begin(); q != optionalOutParams.end(); ++q) @@ -1625,9 +1606,14 @@ SwiftGenerator::writeUnmarshalOutParams(::IceUtilInternal::Output& out, const Op out << spar; } + out << operationReturnTypeLabel(op); + for(ParamInfoList::const_iterator q = allOutParams.begin(); q != allOutParams.end(); ++q) { - out << q->fixedName; + if(q->param) + { + out << q->fixedName; + } } if(allOutParams.size() > 1) |