From 7b4e52045d17bcc4b3bb1e0973c3af2e48381c5e Mon Sep 17 00:00:00 2001 From: David Boddie Date: Wed, 8 Jun 2011 16:36:29 +0200 Subject: qdoc: Fixed code to match comments in QML files. Fixed API types. --- tools/qdoc3/qmlvisitor.cpp | 11 +++++------ tools/qdoc3/qmlvisitor.h | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tools/qdoc3/qmlvisitor.cpp b/tools/qdoc3/qmlvisitor.cpp index fe96f9a..98e188d 100644 --- a/tools/qdoc3/qmlvisitor.cpp +++ b/tools/qdoc3/qmlvisitor.cpp @@ -67,15 +67,15 @@ QmlDocVisitor::~QmlDocVisitor() { } -QDeclarativeJS::AST::SourceLocation QmlDocVisitor::precedingComment(unsigned offset) const +QDeclarativeJS::AST::SourceLocation QmlDocVisitor::precedingComment(quint32 offset) const { QDeclarativeJS::AST::SourceLocation currentLoc; foreach (const QDeclarativeJS::AST::SourceLocation &loc, engine->comments()) { - if (loc.begin() > lastEndOffset && loc.end() < offset) - currentLoc = loc; - else + if (loc.begin() >= offset) break; + else if (loc.begin() > lastEndOffset && loc.end() < offset) + currentLoc = loc; } if (currentLoc.isValid()) { QString comment = document.mid(currentLoc.offset, currentLoc.length); @@ -195,7 +195,7 @@ bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) qmlPropGroup->setDefault(); QmlPropertyNode *qmlPropNode = new QmlPropertyNode(qmlPropGroup, name, type, false); qmlPropNode->setWritable(!member->isReadonlyMember); - applyDocumentation(member->firstSourceLocation(), qmlPropNode); + applyDocumentation(member->firstSourceLocation(), qmlPropGroup); } } break; @@ -204,7 +204,6 @@ bool QmlDocVisitor::visit(QDeclarativeJS::AST::UiPublicMember *member) return false; } - //current->doc = precedingComment(member->firstSourceLocation().begin()); return true; } diff --git a/tools/qdoc3/qmlvisitor.h b/tools/qdoc3/qmlvisitor.h index 34ed8c1..1d3a401 100644 --- a/tools/qdoc3/qmlvisitor.h +++ b/tools/qdoc3/qmlvisitor.h @@ -67,7 +67,7 @@ public: bool visit(QDeclarativeJS::AST::IdentifierPropertyName *idproperty); private: - QDeclarativeJS::AST::SourceLocation precedingComment(unsigned offset) const; + QDeclarativeJS::AST::SourceLocation precedingComment(quint32 offset) const; void applyDocumentation(QDeclarativeJS::AST::SourceLocation location, Node *node); QDeclarativeJS::Engine *engine; -- cgit v0.12