diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/slice2swift/Gen.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp index 45eb33c51e7..056786dee5d 100644 --- a/cpp/src/slice2swift/Gen.cpp +++ b/cpp/src/slice2swift/Gen.cpp @@ -888,15 +888,20 @@ Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) string keyParam = "let key: " + keyType; writeMarshalUnmarshalCode(out, p->keyType(), p, keyParam, false); out << nl << "v[key] = nil as " << valueType; + out << nl << "Swift.withUnsafeMutablePointer(to: &v[key, default:nil])"; + out << sb; out << nl << "e.values[i] = Ice.DictEntry<" << keyType << ", " << valueType << ">(" << "key: key, " - << "value: UnsafeMutablePointer<" << valueType << ">(&v[key, default:nil]))"; + << "value: $0)"; + out << eb; writeMarshalUnmarshalCode(out, p->valueType(), p, "e.values[i].value.pointee", false); out << eb; out << nl << "for i in 0..<sz" << sb; - out << nl << "e.values[i].value = Swift.UnsafeMutablePointer<" << valueType - << ">(&v[e.values[i].key, default:nil])"; + out << nl << "Swift.withUnsafeMutablePointer(to: &v[e.values[i].key, default:nil])"; + out << sb; + out << nl << "e.values[i].value = $0"; + out << eb; out << eb; } else |