summaryrefslogtreecommitdiff
path: root/cpp/src/slice2swift/Gen.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2019-05-02 23:13:53 -0400
committerBernard Normier <bernard@zeroc.com>2019-05-03 12:17:54 -0400
commita84741318088250b34e20e46a6de10b4084c806d (patch)
tree53b7f58dd52f280ac2bfcfc11d630abe20f83053 /cpp/src/slice2swift/Gen.cpp
parentRegenerate test projects (diff)
downloadice-a84741318088250b34e20e46a6de10b4084c806d.tar.bz2
ice-a84741318088250b34e20e46a6de10b4084c806d.tar.xz
ice-a84741318088250b34e20e46a6de10b4084c806d.zip
Refactor handling of numeric types in InputStream and OutputStream
Diffstat (limited to 'cpp/src/slice2swift/Gen.cpp')
-rw-r--r--cpp/src/slice2swift/Gen.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp
index fd856e8af8f..a1e79ac6bf7 100644
--- a/cpp/src/slice2swift/Gen.cpp
+++ b/cpp/src/slice2swift/Gen.cpp
@@ -869,8 +869,7 @@ Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << sp;
out << nl << "func read() throws -> " << name;
out << sb;
- out << nl << "var rawValue = " << enumType << "()";
- out << nl << "try read(enum: &rawValue, maxValue: " << p->maxValue() << ")";
+ out << nl << "let rawValue: " << enumType << " = try read(enumMaxValue: " << p->maxValue() << ")";
out << nl << "guard let val = " << name << "(rawValue: rawValue) else";
out << sb;
out << nl << "throw " << getUnqualified("Ice.MarshalException", swiftModule) << "(reason: \"invalid enum value\")";