summaryrefslogtreecommitdiff
path: root/cpp/src/slice2swift/SwiftUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/slice2swift/SwiftUtil.cpp')
-rw-r--r--cpp/src/slice2swift/SwiftUtil.cpp40
1 files changed, 30 insertions, 10 deletions
diff --git a/cpp/src/slice2swift/SwiftUtil.cpp b/cpp/src/slice2swift/SwiftUtil.cpp
index ef5453aca20..71e8c21bbf8 100644
--- a/cpp/src/slice2swift/SwiftUtil.cpp
+++ b/cpp/src/slice2swift/SwiftUtil.cpp
@@ -843,7 +843,17 @@ SwiftGenerator::writeMarshalUnmarshalCode(Output &out,
}
else
{
- out << nl << assign << " = try " << stream << "read(" << unmarshalParam << ") as _ObjectPrxI?";
+ // proxy reads requires an additional parameter
+ const string prxType = getUnqualified(getAbsolute(type), swiftModule) + ".self";
+ if(unmarshalParam.empty())
+ {
+ unmarshalParam = prxType;
+ }
+ else
+ {
+ unmarshalParam += ", prx: " + prxType;
+ }
+ out << nl << assign << " = try " << stream << "read(" << unmarshalParam << ")";
}
break;
}
@@ -905,15 +915,16 @@ SwiftGenerator::writeMarshalUnmarshalCode(Output &out,
}
else
{
- out << nl << "try " << stream << "read";
- out << spar;
- if(!unmarshalParam.empty())
+ const string className = getUnqualified(getAbsolute(type), swiftModule);
+ if(unmarshalParam.empty())
{
- out << unmarshalParam;
+ unmarshalParam = className + ".self";
}
- const string className = getUnqualified(getAbsolute(type), swiftModule);
- out << ("value: " + className + ".self");
- out << epar;
+ else
+ {
+ unmarshalParam += ", value: " + className + ".self";
+ }
+ out << nl << "try " << stream << "read(" << unmarshalParam << ")";
out << sb;
out << nl;
if(!declareParam)
@@ -949,8 +960,17 @@ SwiftGenerator::writeMarshalUnmarshalCode(Output &out,
}
else
{
- const string prxI = "_" + getUnqualified(getAbsolute(type), swiftModule) + "I?";
- out << nl << assign << " = try " << stream << "read(" << unmarshalParam << ") as " << prxI ;
+ // proxy reads requires an additional parameter
+ const string prxType = getUnqualified(getAbsolute(type), swiftModule) + ".self";
+ if(unmarshalParam.empty())
+ {
+ unmarshalParam = prxType;
+ }
+ else
+ {
+ unmarshalParam += ", prx: " + prxType;
+ }
+ out << nl << assign << " = try " << stream << "read(" << unmarshalParam << ")";
}
return;
}