summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Parser.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-05-23 08:07:40 +0000
committerMichi Henning <michi@zeroc.com>2003-05-23 08:07:40 +0000
commit5c89803b442f059bd7444b286adb3e0a1c4afeca (patch)
treee79bae21964782dc9a89df7ae2d0985caa822c26 /cpp/src/Slice/Parser.cpp
parentVC70 install improvements (diff)
downloadice-5c89803b442f059bd7444b286adb3e0a1c4afeca.tar.bz2
ice-5c89803b442f059bd7444b286adb3e0a1c4afeca.tar.xz
ice-5c89803b442f059bd7444b286adb3e0a1c4afeca.zip
Fixed the bug that Benoit found yesterday in both ice and icej.
(Zero-length sequence containing class elements caused an crash.) :Ice::Object). Obviously, this would cause an assertion failure or a {{{ClassCastException}}}. The solution is simply to force the down-cast in the generated patch function and to check whether the cast failed: if so, the class was sliced too much and we throw a {{{NoObjectFactoryException}}} as we should. (For Java, the exception is thrown from {{{BasicStream.readObject}}}, after catching a {{{ClassCastException}}}. For C++, the exception is thrown directly from the generated patch function.) :Ice::Object}}} and {{{::Printer}}}. Updated the code generator to correctly initialize the {{{type}}} member of a {{{NoObjectFactoryException}}} with the type ID of the type that wasn't found. (Unfortunately, this involved modifying {{{Parser.h}}}, so you will have to rebuild both ice and icej.) Added code generation for custom sequence types for icej. Generated code compiles and looks OK, but I haven't written tests yet, so there may still be a latent bug in this.
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r--cpp/src/Slice/Parser.cpp76
1 files changed, 76 insertions, 0 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 869b9ba115f..f04292a71d5 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -84,6 +84,70 @@ Slice::Builtin::isLocal() const
return _kind == KindLocalObject;
}
+string
+Slice::Builtin::typeId() const
+{
+ switch(_kind)
+ {
+ case KindByte:
+ {
+ return "::Ice::Byte";
+ break;
+ }
+ case KindBool:
+ {
+ return "::Ice::Bool";
+ break;
+ }
+ case KindShort:
+ {
+ return "::Ice::Short";
+ break;
+ }
+ case KindInt:
+ {
+ return "::Ice::Int";
+ break;
+ }
+ case KindLong:
+ {
+ return "::Ice::Long";
+ break;
+ }
+ case KindFloat:
+ {
+ return "::Ice::Float";
+ break;
+ }
+ case KindDouble:
+ {
+ return "::Ice::Double";
+ break;
+ }
+ case KindString:
+ {
+ return "::Ice::String";
+ break;
+ }
+ case KindObject:
+ {
+ return "::Ice::Object";
+ break;
+ }
+ case KindObjectProxy:
+ {
+ return "::Ice::Object*";
+ break;
+ }
+ case KindLocalObject:
+ {
+ return "::Ice::LocalObject";
+ break;
+ }
+ }
+ assert(false);
+}
+
bool
Slice::Builtin::usesClasses() const
{
@@ -1612,6 +1676,12 @@ Slice::Constructed::isLocal() const
return _local;
}
+string
+Slice::Constructed::typeId() const
+{
+ return scoped();
+}
+
ConstructedList
Slice::Constructed::dependencies()
{
@@ -2395,6 +2465,12 @@ Slice::Proxy::isLocal() const
return __class->isLocal();
}
+string
+Slice::Proxy::typeId() const
+{
+ return __class->scoped();
+}
+
bool
Slice::Proxy::usesClasses() const
{