[asterisk-scf-commits] asterisk-scf/release/slice-plugins.git branch "master" updated.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Fri Jun 17 11:21:20 CDT 2011
branch "master" has been updated
via c0f29cd8adb23ad3309e10b2fcf52a572f9f3631 (commit)
from 3bab1e4316559aae55381cd6804c5dc78cdcae12 (commit)
Summary of changes:
src/SliceVisitorPattern.cpp | 24 ++++++++++++++++++++++--
1 files changed, 22 insertions(+), 2 deletions(-)
- Log -----------------------------------------------------------------
commit c0f29cd8adb23ad3309e10b2fcf52a572f9f3631
Author: Kevin P. Fleming <kpfleming at digium.com>
Date: Fri Jun 17 11:20:12 2011 -0500
Generate parameter names for languages that require them.
For some languages, unnamed parameters are not allowed, so the VisitorPatternVisitor
base class can now be told when it must generate parameter names for functions
that have empty bodies.
diff --git a/src/SliceVisitorPattern.cpp b/src/SliceVisitorPattern.cpp
index ff6c838..be9d3a3 100644
--- a/src/SliceVisitorPattern.cpp
+++ b/src/SliceVisitorPattern.cpp
@@ -58,6 +58,7 @@ protected:
// function body in a language-appropriate manner.
virtual StringList generateVisitFunctionBody(const string&, const ClassDefPtr&, const ClassDefPtr&, const string&) = 0;
virtual StringList generateEmptyFunctionBody() = 0;
+ bool parametersRequireName;
private:
// This map contains the list of classes known to be visitors;
@@ -194,7 +195,14 @@ VisitorPatternVisitor::visitClassDefStart(const ClassDefPtr& p)
if(derivedVisitor->includeLevel() == 0)
{
GeneratedOperationPtr gop = derivedVisitor->createGeneratedOperation("visit" + p->name(), 0, generateEmptyFunctionBody());
- gop->createParamDecl("", p->declaration(), false);
+ if(parametersRequireName)
+ {
+ gop->createParamDecl("in", p->declaration(), false);
+ }
+ else
+ {
+ gop->createParamDecl("", p->declaration(), false);
+ }
}
// There is no need to actually generate operations into the visited
// class if it was defined in an include file, since the translator
@@ -237,7 +245,14 @@ VisitorPatternVisitor::visitClassDefStart(const ClassDefPtr& p)
if(derivedVisitor->includeLevel() == 0)
{
GeneratedOperationPtr gop = derivedVisitor->createGeneratedOperation("visit" + p->name(), 0, generateEmptyFunctionBody());
- gop->createParamDecl("", p->declaration(), false);
+ if(parametersRequireName)
+ {
+ gop->createParamDecl("in", p->declaration(), false);
+ }
+ else
+ {
+ gop->createParamDecl("", p->declaration(), false);
+ }
}
if(p->includeLevel() == 0)
{
@@ -351,6 +366,11 @@ private:
class ICE_DECLSPEC_EXPORT CsVisitor : public VisitorPatternVisitor
{
+public:
+ CsVisitor()
+ {
+ parametersRequireName = true;
+ }
protected:
StringList generateVisitFunctionBody(const std::string&, const ClassDefPtr&, const ClassDefPtr&, const std::string&);
StringList generateEmptyFunctionBody();
-----------------------------------------------------------------------
--
asterisk-scf/release/slice-plugins.git
More information about the asterisk-scf-commits
mailing list