diff options
author | Jose <jose@zeroc.com> | 2019-04-01 18:10:31 +0200 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2019-04-01 18:10:31 +0200 |
commit | 3644f17be80ba9a7d0b134d9c06403d667a3eaee (patch) | |
tree | 92d331ab51e3f36de06a6902c6ff57226e30d0be /cpp/src | |
parent | Add objects slicing test (diff) | |
download | ice-3644f17be80ba9a7d0b134d9c06403d667a3eaee.tar.bz2 ice-3644f17be80ba9a7d0b134d9c06403d667a3eaee.tar.xz ice-3644f17be80ba9a7d0b134d9c06403d667a3eaee.zip |
Fixes for check if a structure type contains class members
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/slice2swift/SwiftUtil.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/cpp/src/slice2swift/SwiftUtil.cpp b/cpp/src/slice2swift/SwiftUtil.cpp index e5e6c98030c..d9a733ad028 100644 --- a/cpp/src/slice2swift/SwiftUtil.cpp +++ b/cpp/src/slice2swift/SwiftUtil.cpp @@ -658,20 +658,35 @@ SwiftGenerator::containsClassMembers(const StructPtr& s) DataMemberList dm = s->dataMembers(); for(DataMemberList::const_iterator i = dm.begin(); i != dm.end(); ++i) { - BuiltinPtr builtin = BuiltinPtr::dynamicCast((*i)->type()); - - if(builtin && (builtin->kind() == Builtin::KindObject || - builtin->kind() == Builtin::KindValue)) + if(isClassType((*i)->type())) { return true; } - else if(ClassDefPtr::dynamicCast((*i)->type())) + + StructPtr st = StructPtr::dynamicCast((*i)->type()); + if(st && containsClassMembers(st)) { return true; } - else if(StructPtr::dynamicCast((*i)->type()) && containsClassMembers(StructPtr::dynamicCast((*i)->type()))) + + SequencePtr seq = SequencePtr::dynamicCast((*i)->type()); + if(seq) { - return true; + st = StructPtr::dynamicCast(seq->type()); + if(isClassType(seq->type()) || (st && containsClassMembers(st))) + { + return true; + } + } + + DictionaryPtr dict = DictionaryPtr::dynamicCast((*i)->type()); + if(dict) + { + st = StructPtr::dynamicCast(dict->valueType()); + if(isClassType(dict->valueType()) || (st && containsClassMembers(st))) + { + return true; + } } } return false; |