diff options
author | Benoit Foucher <benoit@zeroc.com> | 2016-08-16 16:37:18 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2016-08-16 16:37:18 +0200 |
commit | 88293201e566c982830482601e878ff4bc643782 (patch) | |
tree | b0ffc2633b8404cde06d4786927b1f6b63024849 /cpp/src/Slice/Parser.cpp | |
parent | Fixed ICE-7273 - C# AMI test failure (diff) | |
download | ice-88293201e566c982830482601e878ff4bc643782.tar.bz2 ice-88293201e566c982830482601e878ff4bc643782.tar.xz ice-88293201e566c982830482601e878ff4bc643782.zip |
C# mapping changes
- user exceptions are no longer checked on the server side (ICE-6980)
- support for ["marshaled-result"] metadata
- AMD operations now return a Task
- improved dispatch interceptors
- PropertiesAdminI::setProperties impl. now invokes callbacks synchronously
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index 5a642a061f1..825c9c8e3fb 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -63,6 +63,39 @@ filterOrderedOptionalDataMembers(const DataMemberList& members) return result; } +bool +isMutableAfterReturnType(const TypePtr& type) +{ + // + // Returns true if the type contains data types which can be referenced by user code + // and mutated after a dispatch returns. + // + + if(ClassDeclPtr::dynamicCast(type)) + { + return true; + } + + BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); + if(builtin && (builtin->kind() == Builtin::KindObject || builtin->kind() == Builtin::KindValue)) + { + return true; + } + + if(SequencePtr::dynamicCast(type) || DictionaryPtr::dynamicCast(type)) + { + return true; + } + + StructPtr s = StructPtr::dynamicCast(type); + if(s) + { + return true; + } + + return false; +} + } namespace Slice @@ -4970,6 +5003,29 @@ Slice::Operation::sendMode() const } } +bool +Slice::Operation::hasMarshaledResult() const +{ + ClassDefPtr cl = ClassDefPtr::dynamicCast(container()); + assert(cl); + if(cl->hasMetaData("marshaled-result") || hasMetaData("marshaled-result")) + { + if(returnType() && isMutableAfterReturnType(returnType())) + { + return true; + } + for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) + { + ParamDeclPtr q = ParamDeclPtr::dynamicCast(*p); + if(q->isOutParam() && isMutableAfterReturnType(q->type())) + { + return true; + } + } + } + return false; +} + ParamDeclPtr Slice::Operation::createParamDecl(const string& name, const TypePtr& type, bool isOutParam, bool optional, int tag) { @@ -5073,6 +5129,36 @@ Slice::Operation::parameters() const return result; } +ParamDeclList +Slice::Operation::inParameters() const +{ + ParamDeclList result; + for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) + { + ParamDeclPtr q = ParamDeclPtr::dynamicCast(*p); + if(!q->isOutParam()) + { + result.push_back(q); + } + } + return result; +} + +ParamDeclList +Slice::Operation::outParameters() const +{ + ParamDeclList result; + for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p) + { + ParamDeclPtr q = ParamDeclPtr::dynamicCast(*p); + if(q->isOutParam()) + { + result.push_back(q); + } + } + return result; +} + ExceptionList Slice::Operation::throws() const { |