summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp/Gen.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2012-09-24 16:00:56 -0700
committerMark Spruiell <mes@zeroc.com>2012-09-24 16:00:56 -0700
commit6bb0a7b82684d1ce59a996848773054ede1f442e (patch)
tree9a9cfbaa225afd5caca819eea9558908c9a64a40 /cpp/src/slice2cpp/Gen.cpp
parentReplaced optionalType in StreamTrait<> by a bool fixedLength member (diff)
downloadice-6bb0a7b82684d1ce59a996848773054ede1f442e.tar.bz2
ice-6bb0a7b82684d1ce59a996848773054ede1f442e.tar.xz
ice-6bb0a7b82684d1ce59a996848773054ede1f442e.zip
Ruby port; Python & C++ fixes
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index e46b5aeae43..1edb081c9ad 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -4581,7 +4581,17 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
{
if((*i)->type()->usesClasses())
{
- emitGCInsertCode((*i)->type(), getDataMemberRef(*i), "", 0);
+ if((*i)->optional())
+ {
+ C << nl << "if(" << fixKwd((*i)->name()) << ')';
+ C << sb;
+ emitGCInsertCode((*i)->type(), getDataMemberRef(*i), "", 0);
+ C << eb;
+ }
+ else
+ {
+ emitGCInsertCode((*i)->type(), getDataMemberRef(*i), "", 0);
+ }
}
}
C << eb;
@@ -4617,7 +4627,17 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
{
if((*j)->type()->usesClasses())
{
- emitGCClearCode((*j)->type(), getDataMemberRef(*j), "", 0);
+ if((*j)->optional())
+ {
+ C << nl << "if(" << fixKwd((*j)->name()) << ')';
+ C << sb;
+ emitGCClearCode((*j)->type(), getDataMemberRef(*j), "", 0);
+ C << eb;
+ }
+ else
+ {
+ emitGCClearCode((*j)->type(), getDataMemberRef(*j), "", 0);
+ }
}
}
C << eb;