diff options
author | Bernard Normier <bernard@zeroc.com> | 2017-01-06 16:42:35 -0500 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2017-01-06 16:42:35 -0500 |
commit | d7778df86336f3becb561463ae24243ccfe02164 (patch) | |
tree | 4e437427a9d333b44665fbdecea239350c800522 /cpp/src/Slice/PythonUtil.cpp | |
parent | Test script fix, don't terminate the process twice (diff) | |
download | ice-d7778df86336f3becb561463ae24243ccfe02164.tar.bz2 ice-d7778df86336f3becb561463ae24243ccfe02164.tar.xz ice-d7778df86336f3becb561463ae24243ccfe02164.zip |
Renamed Slice/keyword test to clash, and added identifier-clash test
Diffstat (limited to 'cpp/src/Slice/PythonUtil.cpp')
-rw-r--r-- | cpp/src/Slice/PythonUtil.cpp | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/cpp/src/Slice/PythonUtil.cpp b/cpp/src/Slice/PythonUtil.cpp index 6b6493666bb..0553a520791 100644 --- a/cpp/src/Slice/PythonUtil.cpp +++ b/cpp/src/Slice/PythonUtil.cpp @@ -20,6 +20,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 Python @@ -576,9 +597,11 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out << ", " << fixIdent((*pli)->name()); } } + if(!p->isLocal()) { - _out << ", current=None"; + const string currentParamName = getEscapedParamName(*oli, "current"); + _out << ", " << currentParamName << "=None"; } _out << "):"; _out.inc(); @@ -603,7 +626,8 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) } if(!p->isLocal()) { - _out << ", current=None"; + const string currentParamName = getEscapedParamName(*oli, "current"); + _out << ", " << currentParamName << "=None"; } _out << "):"; _out.inc(); @@ -2576,7 +2600,8 @@ Slice::Python::CodeVisitor::writeDocstring(const OperationPtr& op, DocstringMode } if(!local && (mode == DocDispatch || mode == DocAsyncDispatch)) { - _out << nl << "current -- The Current object for the invocation."; + const string currentParamName = getEscapedParamName(op, "current"); + _out << nl << currentParamName << " -- The Current object for the invocation."; } } else if(mode == DocAsyncEnd) |