Commit 6bdc9f86 authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner.Rewriter: Only support for QtQuick 1.(1)

Adding error message for any QtQuick version different from
1.0/1.1

Change-Id: I0a90a3ddb36a055e4cd23a87557845c117130fd7
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@digia.com>
parent 0d160aaa
......@@ -63,6 +63,20 @@ using namespace QmlJS::AST;
namespace {
static inline QStringList supportedVersionsList()
{
QStringList list;
list << QLatin1String("1.0") << QLatin1String("1.1");
return list;
}
static inline bool supportedQtQuickVersion(const QString &version)
{
static QStringList supportedVersions = supportedVersionsList();
return supportedVersions.contains(version);
}
static inline QString stripQuotes(const QString &str)
{
if ((str.startsWith(QLatin1Char('"')) && str.endsWith(QLatin1Char('"')))
......@@ -760,6 +774,14 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
errors.append(RewriterView::Error(diagnosticMessage, QUrl::fromLocalFile(doc->fileName())));
}
foreach (const QmlDesigner::Import &import, m_rewriterView->model()->imports()) {
if (import.isLibraryImport() && import.url() == QLatin1String("QtQuick") && !supportedQtQuickVersion(import.version())) {
const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::DiagnosticMessage::Error, AST::SourceLocation(0, 0, 0, 0),
QCoreApplication::translate("QmlDesigner::TextToModelMerger error message", "Unsupported QtQuick version"));
errors.append(RewriterView::Error(diagnosticMessage, QUrl::fromLocalFile(doc->fileName())));
}
}
if (view()->checkSemanticErrors()) {
Check check(doc, m_scopeChain->context());
check.disableMessage(StaticAnalysis::ErrUnknownComponent);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment