forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user