aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorFawzi Mohamed <fawzi.mohamed@qt.io>2020-02-28 17:51:32 +0100
committerFawzi Mohamed <fawzi.mohamed@qt.io>2020-03-03 15:31:10 +0000
commitb09a48599e7e5db5447189136353b79aca3898cf (patch)
tree5f6f3b1d4da3ed746caa612992d94ed21978dd75 /src/plugins
parenta24dead5f63d7eb0b209539daebf5b2ce558b1c0 (diff)
Update qmljs parser to Qt 5.15 parser
* parser side support for annotations, inline components, new UiVersion and all the things included in QT 5.15 parser * SourceLocation moved from QmlJS:AST to QmlJS * Visitors now need to handle throwRecursionDepthError * BaseVisitor for visitors that want to override all visit Task-number: QTCREATORBUG-23591 Change-Id: I682a30d0b08b6c929739fd0e339ef6fbde3eb630 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/autotest/quick/quicktestvisitors.cpp7
-rw-r--r--src/plugins/autotest/quick/quicktestvisitors.h2
-rw-r--r--src/plugins/qmldesigner/components/componentcore/findimplementation.cpp19
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp4
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp7
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.h2
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp5
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.h2
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp6
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.h2
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp5
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.h2
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.cpp17
-rw-r--r--src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.h8
-rw-r--r--src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp2
-rw-r--r--src/plugins/qmldesigner/designercore/model/documentmessage.cpp1
-rw-r--r--src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp14
-rw-r--r--src/plugins/qmldesigner/designercore/model/texttomodelmerger.h6
-rw-r--r--src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp1
-rw-r--r--src/plugins/qmljseditor/qmljseditor.cpp12
-rw-r--r--src/plugins/qmljseditor/qmljseditordocument.cpp18
-rw-r--r--src/plugins/qmljseditor/qmljsfindreferences.cpp25
-rw-r--r--src/plugins/qmljseditor/qmljshoverhandler.cpp4
-rw-r--r--src/plugins/qmljseditor/qmljsoutline.cpp2
-rw-r--r--src/plugins/qmljseditor/qmljssemantichighlighter.cpp11
-rw-r--r--src/plugins/qmljseditor/qmljssemantichighlighter.h2
-rw-r--r--src/plugins/qmljseditor/qmljswrapinloader.cpp6
-rw-r--r--src/plugins/qmljseditor/qmloutlinemodel.cpp32
-rw-r--r--src/plugins/qmljseditor/qmloutlinemodel.h10
-rw-r--r--src/plugins/qmljstools/qmljslocatordata.cpp6
-rw-r--r--src/plugins/qmljstools/qmljsrefactoringchanges.cpp4
-rw-r--r--src/plugins/qmljstools/qmljsrefactoringchanges.h4
-rw-r--r--src/plugins/qmljstools/qmljssemanticinfo.cpp14
-rw-r--r--src/plugins/qmljstools/qmljssemanticinfo.h2
-rw-r--r--src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp8
-rw-r--r--src/plugins/todo/qmljstodoitemsscanner.cpp2
36 files changed, 199 insertions, 75 deletions
diff --git a/src/plugins/autotest/quick/quicktestvisitors.cpp b/src/plugins/autotest/quick/quicktestvisitors.cpp
index 486356f13b..598b16afec 100644
--- a/src/plugins/autotest/quick/quicktestvisitors.cpp
+++ b/src/plugins/autotest/quick/quicktestvisitors.cpp
@@ -33,6 +33,8 @@
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
+#include <QDebug>
+
namespace Autotest {
namespace Internal {
@@ -177,6 +179,11 @@ bool TestQmlVisitor::visit(QmlJS::AST::StringLiteral *ast)
return false;
}
+void TestQmlVisitor::throwRecursionDepthError()
+{
+ qWarning("Warning: Hit maximum recursion depth while visiting AST in TestQmlVisitor");
+}
+
/************************************** QuickTestAstVisitor *************************************/
QuickTestAstVisitor::QuickTestAstVisitor(CPlusPlus::Document::Ptr doc,
diff --git a/src/plugins/autotest/quick/quicktestvisitors.h b/src/plugins/autotest/quick/quicktestvisitors.h
index e4af8661c2..5aff62f458 100644
--- a/src/plugins/autotest/quick/quicktestvisitors.h
+++ b/src/plugins/autotest/quick/quicktestvisitors.h
@@ -65,6 +65,8 @@ public:
bool visit(QmlJS::AST::FunctionDeclaration *ast) override;
bool visit(QmlJS::AST::StringLiteral *ast) override;
+ void throwRecursionDepthError() override;
+
QVector<QuickTestCaseSpec> testCases() const { return m_testCases; }
bool isValid() const { return !m_testCases.isEmpty(); }
diff --git a/src/plugins/qmldesigner/components/componentcore/findimplementation.cpp b/src/plugins/qmldesigner/components/componentcore/findimplementation.cpp
index 7cc1d9d712..a1d7b5fad4 100644
--- a/src/plugins/qmldesigner/components/componentcore/findimplementation.cpp
+++ b/src/plugins/qmldesigner/components/componentcore/findimplementation.cpp
@@ -35,6 +35,8 @@
#include <qmljs/qmljsscopebuilder.h>
#include <qmljs/qmljsmodelmanagerinterface.h>
+#include <QDebug>
+
namespace {
using namespace QmlJS;
@@ -42,7 +44,7 @@ using namespace QmlJS;
class FindImplementationVisitor: protected AST::Visitor
{
public:
- using Results = QList<AST::SourceLocation>;
+ using Results = QList<SourceLocation>;
FindImplementationVisitor(const Document::Ptr &doc, const ContextPtr &context)
: m_document(doc)
@@ -66,13 +68,13 @@ public:
}
protected:
- QString textAt(const AST::SourceLocation &location)
+ QString textAt(const SourceLocation &location)
{
return m_document->source().mid(location.offset, location.length);
}
- QString textAt(const AST::SourceLocation &from,
- const AST::SourceLocation &to)
+ QString textAt(const SourceLocation &from,
+ const SourceLocation &to)
{
return m_document->source().mid(from.offset, to.end() - from.begin());
}
@@ -206,7 +208,10 @@ protected:
return false;
}
-
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion depth while visiting AST in FindImplementationVisitor");
+ }
private:
bool checkTypeName(AST::UiQualifiedId *id)
{
@@ -223,7 +228,7 @@ private:
}
Results m_implemenations;
- AST::SourceLocation m_formLocation;
+ SourceLocation m_formLocation;
Document::Ptr m_document;
ContextPtr m_context;
@@ -281,7 +286,7 @@ QList<QmlJSEditor::FindReferences::Usage> FindImplementation::run(const QString
FindImplementationVisitor visitor(document, context);
FindImplementationVisitor::Results results = visitor(typeName, itemName, targetValue);
- foreach (const AST::SourceLocation &location, results) {
+ foreach (const SourceLocation &location, results) {
usages.append(QmlJSEditor::FindReferences::Usage(fileName,
matchingLine(location.offset, document->source()),
location.startLine, location.startColumn - 1, location.length));
diff --git a/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp
index 7c0688ba9a..3c04d341bb 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp
+++ b/src/plugins/qmldesigner/designercore/filemanager/addpropertyvisitor.cpp
@@ -79,8 +79,8 @@ bool AddPropertyVisitor::visit(QmlJS::AST::UiObjectBinding *ast)
void AddPropertyVisitor::addInMembers(QmlJS::AST::UiObjectInitializer *initializer)
{
QmlJS::AST::UiObjectMemberList *insertAfter = searchMemberToInsertAfter(initializer->members, m_name, m_propertyOrder);
- QmlJS::AST::SourceLocation endOfPreviousMember;
- QmlJS::AST::SourceLocation startOfNextMember;
+ QmlJS::SourceLocation endOfPreviousMember;
+ QmlJS::SourceLocation startOfNextMember;
bool previousMemberSemicolon = false;
unsigned depth;
diff --git a/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp b/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp
index d29ac90cde..8633e270e4 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp
+++ b/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.cpp
@@ -27,6 +27,8 @@
#include <qmljs/parser/qmljsast_p.h>
+#include <QDebug>
+
using namespace QmlDesigner;
ASTObjectTextExtractor::ASTObjectTextExtractor(const QString &text):
@@ -69,3 +71,8 @@ bool ASTObjectTextExtractor::visit(QmlJS::AST::UiObjectDefinition *ast)
return m_text.isEmpty();
}
+
+void ASTObjectTextExtractor::throwRecursionDepthError()
+{
+ qWarning("Warning: Hit maximum recursion depth while visiting the AST in ASTObjectTextExtractor");
+}
diff --git a/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.h b/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.h
index 385d8c1c97..ecc00bde18 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.h
+++ b/src/plugins/qmldesigner/designercore/filemanager/astobjecttextextractor.h
@@ -43,6 +43,8 @@ protected:
bool visit(QmlJS::AST::UiObjectBinding *ast) override;
bool visit(QmlJS::AST::UiObjectDefinition *ast) override;
+ void throwRecursionDepthError() override;
+
private:
QmlJS::Document::MutablePtr m_document;
quint32 m_location = 0;
diff --git a/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp b/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp
index 76ecb59f30..7fe59053da 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp
+++ b/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.cpp
@@ -98,3 +98,8 @@ bool FirstDefinitionFinder::visit(QmlJS::AST::UiObjectDefinition *ast)
}
return true;
}
+
+void FirstDefinitionFinder::throwRecursionDepthError()
+{
+ qWarning("Warning: Hit maximum recursion depth while visiting the AST in FirstDefinitionFinder");
+}
diff --git a/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.h b/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.h
index b4e9826f52..2a963ae2fb 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.h
+++ b/src/plugins/qmldesigner/designercore/filemanager/firstdefinitionfinder.h
@@ -43,6 +43,8 @@ protected:
bool visit(QmlJS::AST::UiObjectBinding *ast) override;
bool visit(QmlJS::AST::UiObjectDefinition *ast) override;
+ void throwRecursionDepthError() override;
+
void extractFirstObjectDefinition(QmlJS::AST::UiObjectInitializer* ast);
private:
diff --git a/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp b/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp
index 3be5de5bc9..a4931be538 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp
+++ b/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.cpp
@@ -147,7 +147,7 @@ void MoveObjectBeforeObjectVisitor::doMove()
moveInfo.prefixToInsert = QString(moveInfo.leadingCharsToRemove, QLatin1Char(' '));
moveInfo.suffixToInsert = separator + QStringLiteral("\n\n");
} else {
- const QmlJS::AST::SourceLocation insertionPoint = lastParentLocation();
+ const QmlJS::SourceLocation insertionPoint = lastParentLocation();
Q_ASSERT(insertionPoint.isValid());
moveInfo.destination = insertionPoint.offset;
int dummy = -1;
@@ -169,7 +169,7 @@ QmlJS::AST::Node *MoveObjectBeforeObjectVisitor::movingObjectParent() const
return nullptr;
}
-QmlJS::AST::SourceLocation MoveObjectBeforeObjectVisitor::lastParentLocation() const
+QmlJS::SourceLocation MoveObjectBeforeObjectVisitor::lastParentLocation() const
{
dump(movingObjectParents);
@@ -179,5 +179,5 @@ QmlJS::AST::SourceLocation MoveObjectBeforeObjectVisitor::lastParentLocation() c
else if (auto initializer = QmlJS::AST::cast<QmlJS::AST::UiArrayBinding*>(parent))
return initializer->rbracketToken;
else
- return QmlJS::AST::SourceLocation();
+ return QmlJS::SourceLocation();
}
diff --git a/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.h b/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.h
index 922d9fe40a..c47caf56e2 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.h
+++ b/src/plugins/qmldesigner/designercore/filemanager/moveobjectbeforeobjectvisitor.h
@@ -58,7 +58,7 @@ private:
void doMove();
QmlJS::AST::Node *movingObjectParent() const;
- QmlJS::AST::SourceLocation lastParentLocation() const;
+ QmlJS::SourceLocation lastParentLocation() const;
private:
QStack<QmlJS::AST::Node *> parents;
diff --git a/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp b/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp
index e0908f2f27..f54167c2d8 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp
+++ b/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.cpp
@@ -88,3 +88,8 @@ bool ObjectLengthCalculator::visit(QmlJS::AST::UiObjectDefinition *ast)
return m_offset < end;
}
+
+void ObjectLengthCalculator::throwRecursionDepthError()
+{
+ qWarning("Warning: Hit maximum recursion depth while visiting the AST in ObjectLengthCalculator");
+}
diff --git a/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.h b/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.h
index af745d2acd..f9bce822e3 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.h
+++ b/src/plugins/qmldesigner/designercore/filemanager/objectlengthcalculator.h
@@ -43,6 +43,8 @@ protected:
bool visit(QmlJS::AST::UiObjectBinding *ast) override;
bool visit(QmlJS::AST::UiObjectDefinition *ast) override;
+ void throwRecursionDepthError() override;
+
private:
QmlJS::Document::MutablePtr m_doc;
quint32 m_offset = 0;
diff --git a/src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.cpp b/src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.cpp
index 94b89efcd9..25a72134b2 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.cpp
+++ b/src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.cpp
@@ -68,12 +68,12 @@ QString QMLRewriter::textBetween(int startPosition, int endPosition) const
return m_textModifier->text().mid(startPosition, endPosition - startPosition);
}
-QString QMLRewriter::textAt(const QmlJS::AST::SourceLocation &location) const
+QString QMLRewriter::textAt(const QmlJS::SourceLocation &location) const
{
return m_textModifier->text().mid(location.offset, location.length);
}
-unsigned QMLRewriter::calculateIndentDepth(const QmlJS::AST::SourceLocation &position) const
+unsigned QMLRewriter::calculateIndentDepth(const QmlJS::SourceLocation &position) const
{
QTextDocument *doc = m_textModifier->textDocument();
QTextCursor tc(doc);
@@ -151,20 +151,20 @@ QString QMLRewriter::removeIndentation(const QString &text, unsigned depth)
return result;
}
-QmlJS::AST::SourceLocation QMLRewriter::calculateLocation(QmlJS::AST::UiQualifiedId *id)
+QmlJS::SourceLocation QMLRewriter::calculateLocation(QmlJS::AST::UiQualifiedId *id)
{
Q_ASSERT(id != nullptr);
- const QmlJS::AST::SourceLocation startLocation = id->identifierToken;
+ const QmlJS::SourceLocation startLocation = id->identifierToken;
QmlJS::AST::UiQualifiedId *nextId = id;
while (nextId->next) {
nextId = nextId->next;
}
- const QmlJS::AST::SourceLocation endLocation = nextId->identifierToken;
+ const QmlJS::SourceLocation endLocation = nextId->identifierToken;
- return QmlJS::AST::SourceLocation(startLocation.offset, endLocation.end() - startLocation.offset);
+ return QmlJS::SourceLocation(startLocation.offset, endLocation.end() - startLocation.offset);
}
bool QMLRewriter::isMissingSemicolon(QmlJS::AST::UiObjectMember *member)
@@ -340,3 +340,8 @@ void QMLRewriter::dump(const ASTPath &path)
qCDebug(qmlRewriter).noquote() << QString(i + 1, QLatin1Char('-')) << typeid(*node).name();
}
}
+
+void QMLRewriter::throwRecursionDepthError()
+{
+ qCWarning(qmlRewriter) << "Warning: Hit maximum recursion level while visiting AST in QMLRewriter";
+}
diff --git a/src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.h b/src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.h
index 062710ef4c..c773de35be 100644
--- a/src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.h
+++ b/src/plugins/qmldesigner/designercore/filemanager/qmlrewriter.h
@@ -51,20 +51,22 @@ public:
protected:
using QmlJS::AST::Visitor::visit;
+ void throwRecursionDepthError() override;
+
virtual void replace(int offset, int length, const QString &text);
virtual void move(const QmlDesigner::TextModifier::MoveInfo &moveInfo);
QString textBetween(int startPosition, int endPosition) const;
- QString textAt(const QmlJS::AST::SourceLocation &location) const;
+ QString textAt(const QmlJS::SourceLocation &location) const;
int indentDepth() const
{ return textModifier()->indentDepth(); }
- unsigned calculateIndentDepth(const QmlJS::AST::SourceLocation &position) const;
+ unsigned calculateIndentDepth(const QmlJS::SourceLocation &position) const;
static QString addIndentation(const QString &text, unsigned depth);
static QString removeIndentation(const QString &text, unsigned depth);
static QString removeIndentationFromLine(const QString &text, int depth);
- static QmlJS::AST::SourceLocation calculateLocation(QmlJS::AST::UiQualifiedId *id);
+ static QmlJS::SourceLocation calculateLocation(QmlJS::AST::UiQualifiedId *id);
static bool isMissingSemicolon(QmlJS::AST::UiObjectMember *member);
static bool isMissingSemicolon(QmlJS::AST::Statement *stmt);
diff --git a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp
index a5fddccba9..c1298aa92e 100644
--- a/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp
+++ b/src/plugins/qmldesigner/designercore/model/basetexteditmodifier.cpp
@@ -93,7 +93,7 @@ bool BaseTextEditModifier::renameId(const QString &oldId, const QString &newId)
if (auto bte = qobject_cast<TextEditor::TextEditorWidget*>(plainTextEdit())) {
if (auto document = qobject_cast<QmlJSEditor::QmlJSEditorDocument *>(bte->textDocument())) {
Utils::ChangeSet changeSet;
- foreach (const QmlJS::AST::SourceLocation &loc,
+ foreach (const QmlJS::SourceLocation &loc,
document->semanticInfo().idLocations.value(oldId)) {
changeSet.replace(loc.begin(), loc.end(), newId);
}
diff --git a/src/plugins/qmldesigner/designercore/model/documentmessage.cpp b/src/plugins/qmldesigner/designercore/model/documentmessage.cpp
index cbf5843dac..1d0c124b52 100644
--- a/src/plugins/qmldesigner/designercore/model/documentmessage.cpp
+++ b/src/plugins/qmldesigner/designercore/model/documentmessage.cpp
@@ -26,6 +26,7 @@
#include <documentmessage.h>
#include <qmljs/parser/qmljsengine_p.h>
+#include <qmljs/parser/qmljsdiagnosticmessage_p.h>
namespace QmlDesigner {
diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
index de07ef230f..a82792b1e8 100644
--- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
+++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.cpp
@@ -772,8 +772,8 @@ void TextToModelMerger::setupImports(const Document::Ptr &doc,
continue;
QString version;
- if (import->versionToken.isValid())
- version = textAt(doc, import->versionToken);
+ if (import->version != nullptr)
+ version = QLatin1String("%1.%2").arg(import->version->majorVersion).arg(import->version->minorVersion);
const QString &as = import->importId.toString();
if (!import->fileName.isEmpty()) {
@@ -2036,7 +2036,7 @@ void TextToModelMerger::collectLinkErrors(QList<DocumentMessage> *errors, const
void TextToModelMerger::collectImportErrors(QList<DocumentMessage> *errors)
{
if (m_rewriterView->model()->imports().isEmpty()) {
- const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, AST::SourceLocation(0, 0, 0, 0), QCoreApplication::translate("QmlDesigner::TextToModelMerger", "No import statements found"));
+ const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, SourceLocation(0, 0, 0, 0), QCoreApplication::translate("QmlDesigner::TextToModelMerger", "No import statements found"));
errors->append(DocumentMessage(diagnosticMessage, QUrl::fromLocalFile(m_document->fileName())));
}
@@ -2047,7 +2047,7 @@ void TextToModelMerger::collectImportErrors(QList<DocumentMessage> *errors)
if (supportedQtQuickVersion(import.version())) {
hasQtQuick = true;
} else {
- const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, AST::SourceLocation(0, 0, 0, 0),
+ const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, SourceLocation(0, 0, 0, 0),
QCoreApplication::translate("QmlDesigner::TextToModelMerger", "Unsupported QtQuick version"));
errors->append(DocumentMessage(diagnosticMessage, QUrl::fromLocalFile(m_document->fileName())));
}
@@ -2172,14 +2172,14 @@ QSet<QPair<QString, QString> > TextToModelMerger::qrcMapping() const
}
QString TextToModelMerger::textAt(const Document::Ptr &doc,
- const AST::SourceLocation &location)
+ const SourceLocation &location)
{
return doc->source().mid(location.offset, location.length);
}
QString TextToModelMerger::textAt(const Document::Ptr &doc,
- const AST::SourceLocation &from,
- const AST::SourceLocation &to)
+ const SourceLocation &from,
+ const SourceLocation &to)
{
return doc->source().mid(from.offset, to.end() - from.begin());
}
diff --git a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.h b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.h
index 82def3927f..2884453f8c 100644
--- a/src/plugins/qmldesigner/designercore/model/texttomodelmerger.h
+++ b/src/plugins/qmldesigner/designercore/model/texttomodelmerger.h
@@ -144,10 +144,10 @@ private:
void addIsoIconQrcMapping(const QUrl &fileUrl);
static QString textAt(const QmlJS::Document::Ptr &doc,
- const QmlJS::AST::SourceLocation &location);
+ const QmlJS::SourceLocation &location);
static QString textAt(const QmlJS::Document::Ptr &doc,
- const QmlJS::AST::SourceLocation &from,
- const QmlJS::AST::SourceLocation &to);
+ const QmlJS::SourceLocation &from,
+ const QmlJS::SourceLocation &to);
private:
RewriterView *m_rewriterView;
diff --git a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
index 3afca0b036..9ed886246b 100644
--- a/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
+++ b/src/plugins/qmljseditor/qmljscomponentfromobjectdef.cpp
@@ -51,6 +51,7 @@
#include <QMessageBox>
using namespace QmlJS::AST;
+using QmlJS::SourceLocation;
using namespace QmlJSTools;
namespace QmlJSEditor {
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index 13eab82ce4..c260c2f708 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -86,6 +86,7 @@
#include <QTextCodec>
#include <QTimer>
#include <QTreeView>
+#include <QDebug>
enum {
UPDATE_USES_DEFAULT_INTERVAL = 150,
@@ -230,7 +231,7 @@ bool QmlJSEditorWidget::isOutlineCursorChangesBlocked()
void QmlJSEditorWidget::jumpToOutlineElement(int /*index*/)
{
QModelIndex index = m_outlineCombo->view()->currentIndex();
- AST::SourceLocation location = m_qmlJsEditorDocument->outlineModel()->sourceLocation(index);
+ SourceLocation location = m_qmlJsEditorDocument->outlineModel()->sourceLocation(index);
if (!location.isValid())
return;
@@ -332,7 +333,7 @@ void QmlJSEditorWidget::updateUses()
return;
QList<QTextEdit::ExtraSelection> selections;
- foreach (const AST::SourceLocation &loc,
+ foreach (const SourceLocation &loc,
m_qmlJsEditorDocument->semanticInfo().idLocations.value(wordUnderCursor())) {
if (! loc.isValid())
continue;
@@ -432,6 +433,11 @@ protected:
}
}
}
+
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion depth visiting AST in SelectedElement");
+ }
};
void QmlJSEditorWidget::setSelectedElements()
@@ -941,7 +947,7 @@ QModelIndex QmlJSEditorWidget::indexForPosition(unsigned cursorPosition, const Q
const int rowCount = model->rowCount(rootIndex);
for (int i = 0; i < rowCount; ++i) {
QModelIndex childIndex = model->index(i, 0, rootIndex);
- AST::SourceLocation location = model->sourceLocation(childIndex);
+ SourceLocation location = model->sourceLocation(childIndex);
if ((cursorPosition >= location.offset)
&& (cursorPosition <= location.offset + location.length)) {
diff --git a/src/plugins/qmljseditor/qmljseditordocument.cpp b/src/plugins/qmljseditor/qmljseditordocument.cpp
index bb487202c0..b600af61c0 100644
--- a/src/plugins/qmljseditor/qmljseditordocument.cpp
+++ b/src/plugins/qmljseditor/qmljseditordocument.cpp
@@ -43,6 +43,8 @@
#include <qmljstools/qmljsmodelmanager.h>
#include <qmljstools/qmljsqtstylecodeformatter.h>
+#include <QDebug>
+
const char QML_UI_FILE_WARNING[] = "QmlJSEditor.QmlUiFileWarning";
using namespace QmlJSEditor;
@@ -69,7 +71,7 @@ struct Declaration
class FindIdDeclarations: protected Visitor
{
public:
- using Result = QHash<QString, QList<AST::SourceLocation> >;
+ using Result = QHash<QString, QList<SourceLocation> >;
Result operator()(Document::Ptr doc)
{
@@ -110,7 +112,7 @@ protected:
if (auto idExpr = AST::cast<const AST::IdentifierExpression *>(stmt->expression)) {
if (!idExpr->name.isEmpty()) {
const QString &id = idExpr->name.toString();
- QList<AST::SourceLocation> *locs = &_ids[id];
+ QList<SourceLocation> *locs = &_ids[id];
locs->append(idExpr->firstSourceLocation());
locs->append(_maybeIds.value(id));
_maybeIds.remove(id);
@@ -138,6 +140,11 @@ protected:
return false;
}
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion depth while visiting AST in FindIdDeclarations");
+ }
+
private:
Result _ids;
Result _maybeIds;
@@ -414,6 +421,11 @@ protected:
return true;
}
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion depth while visiting AST in CreateRanges");
+ }
+
Range createRange(AST::UiObjectMember *member, AST::UiObjectInitializer *ast)
{
return createRange(member, member->firstSourceLocation(), ast->rbraceToken);
@@ -429,7 +441,7 @@ protected:
return createRange(ast, block->lbraceToken, block->rbraceToken);
}
- Range createRange(AST::Node *ast, AST::SourceLocation start, AST::SourceLocation end)
+ Range createRange(AST::Node *ast, SourceLocation start, SourceLocation end)
{
Range range;
diff --git a/src/plugins/qmljseditor/qmljsfindreferences.cpp b/src/plugins/qmljseditor/qmljsfindreferences.cpp
index 670fc69282..d6f85ef26c 100644
--- a/src/plugins/qmljseditor/qmljsfindreferences.cpp
+++ b/src/plugins/qmljseditor/qmljsfindreferences.cpp
@@ -51,6 +51,7 @@
#include <QTimer>
#include <QtConcurrentRun>
#include <QtConcurrentMap>
+#include <QDebug>
#include <QDir>
#include <QApplication>
#include <QLabel>
@@ -70,7 +71,7 @@ namespace {
class FindUsages: protected Visitor
{
public:
- using Result = QList<AST::SourceLocation>;
+ using Result = QList<SourceLocation>;
FindUsages(Document::Ptr doc, const ContextPtr &context)
: _doc(doc)
@@ -236,6 +237,11 @@ protected:
return true;
}
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion depth while visitin AST in FindUsages");
+ }
+
private:
bool contains(const QmlComponentChain *chain)
{
@@ -294,7 +300,7 @@ private:
class FindTypeUsages: protected Visitor
{
public:
- using Result = QList<AST::SourceLocation>;
+ using Result = QList<SourceLocation>;
FindTypeUsages(Document::Ptr doc, const ContextPtr &context)
: _doc(doc)
@@ -427,6 +433,10 @@ protected:
return false;
}
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion depth while visitin AST in FindTypeUsages");
+ }
private:
bool checkTypeName(UiQualifiedId *id)
@@ -624,6 +634,11 @@ protected:
return true;
}
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion depth visiting AST in FindUsages");
+ }
+
private:
bool containsOffset(SourceLocation start, SourceLocation end)
{
@@ -720,7 +735,7 @@ public:
// find all idenfifier expressions, try to resolve them and check if the result is in scope
FindUsages findUsages(doc, context);
FindUsages::Result results = findUsages(name, scope);
- foreach (const AST::SourceLocation &loc, results)
+ foreach (const SourceLocation &loc, results)
usages.append(Usage(fileName, matchingLine(loc.offset, doc->source()), loc.startLine, loc.startColumn - 1, loc.length));
if (future->isPaused())
future->waitForResume();
@@ -762,7 +777,7 @@ public:
// find all idenfifier expressions, try to resolve them and check if the result is in scope
FindTypeUsages findUsages(doc, context);
FindTypeUsages::Result results = findUsages(name, scope);
- foreach (const AST::SourceLocation &loc, results)
+ foreach (const SourceLocation &loc, results)
usages.append(Usage(fileName, matchingLine(loc.offset, doc->source()), loc.startLine, loc.startColumn - 1, loc.length));
if (future->isPaused())
future->waitForResume();
@@ -944,7 +959,7 @@ QList<FindReferences::Usage> FindReferences::findUsageOfType(const QString &file
foreach (const QmlJS::Document::Ptr &doc, snapshot) {
FindTypeUsages findUsages(doc, context);
FindTypeUsages::Result results = findUsages(typeName, targetValue);
- foreach (const AST::SourceLocation &loc, results) {
+ foreach (const SourceLocation &loc, results) {
usages.append(Usage(doc->fileName(), matchingLine(loc.offset, doc->source()), loc.startLine, loc.startColumn - 1, loc.length));
}
}
diff --git a/src/plugins/qmljseditor/qmljshoverhandler.cpp b/src/plugins/qmljseditor/qmljshoverhandler.cpp
index cf73d63d7c..1009a7f543 100644
--- a/src/plugins/qmljseditor/qmljshoverhandler.cpp
+++ b/src/plugins/qmljseditor/qmljshoverhandler.cpp
@@ -63,8 +63,8 @@ namespace QmlJSEditor {
namespace {
QString textAt(const Document::Ptr doc,
- const AST::SourceLocation &from,
- const AST::SourceLocation &to)
+ const SourceLocation &from,
+ const SourceLocation &to)
{
return doc->source().mid(from.offset, to.end() - from.begin());
}
diff --git a/src/plugins/qmljseditor/qmljsoutline.cpp b/src/plugins/qmljseditor/qmljsoutline.cpp
index abd333f468..0fcac6e60a 100644
--- a/src/plugins/qmljseditor/qmljsoutline.cpp
+++ b/src/plugins/qmljseditor/qmljsoutline.cpp
@@ -206,7 +206,7 @@ void QmlJSOutlineWidget::updateTextCursor(const QModelIndex &index)
if (!m_editor->isOutlineCursorChangesBlocked()) {
QModelIndex sourceIndex = m_filterModel->mapToSource(index);
- AST::SourceLocation location
+ SourceLocation location
= m_editor->qmlJsEditorDocument()->outlineModel()->sourceLocation(sourceIndex);
if (!location.isValid())
diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp
index e3b169f46d..65e9b0ca2e 100644
--- a/src/plugins/qmljseditor/qmljssemantichighlighter.cpp
+++ b/src/plugins/qmljseditor/qmljssemantichighlighter.cpp
@@ -46,6 +46,7 @@
#include <utils/qtcassert.h>
#include <utils/runextensions.h>
+#include <QDebug>
#include <QTextDocument>
#include <QThreadPool>
@@ -163,6 +164,11 @@ protected:
return false;
}
+
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion depth while visitin AST in CollectStateNames");
+ }
};
class CollectionTask : protected Visitor
@@ -453,6 +459,11 @@ protected:
}
}
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit Maximum recursion depth when visiting AST in CollectionTask");
+ }
+
private:
void addUse(const SourceLocation &location, SemanticHighlighter::UseType type)
{
diff --git a/src/plugins/qmljseditor/qmljssemantichighlighter.h b/src/plugins/qmljseditor/qmljssemantichighlighter.h
index 7fa25b588f..77ea2a7c12 100644
--- a/src/plugins/qmljseditor/qmljssemantichighlighter.h
+++ b/src/plugins/qmljseditor/qmljssemantichighlighter.h
@@ -32,7 +32,7 @@
#include <QVector>
namespace QmlJS {
-namespace AST { class SourceLocation; }
+class SourceLocation;
}
namespace TextEditor { class FontSettings; }
diff --git a/src/plugins/qmljseditor/qmljswrapinloader.cpp b/src/plugins/qmljseditor/qmljswrapinloader.cpp
index d83d34e23e..5f0ef4bb05 100644
--- a/src/plugins/qmljseditor/qmljswrapinloader.cpp
+++ b/src/plugins/qmljseditor/qmljswrapinloader.cpp
@@ -35,6 +35,7 @@
#include <qmljs/qmljsbind.h>
#include <qmljstools/qmljsrefactoringchanges.h>
+#include <QDebug>
#include <QDir>
#include <QFileInfo>
#include <QCoreApplication>
@@ -71,6 +72,11 @@ protected:
return true;
}
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion depth while visitin AST in FindIds");
+ }
+
Result result;
};
diff --git a/src/plugins/qmljseditor/qmloutlinemodel.cpp b/src/plugins/qmljseditor/qmloutlinemodel.cpp
index 50162fb1fc..0cda207b51 100644
--- a/src/plugins/qmljseditor/qmloutlinemodel.cpp
+++ b/src/plugins/qmljseditor/qmloutlinemodel.cpp
@@ -64,7 +64,7 @@ QmlOutlineItem::QmlOutlineItem(QmlOutlineModel *model) :
QVariant QmlOutlineItem::data(int role) const
{
if (role == Qt::ToolTipRole) {
- AST::SourceLocation location = m_outlineModel->sourceLocation(index());
+ SourceLocation location = m_outlineModel->sourceLocation(index());
AST::UiQualifiedId *uiQualifiedId = m_outlineModel->idNode(index());
if (!uiQualifiedId || !location.isValid() || !m_outlineModel->m_semanticInfo.isValid())
return QVariant();
@@ -146,6 +146,11 @@ private:
parent.insert(objMember, stack.last());
}
}
+
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion depth while visiting AST in ObjectMemberParentVisitor");
+ }
};
@@ -304,6 +309,11 @@ private:
}
}
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion limit visiting AST in QmlOutlineModelSync");
+ }
+
QmlOutlineModel *m_model;
QHash<AST::Node*, QModelIndex> m_nodeToIndex;
@@ -341,7 +351,7 @@ QMimeData *QmlOutlineModel::mimeData(const QModelIndexList &indexes) const
stream << indexes.size();
for (const auto &index : indexes) {
- AST::SourceLocation location = sourceLocation(index);
+ SourceLocation location = sourceLocation(index);
data->addFile(m_editorDocument->filePath().toString(), location.startLine,
location.startColumn - 1 /*editors have 0-based column*/);
@@ -719,9 +729,9 @@ AST::Node *QmlOutlineModel::nodeForIndex(const QModelIndex &index) const
return nullptr;
}
-AST::SourceLocation QmlOutlineModel::sourceLocation(const QModelIndex &index) const
+SourceLocation QmlOutlineModel::sourceLocation(const QModelIndex &index) const
{
- AST::SourceLocation location;
+ SourceLocation location;
QTC_ASSERT(index.isValid() && (index.model() == this), return location);
AST::Node *node = nodeForIndex(index);
if (node) {
@@ -981,8 +991,8 @@ QString QmlOutlineModel::asString(AST::UiQualifiedId *id)
return text;
}
-AST::SourceLocation QmlOutlineModel::getLocation(AST::UiObjectMember *objMember) {
- AST::SourceLocation location;
+SourceLocation QmlOutlineModel::getLocation(AST::UiObjectMember *objMember) {
+ SourceLocation location;
location = objMember->firstSourceLocation();
location.length = objMember->lastSourceLocation().offset
- objMember->firstSourceLocation().offset
@@ -990,8 +1000,8 @@ AST::SourceLocation QmlOutlineModel::getLocation(AST::UiObjectMember *objMember)
return location;
}
-AST::SourceLocation QmlOutlineModel::getLocation(AST::ExpressionNode *exprNode) {
- AST::SourceLocation location;
+SourceLocation QmlOutlineModel::getLocation(AST::ExpressionNode *exprNode) {
+ SourceLocation location;
location = exprNode->firstSourceLocation();
location.length = exprNode->lastSourceLocation().offset
- exprNode->firstSourceLocation().offset
@@ -999,14 +1009,14 @@ AST::SourceLocation QmlOutlineModel::getLocation(AST::ExpressionNode *exprNode)
return location;
}
-AST::SourceLocation QmlOutlineModel::getLocation(AST::PatternPropertyList *propertyNode) {
+SourceLocation QmlOutlineModel::getLocation(AST::PatternPropertyList *propertyNode) {
if (auto assignment = AST::cast<AST::PatternProperty *>(propertyNode->property))
return getLocation(assignment);
return propertyNode->firstSourceLocation(); // should never happen
}
-AST::SourceLocation QmlOutlineModel::getLocation(AST::PatternProperty *propertyNode) {
- AST::SourceLocation location;
+SourceLocation QmlOutlineModel::getLocation(AST::PatternProperty *propertyNode) {
+ SourceLocation location;
location = propertyNode->name->propertyNameToken;
location.length = propertyNode->initializer->lastSourceLocation().end() - location.offset;
diff --git a/src/plugins/qmljseditor/qmloutlinemodel.h b/src/plugins/qmljseditor/qmloutlinemodel.h
index 17dd08abd8..626b5f3be4 100644
--- a/src/plugins/qmljseditor/qmloutlinemodel.h
+++ b/src/plugins/qmljseditor/qmloutlinemodel.h
@@ -90,7 +90,7 @@ public:
void update(const QmlJSTools::SemanticInfo &semanticInfo);
QmlJS::AST::Node *nodeForIndex(const QModelIndex &index) const;
- QmlJS::AST::SourceLocation sourceLocation(const QModelIndex &index) const;
+ QmlJS::SourceLocation sourceLocation(const QModelIndex &index) const;
QmlJS::AST::UiQualifiedId *idNode(const QModelIndex &index) const;
QIcon icon(const QModelIndex &index) const;
@@ -138,10 +138,10 @@ private:
QStandardItem *parentItem();
static QString asString(QmlJS::AST::UiQualifiedId *id);
- static QmlJS::AST::SourceLocation getLocation(QmlJS::AST::UiObjectMember *objMember);
- static QmlJS::AST::SourceLocation getLocation(QmlJS::AST::ExpressionNode *exprNode);
- static QmlJS::AST::SourceLocation getLocation(QmlJS::AST::PatternProperty *propertyNode);
- static QmlJS::AST::SourceLocation getLocation(QmlJS::AST::PatternPropertyList *propertyNode);
+ static QmlJS::SourceLocation getLocation(QmlJS::AST::UiObjectMember *objMember);
+ static QmlJS::SourceLocation getLocation(QmlJS::AST::ExpressionNode *exprNode);
+ static QmlJS::SourceLocation getLocation(QmlJS::AST::PatternProperty *propertyNode);
+ static QmlJS::SourceLocation getLocation(QmlJS::AST::PatternPropertyList *propertyNode);
QIcon getIcon(QmlJS::AST::UiQualifiedId *objDef);
QString getAnnotation(QmlJS::AST::UiObjectInitializer *objInitializer);
diff --git a/src/plugins/qmljstools/qmljslocatordata.cpp b/src/plugins/qmljstools/qmljslocatordata.cpp
index 3b68bf6521..39ef4f4de5 100644
--- a/src/plugins/qmljstools/qmljslocatordata.cpp
+++ b/src/plugins/qmljstools/qmljslocatordata.cpp
@@ -33,6 +33,7 @@
//#include <qmljs/qmljsinterpreter.h>
#include <qmljs/parser/qmljsast_p.h>
+#include <QDebug>
#include <QMutexLocker>
using namespace QmlJSTools::Internal;
@@ -224,6 +225,11 @@ protected:
return true;
}
+
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion limit visiting AST in FunctionFinder.");
+ }
};
} // anonymous namespace
diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
index 3fda024e4e..2cb21f4f55 100644
--- a/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
+++ b/src/plugins/qmljstools/qmljsrefactoringchanges.cpp
@@ -149,7 +149,7 @@ Document::Ptr QmlJSRefactoringFile::qmljsDocument() const
return m_qmljsDocument;
}
-unsigned QmlJSRefactoringFile::startOf(const AST::SourceLocation &loc) const
+unsigned QmlJSRefactoringFile::startOf(const SourceLocation &loc) const
{
return position(loc.startLine, loc.startColumn);
}
@@ -176,7 +176,7 @@ bool QmlJSRefactoringFile::isCursorOn(AST::UiQualifiedId *ast) const
return pos <= ast->identifierToken.end();
}
-bool QmlJSRefactoringFile::isCursorOn(AST::SourceLocation loc) const
+bool QmlJSRefactoringFile::isCursorOn(SourceLocation loc) const
{
const unsigned pos = cursor().position();
return pos >= loc.begin() && pos <= loc.end();
diff --git a/src/plugins/qmljstools/qmljsrefactoringchanges.h b/src/plugins/qmljstools/qmljsrefactoringchanges.h
index 2d6f5788d4..7d4bf37546 100644
--- a/src/plugins/qmljstools/qmljsrefactoringchanges.h
+++ b/src/plugins/qmljstools/qmljsrefactoringchanges.h
@@ -49,11 +49,11 @@ public:
\returns the offset in the document for the start position of the given
source location.
*/
- unsigned startOf(const QmlJS::AST::SourceLocation &loc) const;
+ unsigned startOf(const QmlJS::SourceLocation &loc) const;
bool isCursorOn(QmlJS::AST::UiObjectMember *ast) const;
bool isCursorOn(QmlJS::AST::UiQualifiedId *ast) const;
- bool isCursorOn(QmlJS::AST::SourceLocation loc) const;
+ bool isCursorOn(QmlJS::SourceLocation loc) const;
protected:
QmlJSRefactoringFile(const QString &fileName, const QSharedPointer<TextEditor::RefactoringChangesData> &data);
diff --git a/src/plugins/qmljstools/qmljssemanticinfo.cpp b/src/plugins/qmljstools/qmljssemanticinfo.cpp
index 1e9eae248a..ce490cd445 100644
--- a/src/plugins/qmljstools/qmljssemanticinfo.cpp
+++ b/src/plugins/qmljstools/qmljssemanticinfo.cpp
@@ -30,6 +30,8 @@
#include <qmljs/qmljsscopechain.h>
#include <qmljs/parser/qmljsengine_p.h>
+#include <QDebug>
+
using namespace QmlJS;
using namespace QmlJS::AST;
@@ -63,13 +65,13 @@ protected:
node->accept(this);
}
- bool containsOffset(AST::SourceLocation start, AST::SourceLocation end)
+ bool containsOffset(SourceLocation start, SourceLocation end)
{
return _offset >= start.begin() && _offset <= end.end();
}
bool handle(AST::Node *ast,
- AST::SourceLocation start, AST::SourceLocation end,
+ SourceLocation start, SourceLocation end,
bool addToPath = true)
{
if (containsOffset(start, end)) {
@@ -99,8 +101,8 @@ protected:
bool visit(AST::UiQualifiedId *ast) override
{
- AST::SourceLocation first = ast->identifierToken;
- AST::SourceLocation last;
+ SourceLocation first = ast->identifierToken;
+ SourceLocation last;
for (AST::UiQualifiedId *it = ast; it; it = it->next)
last = it->identifierToken;
if (containsOffset(first, last))
@@ -125,6 +127,10 @@ protected:
return handleLocationAst(ast);
}
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit maximum recursion depth when visiting the AST in AstPath");
+ }
};
} // anonmymous
diff --git a/src/plugins/qmljstools/qmljssemanticinfo.h b/src/plugins/qmljstools/qmljssemanticinfo.h
index 8d7d1438dc..50bed9a483 100644
--- a/src/plugins/qmljstools/qmljssemanticinfo.h
+++ b/src/plugins/qmljstools/qmljssemanticinfo.h
@@ -85,7 +85,7 @@ public: // attributes
QmlJS::Snapshot snapshot;
QmlJS::ContextPtr context;
QList<Range> ranges;
- QHash<QString, QList<QmlJS::AST::SourceLocation> > idLocations;
+ QHash<QString, QList<QmlJS::SourceLocation> > idLocations;
// these are in addition to the parser messages in the document
QList<QmlJS::DiagnosticMessage> semanticMessages;
diff --git a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp
index cc97f7eb6a..3be8aff25b 100644
--- a/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp
+++ b/src/plugins/qmlprofiler/qmlprofilerdetailsrewriter.cpp
@@ -38,6 +38,8 @@
#include <utils/qtcassert.h>
+#include <QDebug>
+
namespace QmlProfiler {
namespace Internal {
@@ -78,12 +80,16 @@ protected:
return true;
}
+ void throwRecursionDepthError() override
+ {
+ qWarning("Warning: Hit mximum recursion depth while visiting AST in PropertyVisitor");
+ }
private:
QmlJS::AST::Node *m_lastValidNode = nullptr;
quint32 m_line = 0;
quint32 m_column = 0;
- bool containsLocation(QmlJS::AST::SourceLocation start, QmlJS::AST::SourceLocation end)
+ bool containsLocation(QmlJS::SourceLocation start, QmlJS::SourceLocation end)
{
return (m_line > start.startLine
|| (m_line == start.startLine && m_column >= start.startColumn))
diff --git a/src/plugins/todo/qmljstodoitemsscanner.cpp b/src/plugins/todo/qmljstodoitemsscanner.cpp
index df6ea53ea8..c3ec33e9cc 100644
--- a/src/plugins/todo/qmljstodoitemsscanner.cpp
+++ b/src/plugins/todo/qmljstodoitemsscanner.cpp
@@ -78,7 +78,7 @@ void QmlJsTodoItemsScanner::processDocument(QmlJS::Document::Ptr doc)
{
QList<TodoItem> itemList;
- foreach (const QmlJS::AST::SourceLocation &sourceLocation, doc->engine()->comments()) {
+ foreach (const QmlJS::SourceLocation &sourceLocation, doc->engine()->comments()) {
QString source = doc->source().mid(sourceLocation.begin(), sourceLocation.length).trimmed();
// Process every line