diff options
Diffstat (limited to 'cpp')
-rwxr-xr-x | cpp/src/Slice/VbUtil.cpp | 126 | ||||
-rwxr-xr-x | cpp/src/slice2vb/Gen.cpp | 10 |
2 files changed, 70 insertions, 66 deletions
diff --git a/cpp/src/Slice/VbUtil.cpp b/cpp/src/Slice/VbUtil.cpp index 7d934b1fd5a..21bbea296e9 100755 --- a/cpp/src/Slice/VbUtil.cpp +++ b/cpp/src/Slice/VbUtil.cpp @@ -513,10 +513,10 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << nl << "Else"; out.inc(); out << nl << stream << ".writeSize(" << param << '.' << limitID << ")"; - out << nl << "For __i As Integer = 0 To " << param << '.' << limitID << " - 1"; + out << nl << "For __ix As Integer = 0 To " << param << '.' << limitID << " - 1"; out.inc(); string func = builtin->kind() == Builtin::KindObject ? "writeObject" : "writeProxy"; - out << nl << stream << '.' << func << '(' << param << "(__i))"; + out << nl << stream << '.' << func << '(' << param << "(__ix))"; out.dec(); out << nl << "Next"; out.dec(); @@ -524,23 +524,25 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } else { - out << nl << "Dim __len As Integer = " << stream << ".readSize()"; + out << nl << "For __block As Integer = 0 To 0"; + out.inc(); + out << nl << "Dim __lenx As Integer = " << stream << ".readSize()"; out << nl << stream << ".startSeq(__len, " << static_cast<unsigned>(builtin->minWireSize()) << ")"; out << nl << param << " = New "; if(builtin->kind() == Builtin::KindObject) { if(isArray) { - out << "Ice.Object(__len - 1) {}"; + out << "Ice.Object(__lenx - 1) {}"; } else { out << typeToString(seq); } - out << nl << "For __i As Integer = 0 To __len - 1"; + out << nl << "For __ix As Integer = 0 To __lenx - 1"; out.inc(); out << nl << stream << ".readObject(New IceInternal.SequencePatcher(" - << param << ", GetType(Ice.Object), __i))"; + << param << ", GetType(Ice.Object), __ix))"; out.dec(); out << nl << "Next"; } @@ -548,21 +550,23 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, { if(isArray) { - out << "Ice.ObjectPrx(__len - 1) {}"; + out << "Ice.ObjectPrx(__lenx - 1) {}"; } else { out << typeToString(seq); } - out << nl << "For __i As Integer = 0 To __len - 1"; + out << nl << "For __ix As Integer = 0 To __lenx - 1"; out.inc(); - out << nl << param << "(__i) = " << stream << ".readProxy()"; + out << nl << param << "(__ix) = " << stream << ".readProxy()"; out.dec(); out << nl << "Next"; } out << nl << stream << ".checkSeq()"; out << nl << stream << ".endElement()"; - out << nl << stream << ".endSeq(__len)"; + out << nl << stream << ".endSeq(__lenx)"; + out.dec(); + out << nl << "Next"; } break; } @@ -600,76 +604,76 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, ClassDeclPtr cl = ClassDeclPtr::dynamicCast(type); if(cl) { + out << nl << "For __block As Integer = 0 To 0"; + out.inc(); if(marshal) { out << nl << stream << ".writeSize(" << param << '.' << limitID << ")"; - out << nl << "For __i As Integer = 0 To " << param << '.' << limitID << " - 1"; + out << nl << "For __ix As Integer = 0 To " << param << '.' << limitID << " - 1"; out.inc(); - out << nl << stream << ".writeObject(" << param << "(__i))"; + out << nl << stream << ".writeObject(" << param << "(__ix))"; out.dec(); out << nl << "Next"; } else { - out << nl << "For __block As Integer = 0 To 0"; - out.inc(); - out << nl << "Dim sz As Integer = " << stream << ".readSize()"; - out << nl << stream << ".startSeq(sz, " << static_cast<unsigned>(type->minWireSize()) << ')'; + out << nl << "Dim szx As Integer = " << stream << ".readSize()"; + out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')'; out << nl << param << " = New "; if(isArray) { - out << toArrayAlloc(typeS + "()", "sz - 1") << " {}"; + out << toArrayAlloc(typeS + "()", "szx - 1") << " {}"; } else { - out << fixId(seq->scoped()) << "(sz)"; + out << fixId(seq->scoped()) << "(szx)"; } - out << nl << "For i As Integer = 0 To sz - 1"; + out << nl << "For ix As Integer = 0 To sz - 1"; out.inc(); - out << nl << "Dim sp As IceInternal.SequencePatcher = New IceInternal.SequencePatcher(" - << param << ", " << "GetType(" << typeS << "), i)"; - out << nl << stream << ".readObject(sp)"; + out << nl << "Dim spx As IceInternal.SequencePatcher = New IceInternal.SequencePatcher(" + << param << ", " << "GetType(" << typeS << "), ix)"; + out << nl << stream << ".readObject(spx)"; out << nl << stream << ".checkSeq()"; out << nl << stream << ".endElement()"; out.dec(); out << nl << "Next"; - out << nl << stream << ".endSeq(sz)"; - out.dec(); - out << nl << "Next"; + out << nl << stream << ".endSeq(szx)"; } + out.dec(); + out << nl << "Next"; return; } StructPtr st = StructPtr::dynamicCast(type); if(st) { + out << nl << "For __block As Integer = 0 To 0"; + out.inc(); if(marshal) { out << nl << stream << ".writeSize(" << param << '.' << limitID << ")"; - out << nl << "For __i As Integer = 0 To " << param << '.' << limitID << " - 1"; + out << nl << "For __ix As Integer = 0 To " << param << '.' << limitID << " - 1"; out.inc(); - out << nl << param << "(__i).__write(" << stream << ")"; + out << nl << param << "(__ix).__write(" << stream << ")"; out.dec(); out << nl << "Next"; } else { - out << nl << "For __block As Integer = 0 To 0"; - out.inc(); - out << nl << "Dim sz As Integer = " << stream << ".readSize()"; - out << nl << stream << ".startSeq(sz, " << static_cast<unsigned>(type->minWireSize()) << ')'; + out << nl << "Dim szx As Integer = " << stream << ".readSize()"; + out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')'; out << nl << param << " = New "; if(isArray) { - out << toArrayAlloc(typeS + "()", "sz - 1") << " {}"; + out << toArrayAlloc(typeS + "()", "szx - 1") << " {}"; } else { - out << fixId(seq->scoped()) << "(sz)"; + out << fixId(seq->scoped()) << "(szx)"; } - out << nl << "For __i As Integer = 0 To " << param << '.' << limitID << " - 1"; + out << nl << "For __ix As Integer = 0 To " << param << '.' << limitID << " - 1"; out.inc(); - out << nl << param << "(__i).__read(" << stream << ")"; + out << nl << param << "(__ix).__read(" << stream << ")"; if(st->isVariableLength()) { out << nl << stream << ".checkSeq()"; @@ -677,10 +681,10 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } out.dec(); out << nl << "Next"; - out << nl << stream << ".endSeq(sz)"; - out.dec(); - out << nl << "Next"; + out << nl << stream << ".endSeq(szx)"; } + out.dec(); + out << nl << "Next"; return; } @@ -688,35 +692,35 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, EnumPtr en = EnumPtr::dynamicCast(type); if(en) { + out << nl << "For __block As Integer = 0 To 0"; + out.inc(); if(marshal) { out << nl << stream << ".writeSize(" << param << '.'<< limitID << ')'; - out << nl << "For __i As Integer = 0 To " << param << '.' << limitID << " - 1"; + out << nl << "For __ix As Integer = 0 To " << param << '.' << limitID << " - 1"; out.inc(); - out << nl << stream << ".writeByte(CType(" << param << "(__i), Byte))"; + out << nl << stream << ".writeByte(CType(" << param << "(__ix), Byte))"; out.dec(); out << nl << "Next"; } else { - out << nl << "For __block As Integer = 0 To 0"; - out.inc(); - out << nl << "Dim sz As Integer = " << stream << ".readSize()"; - out << nl << stream << ".startSeq(sz, " << static_cast<unsigned>(type->minWireSize()) << ')'; + out << nl << "Dim szx As Integer = " << stream << ".readSize()"; + out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')'; out << nl << param << " = New "; if(isArray) { - out << toArrayAlloc(typeS + "()", "sz - 1") << " {}"; + out << toArrayAlloc(typeS + "()", "szx - 1") << " {}"; } else { - out << fixId(seq->scoped()) << "(sz)"; + out << fixId(seq->scoped()) << "(szx)"; } - out << nl << "For __i As Integer = 0 To sz - 1"; + out << nl << "For __ix As Integer = 0 To szx - 1"; out.inc(); if(isArray) { - out << nl << param << "(__i) = CType(" << stream << ".readByte(), " << typeS << ')'; + out << nl << param << "(__ix) = CType(" << stream << ".readByte(), " << typeS << ')'; } else { @@ -724,10 +728,10 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } out.dec(); out << nl << "Next"; - out << nl << stream << ".endSeq(sz)"; - out.dec(); - out << nl << "Next"; + out << nl << stream << ".endSeq(szx)"; } + out.dec(); + out << nl << "Next"; return; } @@ -745,33 +749,33 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, { string func = ProxyPtr::dynamicCast(type) ? "__write" : "write"; out << nl << stream << ".writeSize(" << param << '.' << limitID << ")"; - out << nl << "For __i As Integer = 0 To " << param << '.' << limitID << " - 1"; + out << nl << "For __ix As Integer = 0 To " << param << '.' << limitID << " - 1"; out.inc(); - out << nl << helperName << '.' << func << '(' << stream << ", " << param << "(__i))"; + out << nl << helperName << '.' << func << '(' << stream << ", " << param << "(__ix))"; out.dec(); out << nl << "Next"; } else { - string func = ProxyPtr::dynamicCast(type) ? "__read" : "read"; out << nl << "For __block As Integer = 0 To 0"; out.inc(); - out << nl << "Dim sz As Integer = " << stream << ".readSize()"; - out << nl << stream << ".startSeq(sz, " << static_cast<unsigned>(type->minWireSize()) << ")"; + string func = ProxyPtr::dynamicCast(type) ? "__read" : "read"; + out << nl << "Dim szx As Integer = " << stream << ".readSize()"; + out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ")"; out << nl << param << " = New "; if(isArray) { - out << toArrayAlloc(typeS + "()", "sz - 1") << " {}"; + out << toArrayAlloc(typeS + "()", "szx - 1") << " {}"; } else { - out << fixId(seq->scoped()) << "(sz)"; + out << fixId(seq->scoped()) << "(szx)"; } - out << nl << "For __i As Integer = 0 To sz - 1"; + out << nl << "For __ix As Integer = 0 To szx - 1"; out.inc(); if(isArray) { - out << nl << param << "(__i) = " << helperName << '.' << func << '(' << stream << ")"; + out << nl << param << "(__ix) = " << helperName << '.' << func << '(' << stream << ")"; } else { @@ -787,7 +791,7 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } out.dec(); out << nl << "Next"; - out << nl << stream << ".endSeq(sz)"; + out << nl << stream << ".endSeq(szx)"; out.dec(); out << nl << "Next"; } diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp index 2464b7b20d3..f3df8044636 100755 --- a/cpp/src/slice2vb/Gen.cpp +++ b/cpp/src/slice2vb/Gen.cpp @@ -1452,7 +1452,7 @@ Slice::Gen::TypesVisitor::visitSequence(const SequencePtr& p) _out << sp << nl << "Public Function ToArray() As " << s << "()"; _out.inc(); - _out << nl << "Dim __a() As " << s << " = New " << s << "(InnerList.Count - 1) {}"; + _out << nl << "Dim __a As " << s << "() = New " << toArrayAlloc(s + "()", "InnerList.Count - 1") << " {}"; _out << nl << "InnerList.CopyTo(__a)"; _out << nl << "Return __a"; _out.dec(); @@ -2594,14 +2594,14 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) _out.dec(); _out << nl << "Next"; SequencePtr seq = SequencePtr::dynamicCast(p->valueType()); - bool valueIsArray = seq && !seq->hasMetaData("cs:collection"); + bool valueIsArray = seq && !seq->hasMetaData("vb:collection"); if(valueIsArray) { _out << nl << "Dim __vlhs As " << vs << "() = New " << toArrayAlloc(vs + "()", "Count - 1") << " {}"; } else { - _out << nl << "Dim __vlhs As " << vs << " = New " << toArrayAlloc(vs, "Count - 1") << " {}"; + _out << nl << "Dim __vlhs As " << vs << "() = New " << vs << "(Count - 1) {}"; } _out << nl << "Values.CopyTo(__vlhs, 0)"; _out << nl << "_System.Array.Sort(__vlhs)"; @@ -2612,7 +2612,7 @@ Slice::Gen::TypesVisitor::visitDictionary(const DictionaryPtr& p) } else { - _out << nl << "Dim __vrhs As " << vs << " = New " << toArrayAlloc(vs, vrhsCount) << " {}"; + _out << nl << "Dim __vrhs As " << vs << "() = New " << vs << '(' << vrhsCount << ") {}"; } _out << nl << "CType(other, " << name << ").Values.CopyTo(__vrhs, 0)"; _out << nl << "_System.Array.Sort(__vrhs)"; @@ -2819,7 +2819,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) bool isClass = false; ContainedPtr cont = ContainedPtr::dynamicCast(p->container()); assert(cont); - if(StructPtr::dynamicCast(cont) && cont->hasMetaData("cs:class")) + if(StructPtr::dynamicCast(cont) && cont->hasMetaData("vb:class")) { baseTypes = DotNet::ICloneable; } |