forked from qt-creator/qt-creator
QmlJS: accept import without version
Since Qt 6 import without version are accepted and should import the latest version. Change-Id: Id98bd0f7664dd77b30b9c91ee153fccc4160fc6d Fixes: QTCREATORBUG-24533 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
@@ -29,6 +29,9 @@
|
|||||||
#include "qmljsdocument.h"
|
#include "qmljsdocument.h"
|
||||||
#include "qmljsmodelmanagerinterface.h"
|
#include "qmljsmodelmanagerinterface.h"
|
||||||
|
|
||||||
|
#include <QtCore/QVersionNumber>
|
||||||
|
#include <QtCore/QLibraryInfo>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
|
||||||
using namespace LanguageUtils;
|
using namespace LanguageUtils;
|
||||||
@@ -203,7 +206,12 @@ bool Bind::visit(UiImport *ast)
|
|||||||
version = ComponentVersion(ast->version->majorVersion, ast->version->minorVersion);
|
version = ComponentVersion(ast->version->majorVersion, ast->version->minorVersion);
|
||||||
|
|
||||||
if (ast->importUri) {
|
if (ast->importUri) {
|
||||||
if (!version.isValid()) {
|
QVersionNumber qtVersion = QLibraryInfo::version();
|
||||||
|
if (ModelManagerInterface *model = ModelManagerInterface::instance()) {
|
||||||
|
ModelManagerInterface::ProjectInfo pInfo = model->projectInfoForPath(_doc->fileName());
|
||||||
|
qtVersion = QVersionNumber::fromString(pInfo.qtVersionString);
|
||||||
|
}
|
||||||
|
if (!version.isValid() && qtVersion.majorVersion() < 6) {
|
||||||
_diagnosticMessages->append(
|
_diagnosticMessages->append(
|
||||||
errorMessage(ast, tr("package import requires a version number")));
|
errorMessage(ast, tr("package import requires a version number")));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user