QDoc: Generate unique ids for qmlMethods.

Also delete unused function.

Change-Id: I8c3590d17c823bc27dcb9d9e73b7b812e078d33b
Reviewed-by: Martin Smith <martin.smith@nokia.com>
bb10
Casper van Donderen 2012-05-04 14:51:53 +02:00 committed by Qt by Nokia
parent 295ec32a74
commit 9a140d6521
4 changed files with 17 additions and 27 deletions

View File

@ -3383,7 +3383,10 @@ QString HtmlGenerator::refForNode(const Node *node)
ref = node->name() + "-signal-handler";
break;
case Node::QmlMethod:
ref = node->name() + "-method";
func = static_cast<const FunctionNode *>(node);
ref = func->name() + "-method";
if (func->overloadNumber() != 1)
ref += "-" + QString::number(func->overloadNumber());
break;
case Node::Variable:
ref = node->name() + "-var";

View File

@ -1047,20 +1047,6 @@ int InnerNode::overloadNumber(const FunctionNode *func) const
}
}
/*!
Returns the number of member functions of a class such that
the functions are all named \a funcName.
*/
int InnerNode::numOverloads(const QString& funcName) const
{
if (primaryFunctionMap.contains(funcName)) {
return secondaryFunctionMap[funcName].count() + 1;
}
else {
return 0;
}
}
/*!
Returns a node list containing all the member functions of
some class such that the functions overload the name \a funcName.
@ -1820,15 +1806,6 @@ int FunctionNode::overloadNumber() const
return parent()->overloadNumber(this);
}
/*!
Returns the number of times this function name has been
overloaded, obtained from the parent.
*/
int FunctionNode::numOverloads() const
{
return parent()->numOverloads(name());
}
/*!
Returns the list of parameter names.
*/
@ -2745,7 +2722,10 @@ QString Node::idForNode() const
str = "qml-signal-handler-" + name();
break;
case Node::QmlMethod:
str = "qml-method-" + name();
func = static_cast<const FunctionNode*>(this);
str = "qml-method-" + func->name();
if (func->overloadNumber() != 1)
str += "-" + QString::number(func->overloadNumber());
break;
case Node::Variable:
str = "var-" + name();

View File

@ -335,7 +335,6 @@ public:
const NodeList & relatedNodes() const { return related_; }
int count() const { return children.size(); }
int overloadNumber(const FunctionNode* func) const;
int numOverloads(const QString& funcName) const;
NodeList overloads(const QString &funcName) const;
const QStringList& includes() const { return inc; }
@ -777,7 +776,6 @@ public:
bool isReimp() const { return reimp; }
bool isFunction() const { return true; }
int overloadNumber() const;
int numOverloads() const;
const QList<Parameter>& parameters() const { return params; }
QStringList parameterNames() const;
QString rawParameters(bool names = false, bool values = false) const;

View File

@ -535,6 +535,15 @@ bool QmlDocVisitor::visit(QQmlJS::AST::FunctionDeclaration* fd)
if (qmlClass) {
QString name = fd->name.toString();
FunctionNode* qmlMethod = new FunctionNode(Node::QmlMethod, current, name, false);
int overloads = 0;
NodeList::ConstIterator overloadIterator = current->childNodes().begin();
while (overloadIterator != current->childNodes().end()) {
if ((*overloadIterator)->name() == name)
overloads++;
overloadIterator++;
}
if (overloads > 1)
qmlMethod->setOverload(true);
QList<Parameter> parameters;
QQmlJS::AST::FormalParameterList* formals = fd->formals;
if (formals) {