diff options
author | Joe George <joe@zeroc.com> | 2019-04-08 15:02:47 -0400 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2019-04-08 15:02:47 -0400 |
commit | 05b97cc580bd9db9073927cdeec4461d64231231 (patch) | |
tree | 436d827f20c87fbfdd4441f7b2b921c846eb6712 /cpp/src/slice2swift/Gen.cpp | |
parent | Add missing servant functions (diff) | |
download | ice-05b97cc580bd9db9073927cdeec4461d64231231.tar.bz2 ice-05b97cc580bd9db9073927cdeec4461d64231231.tar.xz ice-05b97cc580bd9db9073927cdeec4461d64231231.zip |
Fix for ice_ids
Diffstat (limited to 'cpp/src/slice2swift/Gen.cpp')
-rw-r--r-- | cpp/src/slice2swift/Gen.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp index c9ee78f2091..957ed179816 100644 --- a/cpp/src/slice2swift/Gen.cpp +++ b/cpp/src/slice2swift/Gen.cpp @@ -1383,6 +1383,20 @@ Gen::ObjectExtVisitor::visitClassDefStart(const ClassDefPtr& p) allIds.sort(); allIds.unique(); + ostringstream ids; + + ids << "["; + for(StringList::const_iterator r = allIds.begin(); r != allIds.end(); ++r) + { + if(r != allIds.begin()) + { + ids << ", "; + } + ids << "\"" << (*r) << "\""; + + } + ids << "]"; + out << sp; out << nl << "public extension " << name; @@ -1399,24 +1413,14 @@ Gen::ObjectExtVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl; out << nl << "func ice_ids(current _: Current) throws -> [String]"; out << sb; - out << nl << "return ["; - for(StringList::const_iterator r = allIds.begin(); r != allIds.end(); ++r) - { - if(r != allIds.begin()) - { - out << ", "; - } - out << "\"" << (*r) << "\""; - - } - out << "]"; + out << nl << "return " << ids.str(); out << eb; out << sp; out << nl; out << nl << "func ice_isA(s: String, current _: Current) throws -> Bool"; out << sb; - out << nl << "return s == \"" << p->scoped() << "\""; + out << nl << "return " << ids.str() << ".contains(s)"; out << eb; return true; |