summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/RubyUtil.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2017-01-09 16:03:10 -0500
committerBernard Normier <bernard@zeroc.com>2017-01-09 16:03:10 -0500
commit7c74420c53bda5789e6ab78f1e16d18486a294c6 (patch)
tree9184b09775ed29ebf3db72b64a9b95f5980e5b51 /cpp/src/Slice/RubyUtil.cpp
parentPython/Ruby build fixes (diff)
downloadice-7c74420c53bda5789e6ab78f1e16d18486a294c6.tar.bz2
ice-7c74420c53bda5789e6ab78f1e16d18486a294c6.tar.xz
ice-7c74420c53bda5789e6ab78f1e16d18486a294c6.zip
Renamed optional invocation context parameter in Python, Ruby and PHP
new name: context old name: _ctx Fixed macOS build
Diffstat (limited to 'cpp/src/Slice/RubyUtil.cpp')
-rw-r--r--cpp/src/Slice/RubyUtil.cpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/cpp/src/Slice/RubyUtil.cpp b/cpp/src/Slice/RubyUtil.cpp
index b5d62fc0aee..afe0ce289d2 100644
--- a/cpp/src/Slice/RubyUtil.cpp
+++ b/cpp/src/Slice/RubyUtil.cpp
@@ -19,6 +19,27 @@ using namespace Slice;
using namespace IceUtil;
using namespace IceUtilInternal;
+
+namespace
+{
+
+string
+getEscapedParamName(const OperationPtr& p, const string& name)
+{
+ ParamDeclList params = p->parameters();
+
+ for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i)
+ {
+ if((*i)->name() == name)
+ {
+ return name + "_";
+ }
+ }
+ return name;
+}
+
+}
+
namespace Slice
{
namespace Ruby
@@ -524,10 +545,11 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << inParams << ", ";
}
- _out << "_ctx=nil)";
+ const string contextParamName = getEscapedParamName(*oli, "context");
+ _out << contextParamName << "=nil)";
_out.inc();
_out << nl << name << "_mixin::OP_" << (*oli)->name() << ".invoke(self, [" << inParams;
- _out << "], _ctx)";
+ _out << "], " << contextParamName << ")";
_out.dec();
_out << nl << "end";
}
@@ -538,9 +560,9 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p)
_out.inc();
_out << nl << "include " << name << "Prx_mixin";
- _out << sp << nl << "def " << name << "Prx.checkedCast(proxy, facetOrCtx=nil, _ctx=nil)";
+ _out << sp << nl << "def " << name << "Prx.checkedCast(proxy, facetOrContext=nil, context=nil)";
_out.inc();
- _out << nl << "ice_checkedCast(proxy, '" << scoped << "', facetOrCtx, _ctx)";
+ _out << nl << "ice_checkedCast(proxy, '" << scoped << "', facetOrContext, context)";
_out.dec();
_out << nl << "end";