qdoc: Maintain correct nesting level for QML parsing
qdoc was not incrementing the nesting level when parsing a UiObjectBinding, which can contain a component definition. qdoc now increments the nesting level when starting to vidit a UiObjectBinding and decrements it when ending the visit. Note this fix does not stop qdoc from reporting that public signal handlers have not been documented. If that is to be changed, it will be done separately. Task-number: QTBUG-29993 Change-Id: Ibd5ef81082e989652b3a15dcc95080a2757e0077 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>bb10
parent
80af204297
commit
8b10e8c198
|
|
@ -424,8 +424,9 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
|
|||
*/
|
||||
void QmlDocVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *definition)
|
||||
{
|
||||
if (nestingLevel > 0)
|
||||
if (nestingLevel > 0) {
|
||||
--nestingLevel;
|
||||
}
|
||||
lastEndOffset = definition->lastSourceLocation().end();
|
||||
}
|
||||
|
||||
|
|
@ -461,6 +462,26 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::UiImportList *definition)
|
|||
lastEndOffset = definition->lastSourceLocation().end();
|
||||
}
|
||||
|
||||
bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectBinding *)
|
||||
{
|
||||
++nestingLevel;
|
||||
return true;
|
||||
}
|
||||
|
||||
void QmlDocVisitor::endVisit(QQmlJS::AST::UiObjectBinding *)
|
||||
{
|
||||
--nestingLevel;
|
||||
}
|
||||
|
||||
bool QmlDocVisitor::visit(QQmlJS::AST::UiArrayBinding *)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void QmlDocVisitor::endVisit(QQmlJS::AST::UiArrayBinding *)
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
Visits the public \a member declaration, which can be a
|
||||
signal or a property. It is a custom signal or property.
|
||||
|
|
@ -468,8 +489,9 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::UiImportList *definition)
|
|||
*/
|
||||
bool QmlDocVisitor::visit(QQmlJS::AST::UiPublicMember *member)
|
||||
{
|
||||
if (nestingLevel > 1)
|
||||
if (nestingLevel > 1) {
|
||||
return true;
|
||||
}
|
||||
switch (member->type) {
|
||||
case QQmlJS::AST::UiPublicMember::Signal:
|
||||
{
|
||||
|
|
@ -535,8 +557,9 @@ bool QmlDocVisitor::visit(QQmlJS::AST::IdentifierPropertyName *)
|
|||
*/
|
||||
bool QmlDocVisitor::visit(QQmlJS::AST::FunctionDeclaration* fd)
|
||||
{
|
||||
if (nestingLevel > 1)
|
||||
if (nestingLevel > 1) {
|
||||
return true;
|
||||
}
|
||||
if (current->type() == Node::Document) {
|
||||
QmlClassNode* qmlClass = static_cast<QmlClassNode*>(current);
|
||||
if (qmlClass) {
|
||||
|
|
@ -581,8 +604,9 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::FunctionDeclaration* fd)
|
|||
*/
|
||||
bool QmlDocVisitor::visit(QQmlJS::AST::UiScriptBinding* sb)
|
||||
{
|
||||
if (nestingLevel > 1)
|
||||
if (nestingLevel > 1) {
|
||||
return true;
|
||||
}
|
||||
if (current->type() == Node::Document) {
|
||||
QString handler = sb->qualifiedId->name.toString();
|
||||
if (handler.length() > 2 && handler.startsWith("on") && handler.at(2).isUpper()) {
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@ public:
|
|||
bool visit(QQmlJS::AST::UiPublicMember *member);
|
||||
void endVisit(QQmlJS::AST::UiPublicMember *definition);
|
||||
|
||||
virtual bool visit(QQmlJS::AST::UiObjectBinding *);
|
||||
virtual void endVisit(QQmlJS::AST::UiObjectBinding *);
|
||||
virtual void endVisit(QQmlJS::AST::UiArrayBinding *);
|
||||
virtual bool visit(QQmlJS::AST::UiArrayBinding *);
|
||||
|
||||
bool visit(QQmlJS::AST::IdentifierPropertyName *idproperty);
|
||||
|
||||
bool visit(QQmlJS::AST::FunctionDeclaration *);
|
||||
|
|
|
|||
Loading…
Reference in New Issue