diff options
Diffstat (limited to 'cpp/src/slice2objc/Gen.cpp')
-rw-r--r-- | cpp/src/slice2objc/Gen.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/cpp/src/slice2objc/Gen.cpp b/cpp/src/slice2objc/Gen.cpp index c52ea9bbf17..3923e3fabaf 100644 --- a/cpp/src/slice2objc/Gen.cpp +++ b/cpp/src/slice2objc/Gen.cpp @@ -3106,23 +3106,14 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) if(returnType) { _M << nl << outTypeToString(returnType, p->returnIsOptional(), true) << " ret"; - if(!isValueType(returnType)) - { - _M << " = nil;"; - } - else - { - _M << ";"; - } + _M << " = " << defaultValue(returnType, p->returnIsOptional()) << ";"; } if(p->returnsData()) { for(ParamDeclList::const_iterator op = outParams.begin(); op != outParams.end(); ++op) { - if(!isValueType((*op)->type())) - { - _M << nl << "*" << getParamName(*op, true) << " = nil;"; - } + _M << nl << "*" << getParamName(*op, true) << " = " << defaultValue((*op)->type(), (*op)->optional()) + << ";"; } } _M << nl << "if(!ok)"; |