summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/RubyUtil.cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2007-02-23 16:44:10 +0000
committerMark Spruiell <mes@zeroc.com>2007-02-23 16:44:10 +0000
commit1e2ecbd4b5ddb7954500cba93c47a8e6e3155224 (patch)
treef19bd4ffd3777a53eb4d4752acf5d420464cb794 /cpp/src/Slice/RubyUtil.cpp
parentfixes for x64 (diff)
downloadice-1e2ecbd4b5ddb7954500cba93c47a8e6e3155224.tar.bz2
ice-1e2ecbd4b5ddb7954500cba93c47a8e6e3155224.tar.xz
ice-1e2ecbd4b5ddb7954500cba93c47a8e6e3155224.zip
bug 1912: assertion failure in slice2rb
Diffstat (limited to 'cpp/src/Slice/RubyUtil.cpp')
-rw-r--r--cpp/src/Slice/RubyUtil.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp
index 5251e5db3f5..07125f44529 100644
--- a/cpp/src/Slice/RubyUtil.cpp
+++ b/cpp/src/Slice/RubyUtil.cpp
@@ -143,10 +143,6 @@ splitScopedName(const string& scoped)
{
ids.push_back(scoped.substr(next));
}
- else
- {
- ids.push_back("");
- }
return ids;
}
@@ -1687,6 +1683,7 @@ Slice::Ruby::splitString(const string& str, vector<string>& args, const string&
string
Slice::Ruby::fixIdent(const string& ident, IdentStyle style)
{
+ assert(!ident.empty());
if(ident[0] != ':')
{
string id = ident;
@@ -1714,6 +1711,7 @@ Slice::Ruby::fixIdent(const string& ident, IdentStyle style)
assert(!ids.empty());
ostringstream result;
+
for(vector<string>::size_type i = 0; i < ids.size() - 1; ++i)
{
//
@@ -1722,7 +1720,17 @@ Slice::Ruby::fixIdent(const string& ident, IdentStyle style)
//
result << "::" << fixIdent(ids[i], IdentToUpper);
}
+
result << "::" << fixIdent(ids[ids.size() - 1], style);
+
+ //
+ // Preserve trailing scope resolution operator if necessary.
+ //
+ if(ident.rfind("::") == ident.size() - 2)
+ {
+ result << "::";
+ }
+
return result.str();
}