diff options
Diffstat (limited to 'src/plugins/qmljseditor/qmljsfindreferences.cpp')
-rw-r--r-- | src/plugins/qmljseditor/qmljsfindreferences.cpp | 25 |
1 files changed, 20 insertions, 5 deletions
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)); } } |