forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.13' into master
Change-Id: I3f2a6c553819e992da7e9f538dc44b95b482359e
This commit is contained in:
@@ -3394,14 +3394,17 @@ public:
|
||||
|
||||
SourceLocation firstSourceLocation() const override
|
||||
{
|
||||
if (defaultToken.isValid())
|
||||
return defaultToken;
|
||||
else if (readonlyToken.isValid())
|
||||
return readonlyToken;
|
||||
else if (requiredToken.isValid())
|
||||
return requiredToken;
|
||||
if (requiredToken.isValid()) {
|
||||
if (defaultToken.isValid() && defaultToken.offset < requiredToken.offset)
|
||||
return defaultToken;
|
||||
return requiredToken;
|
||||
}
|
||||
if (defaultToken.isValid())
|
||||
return defaultToken;
|
||||
if (readonlyToken.isValid())
|
||||
return readonlyToken;
|
||||
|
||||
return propertyToken;
|
||||
return propertyToken;
|
||||
}
|
||||
|
||||
SourceLocation lastSourceLocation() const override
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
#include "qmljsdocument.h"
|
||||
#include "qmljsmodelmanagerinterface.h"
|
||||
|
||||
#include <QtCore/QVersionNumber>
|
||||
#include <QtCore/QLibraryInfo>
|
||||
|
||||
#include <utils/algorithm.h>
|
||||
|
||||
using namespace LanguageUtils;
|
||||
@@ -203,7 +206,12 @@ bool Bind::visit(UiImport *ast)
|
||||
version = ComponentVersion(ast->version->majorVersion, ast->version->minorVersion);
|
||||
|
||||
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(
|
||||
errorMessage(ast, tr("package import requires a version number")));
|
||||
}
|
||||
|
||||
@@ -129,6 +129,7 @@ ModelManagerInterface::ModelManagerInterface(QObject *parent)
|
||||
|
||||
m_defaultProjectInfo.qtQmlPath = QFileInfo(
|
||||
QLibraryInfo::location(QLibraryInfo::Qml2ImportsPath)).canonicalFilePath();
|
||||
m_defaultProjectInfo.qtVersionString = QLibraryInfo::version().toString();
|
||||
|
||||
updateImportPaths();
|
||||
|
||||
@@ -607,8 +608,10 @@ ModelManagerInterface::ProjectInfo ModelManagerInterface::projectInfoForPath(
|
||||
ProjectInfo res;
|
||||
const auto allProjectInfos = allProjectInfosForPath(path);
|
||||
for (const ProjectInfo &pInfo : allProjectInfos) {
|
||||
if (res.qtQmlPath.isEmpty())
|
||||
if (res.qtQmlPath.isEmpty()) {
|
||||
res.qtQmlPath = pInfo.qtQmlPath;
|
||||
res.qtVersionString = pInfo.qtVersionString;
|
||||
}
|
||||
res.applicationDirectories.append(pInfo.applicationDirectories);
|
||||
for (const auto &importPath : pInfo.importPaths)
|
||||
res.importPaths.maybeInsert(importPath);
|
||||
@@ -1429,8 +1432,10 @@ ViewerContext ModelManagerInterface::getVContext(const ViewerContext &vCtx,
|
||||
info = projectInfoForPath(doc->fileName());
|
||||
ViewerContext defaultVCtx = defaultVContext(res.language, Document::Ptr(nullptr), false);
|
||||
ProjectInfo defaultInfo = defaultProjectInfo();
|
||||
if (info.qtQmlPath.isEmpty())
|
||||
if (info.qtQmlPath.isEmpty()) {
|
||||
info.qtQmlPath = defaultInfo.qtQmlPath;
|
||||
info.qtVersionString = defaultInfo.qtVersionString;
|
||||
}
|
||||
info.applicationDirectories = Utils::filteredUnique(info.applicationDirectories
|
||||
+ defaultInfo.applicationDirectories);
|
||||
switch (res.flags) {
|
||||
|
||||
@@ -632,6 +632,8 @@ protected:
|
||||
bool visit(UiPublicMember *ast) override
|
||||
{
|
||||
if (ast->type == UiPublicMember::Property) {
|
||||
if (ast->isRequired)
|
||||
out("required ", ast->requiredToken);
|
||||
if (ast->isDefaultMember)
|
||||
out("default ", ast->defaultToken);
|
||||
else if (ast->isReadonlyMember)
|
||||
|
||||
Reference in New Issue
Block a user