summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rwxr-xr-xcpp/src/slice2cs/Gen.cpp83
-rw-r--r--cpp/src/slice2cs/Gen.h2
-rwxr-xr-xcpp/src/slice2vb/Gen.cpp81
-rw-r--r--cpp/src/slice2vb/Gen.h2
4 files changed, 98 insertions, 70 deletions
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 2a90ff6aaad..2d66c7d9103 100755
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -117,8 +117,12 @@ Slice::CsVisitor::writeInheritedOperations(const ClassDefPtr& p)
_out << name << spar << args << "Ice.ObjectImpl.defaultCurrent" << epar << ';';
_out << eb;
- _out << sp << nl << "public abstract " << retS << ' ' << name
- << spar << params << "Ice.Current __current" << epar << ';';
+ _out << sp << nl << "public abstract " << retS << ' ' << name << spar << params;
+ if(!containingClass->isLocal())
+ {
+ _out << "Ice.Current __current";
+ }
+ _out << epar << ';';
}
else
{
@@ -1032,7 +1036,12 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << "Ice.Object";
}
- _out << ", _" << name << "Operations, _" << name << "OperationsNC";
+ _out << ", _" << name;
+ if(!p->isLocal())
+ {
+ _out << "Operations, _" << name;
+ }
+ _out << "OperationsNC";
if(!bases.empty())
{
ClassList::const_iterator q = bases.begin();
@@ -1070,7 +1079,11 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
}
if(p->isAbstract())
{
- _out << ", _" << name << "Operations, _" << name << "OperationsNC";
+ if(!p->isLocal())
+ {
+ _out << ", _" << name << "Operations";
+ }
+ _out << ", _" << name << "OperationsNC";
}
for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
{
@@ -2564,7 +2577,10 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
return false;
}
- writeOperations(p, false);
+ if(!p->isLocal())
+ {
+ writeOperations(p, false);
+ }
writeOperations(p, true);
return false;
@@ -2576,13 +2592,13 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
string name = p->name();
string scoped = fixId(p->scoped());
ClassList bases = p->bases();
-
-
- _out << sp << nl << "public interface _" << name << "Operations";
- if(noCurrent)
+ string opIntfName = "Operations";
+ if(noCurrent || p->isLocal())
{
- _out << "NC";
+ opIntfName += "NC";
}
+
+ _out << sp << nl << "public interface _" << name << opIntfName;
if((bases.size() == 1 && bases.front()->isAbstract()) || bases.size() > 1)
{
_out << " : ";
@@ -2640,22 +2656,12 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
string retS = typeToString(ret);
- if(!noCurrent)
+ _out << sp << nl << retS << ' ' << name << spar << params;
+ if(!noCurrent && !p->isLocal())
{
- _out << sp << nl << retS << ' ' << name << spar << params;
- if(!p->isLocal())
- {
- _out << "Ice.Current __current";
- }
- _out << epar << ';';
- }
- else
- {
- if(!p->isLocal())
- {
- _out << sp << nl << retS << ' ' << name << spar << params << epar << ';';
- }
+ _out << "Ice.Current __current";
}
+ _out << epar << ';';
}
_out << eb;
@@ -3939,6 +3945,11 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
}
string name = p->name();
+ string opIntfName = "Operations";
+ if(p->isLocal())
+ {
+ opIntfName += "NC";
+ }
_out << sp << nl << "public class _" << name << "Tie : ";
if(p->isInterface())
@@ -3962,7 +3973,7 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sb;
_out << eb;
- _out << sp << nl << "public _" << name << "Tie(_" << name << "Operations del)";
+ _out << sp << nl << "public _" << name << "Tie(_" << name << opIntfName << " del)";
_out << sb;
_out << nl << "_ice_delegate = del;";
_out << eb;
@@ -3974,7 +3985,7 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp << nl << "public void ice_delegate(object del)";
_out << sb;
- _out << nl << "_ice_delegate = (_" << name << "Operations)del;";
+ _out << nl << "_ice_delegate = (_" << name << opIntfName << ")del;";
_out << eb;
_out << sp << nl << "public ";
@@ -4066,7 +4077,7 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
writeInheritedOperations(*i, opNames);
}
- _out << sp << nl << "private _" << name << "Operations _ice_delegate;";
+ _out << sp << nl << "private _" << name << opIntfName << " _ice_delegate;";
return true;
}
@@ -4147,7 +4158,7 @@ Slice::Gen::BaseImplVisitor::BaseImplVisitor(IceUtil::Output& out)
}
void
-Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool local, bool comment, bool forTie)
+Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment, bool forTie)
{
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
string opName = op->name();
@@ -4165,7 +4176,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool local,
_out << sp << nl;
}
- if(!local && (cl->hasMetaData("amd") || op->hasMetaData("amd")))
+ if(!cl->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd")))
{
vector<string> pDecl = getParamsAsync(op, true);
@@ -4216,12 +4227,12 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool local,
vector<string> pDecls = getParams(op);
_out << "public ";
- if(!forTie)
+ if(!forTie && !cl->isLocal())
{
_out << "override ";
}
_out << retS << ' ' << fixId(opName, DotNet::ICloneable, true) << spar << pDecls;
- if(!local)
+ if(!cl->isLocal())
{
_out << "Ice.Current __current";
}
@@ -4361,7 +4372,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList ops = p->allOperations();
for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r)
{
- writeOperation(*r, p->isLocal(), false, false);
+ writeOperation(*r, false, false);
}
return true;
@@ -4432,6 +4443,10 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << ", ";
}
_out << '_' << name << "Operations";
+ if(p->isLocal())
+ {
+ _out << "NC";
+ }
_out << sb;
_out << nl << "public " << name << "I()";
@@ -4457,11 +4472,11 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "// ";
_out << nl << "// Implemented by " << bases.front()->name() << 'I';
_out << nl << "//";
- writeOperation(*r, p->isLocal(), true, true);
+ writeOperation(*r, true, true);
}
else
{
- writeOperation(*r, p->isLocal(), false, true);
+ writeOperation(*r, false, true);
}
}
diff --git a/cpp/src/slice2cs/Gen.h b/cpp/src/slice2cs/Gen.h
index 3ae50eff314..389a8b4e831 100644
--- a/cpp/src/slice2cs/Gen.h
+++ b/cpp/src/slice2cs/Gen.h
@@ -214,7 +214,7 @@ private:
protected:
- void writeOperation(const OperationPtr&, bool, bool, bool);
+ void writeOperation(const OperationPtr&, bool, bool);
private:
diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp
index 93b3ca6b9b6..26bb46dcf6b 100755
--- a/cpp/src/slice2vb/Gen.cpp
+++ b/cpp/src/slice2vb/Gen.cpp
@@ -130,7 +130,12 @@ Slice::VbVisitor::writeInheritedOperations(const ClassDefPtr& p)
_out << nl << "End " << vbOp;
_out << sp << nl << "Public MustOverride " << vbOp << ' ' << fixId(name, DotNet::ICloneable, true)
- << spar << params << "ByVal __current As Ice.Current" << epar;
+ << spar << params;
+ if(!containingClass->isLocal())
+ {
+ _out << "ByVal __current As Ice.Current";
+ }
+ _out << epar;
if(ret)
{
_out << " As " << retS;
@@ -1072,7 +1077,12 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
_out << nl << "Inherits Ice.Object";
}
- _out << ", _" << p->name() << "Operations, _" << p->name() << "OperationsNC";
+ _out << ", _" << p->name();
+ if(!p->isLocal())
+ {
+ _out << "Operations, _" << p->name();
+ }
+ _out << "OperationsNC";
if(!bases.empty())
{
ClassList::const_iterator q = bases.begin();
@@ -1111,7 +1121,12 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
}
if(p->isAbstract())
{
- _out << nl << "Implements _" << p->name() << "Operations, _" << p->name() << "OperationsNC";
+ _out << nl << "Implements _" << p->name();
+ if(!p->isLocal())
+ {
+ _out << "Operations, _" << p->name();
+ }
+ _out << "OperationsNC";
}
for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q)
{
@@ -2937,7 +2952,10 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p)
return false;
}
- writeOperations(p, false);
+ if(!p->isLocal())
+ {
+ writeOperations(p, false);
+ }
writeOperations(p, true);
return false;
@@ -2949,13 +2967,13 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
string name = p->name();
string scoped = fixId(p->scoped());
ClassList bases = p->bases();
-
-
- _out << sp << nl << "Public Interface _" << name << "Operations";
- if(noCurrent)
+ string opIntfName = "Operations";
+ if(noCurrent || p->isLocal())
{
- _out << "NC";
+ opIntfName += "NC";
}
+
+ _out << sp << nl << "Public Interface _" << name << opIntfName;
_out.inc();
if((bases.size() == 1 && bases.front()->isAbstract()) || bases.size() > 1)
{
@@ -3012,23 +3030,13 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent)
string vbOp = ret ? "Function" : "Sub";
- if(!noCurrent)
- {
- _out << sp << nl << vbOp << ' ' << name << spar << params;
- if(!p->isLocal())
- {
- _out << "ByVal __current As Ice.Current";
- }
- _out << epar;
- }
- else
+ _out << sp << nl << vbOp << ' ' << name << spar << params;
+ if(!noCurrent && !p->isLocal())
{
- if(!p->isLocal())
- {
- _out << sp << nl << vbOp << ' ' << name << spar << params << epar;
- }
+ _out << "ByVal __current As Ice.Current";
}
- if(!p->isLocal() && ret)
+ _out << epar;
+ if(ret)
{
_out << " As " << typeToString(ret);
}
@@ -4465,6 +4473,11 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
}
string name = p->name();
+ string opIntfName = "Operations";
+ if(p->isLocal())
+ {
+ opIntfName += "NC";
+ }
_out << sp << nl << "public class _" << name << "Tie";
_out.inc();
@@ -4489,7 +4502,7 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp << nl << "Public Sub New()";
_out << nl << "End Sub";
- _out << sp << nl << "Public Sub New(ByVal del As _" << name << "Operations)";
+ _out << sp << nl << "Public Sub New(ByVal del As _" << name << opIntfName << ")";
_out.inc();
_out << nl << "_ice_delegate = del";
_out.dec();
@@ -4503,7 +4516,7 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << sp << nl << "Public Sub ice_delegate(ByVal del As Object) Implements Ice.TieBase.ice_delegate";
_out.inc();
- _out << nl << "_ice_delegate = CType(del, _" << name << "Operations)";
+ _out << nl << "_ice_delegate = CType(del, _" << name << opIntfName << ")";
_out.dec();
_out << nl << "End Sub";
@@ -4618,7 +4631,7 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p)
writeInheritedOperations(*i, opNames);
}
- _out << sp << nl << "Private _ice_delegate As _" << name << "Operations";
+ _out << sp << nl << "Private _ice_delegate As _" << name << opIntfName;
return true;
}
@@ -4706,7 +4719,7 @@ Slice::Gen::BaseImplVisitor::BaseImplVisitor(IceUtil::Output& out)
}
void
-Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool local, bool comment, bool forTie)
+Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment, bool forTie)
{
ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
string opName = op->name();
@@ -4724,7 +4737,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool local,
_out << sp << nl;
}
- if(!local && (cl->hasMetaData("amd") || op->hasMetaData("amd")))
+ if(!cl->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd")))
{
vector<string> pDecl = getParamsAsync(op, true);
@@ -4783,12 +4796,12 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool local,
string vbOp = ret ? "Function" : "Sub";
_out << "Public Overloads ";
- if(!forTie)
+ if(!forTie && !cl->isLocal())
{
_out << "Overrides ";
}
_out << vbOp << ' ' << fixId(opName, DotNet::ICloneable, true) << spar << pDecls;
- if(!local)
+ if(!cl->isLocal())
{
_out << "ByVal __current As Ice.Current";
}
@@ -4942,7 +4955,7 @@ Slice::Gen::ImplVisitor::visitClassDefStart(const ClassDefPtr& p)
OperationList ops = p->allOperations();
for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r)
{
- writeOperation(*r, p->isLocal(), false, false);
+ writeOperation(*r, false, false);
}
return true;
@@ -5039,11 +5052,11 @@ Slice::Gen::ImplTieVisitor::visitClassDefStart(const ClassDefPtr& p)
_out << nl << "'";
_out << nl << "' Implemented by " << bases.front()->name() << 'I';
_out << nl << "'";
- writeOperation(*r, p->isLocal(), true, true);
+ writeOperation(*r, true, true);
}
else
{
- writeOperation(*r, p->isLocal(), false, true);
+ writeOperation(*r, false, true);
}
}
diff --git a/cpp/src/slice2vb/Gen.h b/cpp/src/slice2vb/Gen.h
index 3ab2d7e984f..bb77d16e72e 100644
--- a/cpp/src/slice2vb/Gen.h
+++ b/cpp/src/slice2vb/Gen.h
@@ -214,7 +214,7 @@ private:
protected:
- void writeOperation(const OperationPtr&, bool, bool, bool);
+ void writeOperation(const OperationPtr&, bool, bool);
private: