diff options
author | Martin Smith <martin.smith@digia.com> | 2013-03-05 10:52:16 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-05 12:19:08 +0100 |
commit | 8b10e8c198baa53f892c65d2e41c56df751ff7b8 (patch) | |
tree | d254ce11ae1e40c04c22e9276f609bac45d0e854 /src/tools/qdoc/qmlvisitor.cpp | |
parent | 80af20429715228a69122ee824a64108dfb53809 (diff) |
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>
Diffstat (limited to 'src/tools/qdoc/qmlvisitor.cpp')
-rw-r--r-- | src/tools/qdoc/qmlvisitor.cpp | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/src/tools/qdoc/qmlvisitor.cpp b/src/tools/qdoc/qmlvisitor.cpp index 8b6f81de3e..058ab9a725 100644 --- a/src/tools/qdoc/qmlvisitor.cpp +++ b/src/tools/qdoc/qmlvisitor.cpp @@ -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()) { |