summaryrefslogtreecommitdiff
path: root/src/libs/qmljs
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2013-12-10 12:53:20 +0100
committerErik Verbruggen <erik.verbruggen@digia.com>2013-12-10 12:53:20 +0100
commit9f831dde07cb2411808534e76669b28a1b76e21d (patch)
treeed6252d64c9a3ab27aa93786272cda1b6008f3c7 /src/libs/qmljs
parentcdac81f896ef4b052d76f96485a08e6ec13696b8 (diff)
parentea1a92484ac99057b06130a012164bf9788650e9 (diff)
downloadqt-creator-wip/clang.tar.gz
Merge remote-tracking branch 'origin/master' into wip/clangwip/clang
Change-Id: I8a2c8068a3f2b15034fb1bf6304c9a0f3f0e3c8f
Diffstat (limited to 'src/libs/qmljs')
-rw-r--r--src/libs/qmljs/persistenttrie.cpp7
-rw-r--r--src/libs/qmljs/qmljsimportdependencies.cpp38
-rw-r--r--src/libs/qmljs/qmljsimportdependencies.h1
-rw-r--r--src/libs/qmljs/qmljsreformatter.cpp5
-rw-r--r--src/libs/qmljs/qmljsstaticanalysismessage.cpp6
5 files changed, 45 insertions, 12 deletions
diff --git a/src/libs/qmljs/persistenttrie.cpp b/src/libs/qmljs/persistenttrie.cpp
index 74c9593c7d..521d90f31c 100644
--- a/src/libs/qmljs/persistenttrie.cpp
+++ b/src/libs/qmljs/persistenttrie.cpp
@@ -654,7 +654,7 @@ int matchStrength(const QString &searchStr, const QString &str)
{
QString::const_iterator i = searchStr.constBegin(), iEnd = searchStr.constEnd(),
j = str.constBegin(), jEnd = str.constEnd();
- bool lastWasNotUpper=true, lastWasSpacer=true, lastWasMatch = false;
+ bool lastWasNotUpper=true, lastWasSpacer=true, lastWasMatch = false, didJump = false;
int res = 0;
while (i != iEnd && j != jEnd) {
bool thisIsUpper = (*j).isUpper();
@@ -667,6 +667,7 @@ int matchStrength(const QString &searchStr, const QString &str)
lastWasMatch = true;
++i;
} else {
+ didJump = true;
lastWasMatch = false;
}
++j;
@@ -674,9 +675,11 @@ int matchStrength(const QString &searchStr, const QString &str)
lastWasSpacer = !thisIsLetterOrNumber;
}
if (i != iEnd)
- return iEnd - i;
+ return i - iEnd;
if (j == jEnd)
++res;
+ if (!didJump)
+ res+=2;
return res;
}
diff --git a/src/libs/qmljs/qmljsimportdependencies.cpp b/src/libs/qmljs/qmljsimportdependencies.cpp
index dffcf8ee4b..9dc0e53f54 100644
--- a/src/libs/qmljs/qmljsimportdependencies.cpp
+++ b/src/libs/qmljs/qmljsimportdependencies.cpp
@@ -314,7 +314,7 @@ int ImportKey::compare(const ImportKey &other) const
QString v2 = other.splitPath.at(i);
if (v1 < v2)
return -1;
- if (v2 > v1)
+ if (v1 > v2)
return 1;
}
if (len1 < len2)
@@ -626,7 +626,7 @@ void ImportDependencies::iterateOnCandidateImports(
break;
default:
{
- QStringList imp = m_importCache.value(key.flatKey());
+ const QStringList imp = m_importCache.value(key.flatKey());
foreach (const QString &cImportName, imp) {
CoreImport cImport = coreImport(cImportName);
if (vContext.languageIsCompatible(cImport.language)) {
@@ -928,4 +928,38 @@ QSet<ImportKey> ImportDependencies::subdirImports(
return res;
}
+void ImportDependencies::checkConsistency() const
+{
+ QMapIterator<ImportKey, QStringList> j(m_importCache);
+ while (j.hasNext()) {
+ j.next();
+ foreach (const QString &s, j.value()) {
+ bool found = false;
+ foreach (const Export &e, m_coreImports.value(s).possibleExports)
+ if (e.exportName == j.key())
+ found = true;
+ Q_ASSERT(found);
+ }
+ }
+ QMapIterator<QString,CoreImport> i(m_coreImports);
+ while (i.hasNext()) {
+ i.next();
+ foreach (const Export &e, i.value().possibleExports) {
+ if (!m_importCache.value(e.exportName).contains(i.key())) {
+ qDebug() << e.exportName.toString();
+ qDebug() << i.key();
+
+ QMapIterator<ImportKey, QStringList> j(m_importCache);
+ while (j.hasNext()) {
+ j.next();
+ qDebug() << j.key().toString() << j.value();
+ }
+ qDebug() << m_importCache.contains(e.exportName);
+ qDebug() << m_importCache.value(e.exportName);
+ }
+ Q_ASSERT(m_importCache.value(e.exportName).contains(i.key()));
+ }
+ }
+}
+
} // namespace QmlJS
diff --git a/src/libs/qmljs/qmljsimportdependencies.h b/src/libs/qmljs/qmljsimportdependencies.h
index fc84f0794f..1e27ef0626 100644
--- a/src/libs/qmljs/qmljsimportdependencies.h
+++ b/src/libs/qmljs/qmljsimportdependencies.h
@@ -223,6 +223,7 @@ public:
QSet<ImportKey> libraryImports(const ViewerContext &viewContext) const;
QSet<ImportKey> subdirImports(const ImportKey &baseKey, const ViewerContext &viewContext) const;
+ void checkConsistency() const;
private:
void removeImportCacheEntry(const ImportKey &importKey, const QString &importId);
diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp
index 9295fcc319..d940cd1c65 100644
--- a/src/libs/qmljs/qmljsreformatter.cpp
+++ b/src/libs/qmljs/qmljsreformatter.cpp
@@ -139,11 +139,6 @@ protected:
Node::accept(node, this);
}
- void acceptIndented(Node *node)
- {
- accept(node);
- }
-
void lnAcceptIndented(Node *node)
{
newLine();
diff --git a/src/libs/qmljs/qmljsstaticanalysismessage.cpp b/src/libs/qmljs/qmljsstaticanalysismessage.cpp
index 6f6de15fdc..235639ce32 100644
--- a/src/libs/qmljs/qmljsstaticanalysismessage.cpp
+++ b/src/libs/qmljs/qmljsstaticanalysismessage.cpp
@@ -210,14 +210,14 @@ StaticAnalysisMessages::StaticAnalysisMessages()
tr("%1 elements expected in array value."), 1);
newMsg(WarnImperativeCodeNotEditableInVisualDesigner, Error,
tr("Imperative code is not supported in the Qt Quick Designer."));
- newMsg(WarnUnsupportedTypeInVisualDesigner, Error,
+ newMsg(WarnUnsupportedTypeInVisualDesigner, Warning,
tr("This type is not supported in the Qt Quick Designer."));
newMsg(WarnReferenceToParentItemNotSupportedByVisualDesigner, Error,
tr("Reference to parent item cannot be resolved correctly by the Qt Quick Designer."));
- newMsg(WarnUndefinedValueForVisualDesigner, Error,
+ newMsg(WarnUndefinedValueForVisualDesigner, Warning,
tr("This visual property binding cannot be evaluated in the local context "
"and might not show up in Qt Quick Designer as expected."));
- newMsg(WarnStatesOnlyInRootItemForVisualDesigner, Error,
+ newMsg(WarnStatesOnlyInRootItemForVisualDesigner, Warning,
tr("Qt Quick Designer only supports states in the root item."));
newMsg(WarnAboutQtQuick1InsteadQtQuick2, Warning,
tr("Using Qt Quick 1 code model instead of Qt Quick 2."));