summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2013-04-08 12:47:55 -0700
committerMark Spruiell <mes@zeroc.com>2013-04-08 12:47:55 -0700
commit3bb29a4a1b3eadab670ba240fa79a33b9d3d3a09 (patch)
tree52a46d27d81a0c150614683d64869bb7e439b971 /cpp/src
parentC# network fix (diff)
downloadice-3bb29a4a1b3eadab670ba240fa79a33b9d3d3a09.tar.bz2
ice-3bb29a4a1b3eadab670ba240fa79a33b9d3d3a09.tar.xz
ice-3bb29a4a1b3eadab670ba240fa79a33b9d3d3a09.zip
ICE-5324 - invalid C# code for struct with default values
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Slice/CsUtil.cpp2
-rw-r--r--cpp/src/slice2cs/Gen.cpp22
2 files changed, 12 insertions, 12 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index 624ed704ec0..a78e55a183a 100644
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -401,7 +401,7 @@ Slice::CsGenerator::isValueType(const TypePtr& type)
DataMemberList dm = s->dataMembers();
for(DataMemberList::const_iterator i = dm.begin(); i != dm.end(); ++i)
{
- if(!isValueType((*i)->type()))
+ if(!isValueType((*i)->type()) || (*i)->defaultValueType())
{
return false;
}
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 8d6cb6e01fe..60164571d5e 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -858,7 +858,7 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream)
StructPtr st = StructPtr::dynamicCast((*pli)->type());
if(st)
{
- if(isValueType((*pli)->type()))
+ if(isValueType(st))
{
_out << nl << param << " = new " << typeS << "();";
}
@@ -3700,7 +3700,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p)
emitAttributes(p);
emitPartialTypeAttributes();
- if(isValueType(p) && !p->hasDefaultValues())
+ if(isValueType(p))
{
_out << nl << "public partial struct " << name;
}
@@ -3727,7 +3727,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
_out << sp << nl << "#endregion"; // Slice data members
- const bool isClass = !isValueType(p) || p->hasDefaultValues();
+ const bool isClass = !isValueType(p);
_out << sp << nl << "#region Constructor";
if(isClass)
@@ -4126,7 +4126,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
if(StructPtr::dynamicCast(cont))
{
isValue = isValueType(StructPtr::dynamicCast(cont));
- if(!isValue || cont->hasMetaData("clr:class"))
+ if(!isValue)
{
baseTypes = DotNet::ICloneable;
}
@@ -4998,7 +4998,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
StructPtr st = StructPtr::dynamicCast((*pli)->type());
if(st)
{
- if(isValueType((*pli)->type()))
+ if(isValueType(st))
{
_out << nl << param << " = new " << typeS << "();";
}
@@ -5019,7 +5019,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
StructPtr st = StructPtr::dynamicCast(ret);
if(st)
{
- if(isValueType(ret))
+ if(isValueType(st))
{
_out << nl << "ret__ = new " << typeS << "();";
}
@@ -5684,7 +5684,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
StructPtr st = StructPtr::dynamicCast(key);
if(st)
{
- if(isValueType(key))
+ if(isValueType(st))
{
_out << nl << "k__ = new " << typeToString(key) << "();";
}
@@ -5707,7 +5707,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
StructPtr st = StructPtr::dynamicCast(value);
if(st)
{
- if(isValueType(value))
+ if(isValueType(st))
{
_out << nl << "v__ = new " << typeToString(value) << "();";
}
@@ -5764,7 +5764,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
StructPtr st = StructPtr::dynamicCast(key);
if(st)
{
- if(isValueType(key))
+ if(isValueType(st))
{
_out << nl << "k__ = new " << typeToString(key) << "();";
}
@@ -5780,7 +5780,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
StructPtr st = StructPtr::dynamicCast(value);
if(st)
{
- if(isValueType(value))
+ if(isValueType(st))
{
_out << nl << "v__ = new " << typeToString(value) << "();";
}
@@ -6075,7 +6075,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p)
StructPtr st = StructPtr::dynamicCast(ret);
if(st)
{
- if(isValueType(ret))
+ if(isValueType(st))
{
_out << nl << "ret__ = new " << typeS << "();";
}