summaryrefslogtreecommitdiff
path: root/cpp/src/slice2cpp/Gen.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-10-21 05:31:37 +0000
committerMichi Henning <michi@zeroc.com>2003-10-21 05:31:37 +0000
commitc0b113546cc54e6e841c7c69116b158988207386 (patch)
tree7b584465b72387f941438be43be83a5b9c1940a1 /cpp/src/slice2cpp/Gen.cpp
parentImproved tests for code generation. (diff)
downloadice-c0b113546cc54e6e841c7c69116b158988207386.tar.bz2
ice-c0b113546cc54e6e841c7c69116b158988207386.tar.xz
ice-c0b113546cc54e6e841c7c69116b158988207386.zip
Fixed code generation bug.
Diffstat (limited to 'cpp/src/slice2cpp/Gen.cpp')
-rw-r--r--cpp/src/slice2cpp/Gen.cpp30
1 files changed, 15 insertions, 15 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 967a1c78556..876500ab25f 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -2666,7 +2666,7 @@ Slice::Gen::ObjectVisitor::emitGCFunctions(const ClassDefPtr& p)
}
void
-Slice::Gen::ObjectVisitor::emitGCInsertCode(const TypePtr& p, const string& name, const string& prefix, int level)
+Slice::Gen::ObjectVisitor::emitGCInsertCode(const TypePtr& p, const string& prefix, const string& name, int level)
{
if((BuiltinPtr::dynamicCast(p) && BuiltinPtr::dynamicCast(p)->kind() == Builtin::KindObject)
|| ClassDeclPtr::dynamicCast(p))
@@ -2682,7 +2682,7 @@ Slice::Gen::ObjectVisitor::emitGCInsertCode(const TypePtr& p, const string& name
{
if((*i)->type()->usesClasses())
{
- emitGCInsertCode((*i)->type(), fixKwd((*i)->name()), name + ".", ++level);
+ emitGCInsertCode((*i)->type(), prefix + name + ".", fixKwd((*i)->name()), ++level);
}
}
return;
@@ -2695,10 +2695,10 @@ Slice::Gen::ObjectVisitor::emitGCInsertCode(const TypePtr& p, const string& name
tmp << "_i" << level;
string iterName = tmp.str();
C << sb;
- C << nl << "for(" << scoped << "::const_iterator " << iterName << " = " << name
- << ".begin(); " << iterName << " != " << name << ".end(); ++" << iterName << ")";
+ C << nl << "for(" << scoped << "::const_iterator " << iterName << " = " << prefix + name
+ << ".begin(); " << iterName << " != " << prefix + name << ".end(); ++" << iterName << ")";
C << sb;
- emitGCInsertCode(d->valueType(), string("(*") + iterName + ").second", "", ++level);
+ emitGCInsertCode(d->valueType(), "", string("(*") + iterName + ").second", ++level);
C << eb;
C << eb;
return;
@@ -2711,8 +2711,8 @@ Slice::Gen::ObjectVisitor::emitGCInsertCode(const TypePtr& p, const string& name
tmp << "_i" << level;
string iterName = tmp.str();
C << sb;
- C << nl << "for(" << scoped << "::const_iterator " << iterName << " = " << name
- << ".begin(); " << iterName << " != " << name << ".end(); ++" << iterName << ")";
+ C << nl << "for(" << scoped << "::const_iterator " << iterName << " = " << prefix + name
+ << ".begin(); " << iterName << " != " << prefix + name << ".end(); ++" << iterName << ")";
C << sb;
emitGCInsertCode(s->type(), string("(*") + iterName + ")", "", ++level);
C << eb;
@@ -2722,7 +2722,7 @@ Slice::Gen::ObjectVisitor::emitGCInsertCode(const TypePtr& p, const string& name
}
void
-Slice::Gen::ObjectVisitor::emitGCClearCode(const TypePtr& p, const string& name, const string& prefix, int level)
+Slice::Gen::ObjectVisitor::emitGCClearCode(const TypePtr& p, const string& prefix, const string& name, int level)
{
if((BuiltinPtr::dynamicCast(p) && BuiltinPtr::dynamicCast(p)->kind() == Builtin::KindObject)
|| ClassDeclPtr::dynamicCast(p))
@@ -2742,7 +2742,7 @@ Slice::Gen::ObjectVisitor::emitGCClearCode(const TypePtr& p, const string& name,
{
if((*i)->type()->usesClasses())
{
- emitGCClearCode((*i)->type(), fixKwd((*i)->name()), name + ".", ++level);
+ emitGCClearCode((*i)->type(), prefix + name + ".", fixKwd((*i)->name()), ++level);
}
}
return;
@@ -2755,10 +2755,10 @@ Slice::Gen::ObjectVisitor::emitGCClearCode(const TypePtr& p, const string& name,
tmp << "_i" << level;
string iterName = tmp.str();
C << sb;
- C << nl << "for(" << scoped << "::iterator " << iterName << " = " << name
- << ".begin(); " << iterName << " != " << name << ".end(); ++" << iterName << ")";
+ C << nl << "for(" << scoped << "::iterator " << iterName << " = " << prefix + name
+ << ".begin(); " << iterName << " != " << prefix + name << ".end(); ++" << iterName << ")";
C << sb;
- emitGCClearCode(d->valueType(), string("(*") + iterName + ").second", "", ++level);
+ emitGCClearCode(d->valueType(), "", string("(*") + iterName + ").second", ++level);
C << eb;
C << eb;
return;
@@ -2771,10 +2771,10 @@ Slice::Gen::ObjectVisitor::emitGCClearCode(const TypePtr& p, const string& name,
tmp << "_i" << level;
string iterName = tmp.str();
C << sb;
- C << nl << "for(" << scoped << "::iterator " << iterName << " = " << name
- << ".begin(); " << iterName << " != " << name << ".end(); ++" << iterName << ")";
+ C << nl << "for(" << scoped << "::iterator " << iterName << " = " << prefix + name
+ << ".begin(); " << iterName << " != " << prefix + name << ".end(); ++" << iterName << ")";
C << sb;
- emitGCClearCode(s->type(), string("(*") + iterName + ")", "", ++level);
+ emitGCClearCode(s->type(), "", string("(*") + iterName + ")", ++level);
C << eb;
C << eb;
return;