summaryrefslogtreecommitdiff
path: root/cpp/src/slice2vb/Gen.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2006-01-18 01:23:57 +0000
committerMichi Henning <michi@zeroc.com>2006-01-18 01:23:57 +0000
commit673415d15e6f990d17de40d413b75ce6fc06a50d (patch)
tree073c6152b62a7de785ccf69a72c4486267113722 /cpp/src/slice2vb/Gen.cpp
parentBug 764 (diff)
downloadice-673415d15e6f990d17de40d413b75ce6fc06a50d.tar.bz2
ice-673415d15e6f990d17de40d413b75ce6fc06a50d.tar.xz
ice-673415d15e6f990d17de40d413b75ce6fc06a50d.zip
Bug 764.
Diffstat (limited to 'cpp/src/slice2vb/Gen.cpp')
-rwxr-xr-xcpp/src/slice2vb/Gen.cpp47
1 files changed, 42 insertions, 5 deletions
diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp
index 1eb4a0ec495..bc5e5f1dba1 100755
--- a/cpp/src/slice2vb/Gen.cpp
+++ b/cpp/src/slice2vb/Gen.cpp
@@ -1845,8 +1845,8 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
_out << sp << nl << "Public Shared Function Repeat(ByVal value As " << s << ", ByVal count As Integer) As " << name;
_out.inc();
- _out << nl << "Dim r As " << name << " = New " << name << "()";
- _out << nl << "For i As Integer = 0 To Count - 1";
+ _out << nl << "Dim r As " << name << " = New " << name << "(count)";
+ _out << nl << "For i As Integer = 0 To count - 1";
_out.inc();
_out << nl << "r.Add(value)";
_out.dec();
@@ -1993,7 +1993,9 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
_out << sp << nl << "Function Clone() As Object Implements _System.ICloneable.Clone";
_out.inc();
- _out << nl << "Return MemberwiseClone()";
+ _out << nl << "Dim s As " << name << " = New " << name;
+ _out << nl << "s.InnerList.AddRange(InnerList)";
+ _out << nl << "Return s";
_out.dec();
_out << nl << "End Function";
@@ -2046,11 +2048,16 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
_out.inc();
if(!isValue)
{
- _out << nl << "If InnerList(i__) Is Nothing And Not CType(other, " << name << ")(i__) Is Nothing Then";
+ _out << nl << "If InnerList(i__) Is Nothing Then";
+ _out.inc();
+ _out << nl << "If Not CType(other, " << name << ")(i__) Is Nothing Then";
_out.inc();
_out << nl << "Return False";
_out.dec();
_out << nl << "End If";
+ _out.dec();
+ _out << nl << "Else";
+ _out.inc();
}
_out << nl << "If Not InnerList(i__).Equals(CType(other, " << name << ")(i__)) Then";
_out.inc();
@@ -2058,6 +2065,11 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p)
_out.dec();
_out << nl << "End If";
_out.dec();
+ if(!isValue)
+ {
+ _out.dec();
+ _out << nl << "End If";
+ }
_out << nl << "Next";
_out << nl << "Return True";
_out.dec();
@@ -2195,7 +2207,21 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
for(q = dataMembers.begin(); q != dataMembers.end(); ++q)
{
string memberName = fixId((*q)->name(), DotNet::ApplicationException);
+ bool isValue = isValueType((*q)->type());
+ if(!isValue)
+ {
+ _out << nl << "If " << memberName << " Is Nothing Then";
+ _out.inc();
+ _out << nl << "If Not (CType(other__, " + name + "))." << memberName << " Is Nothing";
+ _out.inc();
+ _out << nl << "Return False";
+ _out.dec();
+ _out << nl << "End If";
+ _out.dec();
+ _out << nl << "Else";
+ _out.inc();
+ }
_out << nl << "If Not ";
invokeObjectMethod((*q)->type(), memberName, "Equals", "CType(other__, " + name + ")." + memberName);
_out << " Then";
@@ -2203,6 +2229,11 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << nl << "Return False";
_out.dec();
_out << nl << "End If";
+ if(!isValue)
+ {
+ _out.dec();
+ _out << nl << "End If";
+ }
}
_out << nl << "Return True";
_out.dec();
@@ -2956,7 +2987,13 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p)
_out << sp << nl << "Function Clone() As Object Implements _System.ICloneable.Clone";
_out.inc();
- _out << nl << "Return MemberwiseClone()";
+ _out << nl << "Dim d As " << name << " = New " << name;
+ _out << nl << "For Each e As _System.Collections.DictionaryEntry in d";
+ _out.inc();
+ _out << nl << "d.InnerHashtable.Add(e.Key, e.Value)";
+ _out.dec();
+ _out << nl << "Next";
+ _out << nl << "Return d";
_out.dec();
_out << nl << "End Function";