forked from qt-creator/qt-creator
Compile fix with recent Qt dev
The reasoning in 1b4766e26c did not take into account that the scope
of QT_NO_JAVA_STYLE_ITERATORS may change over time, as done with
f70905448f6 in Qt base.
Change-Id: Ib1966ff26c4d36d5f62e149d6b45baa4aecf825d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -286,12 +286,9 @@ public:
|
||||
ReplaceInTrie() { }
|
||||
void operator()(QString s)
|
||||
{
|
||||
QHashIterator<QString, QString> i(replacements);
|
||||
QString res = s;
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
for (auto i = replacements.cbegin(), end = replacements.cend(); i != end; ++i)
|
||||
res.replace(i.key(), i.value());
|
||||
}
|
||||
trie = TrieNode::insertF(trie,res);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1577,9 +1577,8 @@ void Check::scanCommentsForAnnotations()
|
||||
|
||||
void Check::warnAboutUnnecessarySuppressions()
|
||||
{
|
||||
QHashIterator< int, QList<MessageTypeAndSuppression> > it(m_disabledMessageTypesByLine);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
for (auto it = m_disabledMessageTypesByLine.cbegin(), end = m_disabledMessageTypesByLine.cend();
|
||||
it != end; ++it) {
|
||||
foreach (const MessageTypeAndSuppression &entry, it.value()) {
|
||||
if (!entry.wasSuppressed)
|
||||
addMessage(WarnUnnecessaryMessageSuppression, entry.suppressionSource);
|
||||
|
||||
@@ -584,10 +584,8 @@ void ImportDependencies::filter(const ViewerContext &vContext)
|
||||
{
|
||||
QMap<QString, CoreImport> newCoreImports;
|
||||
QMap<ImportKey, QStringList> newImportCache;
|
||||
QMapIterator<QString, CoreImport> j(m_coreImports);
|
||||
bool hasChanges = false;
|
||||
while (j.hasNext()) {
|
||||
j.next();
|
||||
for (auto j = m_coreImports.cbegin(), end = m_coreImports.cend(); j != end; ++j) {
|
||||
const CoreImport &cImport = j.value();
|
||||
if (vContext.languageIsCompatible(cImport.language)) {
|
||||
QList<Export> newExports;
|
||||
@@ -923,10 +921,8 @@ QSet<ImportKey> ImportDependencies::subdirImports(
|
||||
|
||||
void ImportDependencies::checkConsistency() const
|
||||
{
|
||||
QMapIterator<ImportKey, QStringList> j(m_importCache);
|
||||
while (j.hasNext()) {
|
||||
j.next();
|
||||
foreach (const QString &s, j.value()) {
|
||||
for (auto j = m_importCache.cbegin(), end = m_importCache.cend(); j != end; ++j) {
|
||||
for (const QString &s : j.value()) {
|
||||
bool found = false;
|
||||
foreach (const Export &e, m_coreImports.value(s).possibleExports)
|
||||
if (e.exportName == j.key())
|
||||
@@ -934,19 +930,15 @@ void ImportDependencies::checkConsistency() const
|
||||
Q_ASSERT(found); Q_UNUSED(found)
|
||||
}
|
||||
}
|
||||
QMapIterator<QString,CoreImport> i(m_coreImports);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
for (auto i = m_coreImports.cbegin(), end = m_coreImports.cend(); i != end; ++i) {
|
||||
foreach (const Export &e, i.value().possibleExports) {
|
||||
if (!m_importCache.value(e.exportName).contains(i.key())) {
|
||||
qCWarning(importsLog) << e.exportName.toString();
|
||||
qCWarning(importsLog) << i.key();
|
||||
|
||||
QMapIterator<ImportKey, QStringList> j(m_importCache);
|
||||
while (j.hasNext()) {
|
||||
j.next();
|
||||
for (auto j = m_importCache.cbegin(), end = m_importCache.cend(); j != end; ++j)
|
||||
qCWarning(importsLog) << j.key().toString() << j.value();
|
||||
}
|
||||
|
||||
qCWarning(importsLog) << m_importCache.contains(e.exportName);
|
||||
qCWarning(importsLog) << m_importCache.value(e.exportName);
|
||||
}
|
||||
|
||||
@@ -1098,11 +1098,7 @@ bool ObjectValue::checkPrototype(const ObjectValue *, QSet<const ObjectValue *>
|
||||
|
||||
void ObjectValue::processMembers(MemberProcessor *processor) const
|
||||
{
|
||||
QHashIterator<QString, PropertyData> it(m_members);
|
||||
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
|
||||
for (auto it = m_members.cbegin(), end = m_members.cend(); it != end; ++it) {
|
||||
if (! processor->processProperty(it.key(), it.value().value, it.value().propertyInfo))
|
||||
break;
|
||||
}
|
||||
@@ -2359,10 +2355,9 @@ TypeScope::TypeScope(const Imports *imports, ValueOwner *valueOwner)
|
||||
const Value *TypeScope::lookupMember(const QString &name, const Context *context,
|
||||
const ObjectValue **foundInObject, bool) const
|
||||
{
|
||||
QListIterator<Import> it(m_imports->all());
|
||||
it.toBack();
|
||||
while (it.hasPrevious()) {
|
||||
const Import &i = it.previous();
|
||||
const QList<Import> &imports = m_imports->all();
|
||||
for (int pos = imports.size(); --pos >= 0; ) {
|
||||
const Import &i = imports.at(pos);
|
||||
const ObjectValue *import = i.object;
|
||||
const ImportInfo &info = i.info;
|
||||
|
||||
@@ -2374,7 +2369,7 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context
|
||||
if (info.as() == name) {
|
||||
if (foundInObject)
|
||||
*foundInObject = this;
|
||||
i.used = true;
|
||||
i.used = true; // FIXME: This evilly modifies a 'const' object
|
||||
return import;
|
||||
}
|
||||
continue;
|
||||
@@ -2392,10 +2387,9 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context
|
||||
|
||||
void TypeScope::processMembers(MemberProcessor *processor) const
|
||||
{
|
||||
QListIterator<Import> it(m_imports->all());
|
||||
it.toBack();
|
||||
while (it.hasPrevious()) {
|
||||
const Import &i = it.previous();
|
||||
const QList<Import> &imports = m_imports->all();
|
||||
for (int pos = imports.size(); --pos >= 0; ) {
|
||||
const Import &i = imports.at(pos);
|
||||
const ObjectValue *import = i.object;
|
||||
const ImportInfo &info = i.info;
|
||||
|
||||
@@ -2424,10 +2418,9 @@ JSImportScope::JSImportScope(const Imports *imports, ValueOwner *valueOwner)
|
||||
const Value *JSImportScope::lookupMember(const QString &name, const Context *,
|
||||
const ObjectValue **foundInObject, bool) const
|
||||
{
|
||||
QListIterator<Import> it(m_imports->all());
|
||||
it.toBack();
|
||||
while (it.hasPrevious()) {
|
||||
const Import &i = it.previous();
|
||||
const QList<Import> &imports = m_imports->all();
|
||||
for (int pos = imports.size(); --pos >= 0; ) {
|
||||
const Import &i = imports.at(pos);
|
||||
const ObjectValue *import = i.object;
|
||||
const ImportInfo &info = i.info;
|
||||
|
||||
@@ -2449,10 +2442,9 @@ const Value *JSImportScope::lookupMember(const QString &name, const Context *,
|
||||
|
||||
void JSImportScope::processMembers(MemberProcessor *processor) const
|
||||
{
|
||||
QListIterator<Import> it(m_imports->all());
|
||||
it.toBack();
|
||||
while (it.hasPrevious()) {
|
||||
const Import &i = it.previous();
|
||||
const QList<Import> &imports = m_imports->all();
|
||||
for (int pos = imports.size(); --pos >= 0; ) {
|
||||
const Import &i = imports.at(pos);
|
||||
const ObjectValue *import = i.object;
|
||||
const ImportInfo &info = i.info;
|
||||
|
||||
@@ -2505,10 +2497,8 @@ ImportInfo Imports::info(const QString &name, const Context *context) const
|
||||
if (dotIdx != -1)
|
||||
firstId = firstId.left(dotIdx);
|
||||
|
||||
QListIterator<Import> it(m_imports);
|
||||
it.toBack();
|
||||
while (it.hasPrevious()) {
|
||||
const Import &i = it.previous();
|
||||
for (int pos = m_imports.size(); --pos >= 0; ) {
|
||||
const Import &i = m_imports.at(pos);
|
||||
const ObjectValue *import = i.object;
|
||||
const ImportInfo &info = i.info;
|
||||
|
||||
@@ -2531,10 +2521,8 @@ ImportInfo Imports::info(const QString &name, const Context *context) const
|
||||
|
||||
QString Imports::nameForImportedObject(const ObjectValue *value, const Context *context) const
|
||||
{
|
||||
QListIterator<Import> it(m_imports);
|
||||
it.toBack();
|
||||
while (it.hasPrevious()) {
|
||||
const Import &i = it.previous();
|
||||
for (int pos = m_imports.size(); --pos >= 0; ) {
|
||||
const Import &i = m_imports.at(pos);
|
||||
const ObjectValue *import = i.object;
|
||||
const ImportInfo &info = i.info;
|
||||
|
||||
@@ -2617,10 +2605,8 @@ public:
|
||||
void Imports::dump() const
|
||||
{
|
||||
qCDebug(qmljsLog) << "Imports contents, in search order:";
|
||||
QListIterator<Import> it(m_imports);
|
||||
it.toBack();
|
||||
while (it.hasPrevious()) {
|
||||
const Import &i = it.previous();
|
||||
for (int pos = m_imports.size(); --pos >= 0; ) {
|
||||
const Import &i = m_imports.at(pos);
|
||||
const ObjectValue *import = i.object;
|
||||
const ImportInfo &info = i.info;
|
||||
|
||||
|
||||
@@ -143,23 +143,18 @@ Link::Link(const Snapshot &snapshot, const ViewerContext &vContext, const Librar
|
||||
|
||||
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
||||
if (modelManager) {
|
||||
ModelManagerInterface::CppDataHash cppDataHash = modelManager->cppData();
|
||||
const ModelManagerInterface::CppDataHash cppDataHash = modelManager->cppData();
|
||||
{
|
||||
// populate engine with types from C++
|
||||
ModelManagerInterface::CppDataHashIterator cppDataHashIterator(cppDataHash);
|
||||
while (cppDataHashIterator.hasNext()) {
|
||||
cppDataHashIterator.next();
|
||||
d->valueOwner->cppQmlTypes().load(cppDataHashIterator.key(),
|
||||
cppDataHashIterator.value().exportedTypes);
|
||||
}
|
||||
for (auto it = cppDataHash.cbegin(), end = cppDataHash.cend(); it != end; ++it)
|
||||
d->valueOwner->cppQmlTypes().load(it.key(), it.value().exportedTypes);
|
||||
}
|
||||
|
||||
// build an object with the context properties from C++
|
||||
ObjectValue *cppContextProperties = d->valueOwner->newObject(/* prototype = */ 0);
|
||||
foreach (const ModelManagerInterface::CppData &cppData, cppDataHash) {
|
||||
QHashIterator<QString, QString> it(cppData.contextProperties);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
for (const ModelManagerInterface::CppData &cppData : cppDataHash) {
|
||||
for (auto it = cppData.contextProperties.cbegin(), end = cppData.contextProperties.cend();
|
||||
it != end; ++it) {
|
||||
const Value *value = 0;
|
||||
const QString cppTypeName = it.value();
|
||||
if (!cppTypeName.isEmpty())
|
||||
@@ -332,10 +327,8 @@ Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &i
|
||||
|
||||
importLibrary(doc, path, &import);
|
||||
|
||||
QMapIterator<QString,QStringList> iter(ModelManagerInterface::instance()
|
||||
->filesInQrcPath(path));
|
||||
while (iter.hasNext()) {
|
||||
iter.next();
|
||||
const QMap<QString, QStringList> paths = ModelManagerInterface::instance()->filesInQrcPath(path);
|
||||
for (auto iter = paths.cbegin(), end = paths.cend(); iter != end; ++iter) {
|
||||
if (ModelManagerInterface::guessLanguageOfFile(iter.key()).isQmlLikeLanguage()) {
|
||||
Document::Ptr importedDoc = snapshot.document(iter.value().at(0));
|
||||
if (importedDoc && importedDoc->bind()->rootObjectValue()) {
|
||||
|
||||
@@ -175,15 +175,10 @@ Dialect ModelManagerInterface::guessLanguageOfFile(const QString &fileName)
|
||||
|
||||
QStringList ModelManagerInterface::globPatternsForLanguages(const QList<Dialect> languages)
|
||||
{
|
||||
QHash<QString, Dialect> lMapping;
|
||||
if (instance())
|
||||
lMapping = instance()->languageForSuffix();
|
||||
else
|
||||
lMapping = defaultLanguageMapping();
|
||||
QStringList patterns;
|
||||
QHashIterator<QString,Dialect> i(lMapping);
|
||||
while (i.hasNext()) {
|
||||
i.next();
|
||||
const QHash<QString, Dialect> lMapping =
|
||||
instance() ? instance()->languageForSuffix() : defaultLanguageMapping();
|
||||
for (auto i = lMapping.cbegin(), end = lMapping.cend(); i != end; ++i) {
|
||||
if (languages.contains(i.value()))
|
||||
patterns << QLatin1String("*.") + i.key();
|
||||
}
|
||||
@@ -725,9 +720,8 @@ static void findNewFileImports(const Document::Ptr &doc, const Snapshot &snapsho
|
||||
*importedFiles += importPath;
|
||||
}
|
||||
} else if (import.type() == ImportType::QrcDirectory) {
|
||||
QMapIterator<QString,QStringList> dirContents(ModelManagerInterface::instance()->filesInQrcPath(importName));
|
||||
while (dirContents.hasNext()) {
|
||||
dirContents.next();
|
||||
const QMap<QString, QStringList> files = ModelManagerInterface::instance()->filesInQrcPath(importName);
|
||||
for (auto dirContents = files.cbegin(), end = files.cend(); dirContents != end; ++dirContents) {
|
||||
if (ModelManagerInterface::guessLanguageOfFile(dirContents.key()).isQmlLikeOrJsLanguage()) {
|
||||
foreach (const QString &filePath, dirContents.value()) {
|
||||
if (! snapshot.document(filePath))
|
||||
@@ -1091,10 +1085,7 @@ void ModelManagerInterface::updateImportPaths()
|
||||
PathsAndLanguages allImportPaths;
|
||||
QmlLanguageBundles activeBundles;
|
||||
QmlLanguageBundles extendedBundles;
|
||||
QMapIterator<ProjectExplorer::Project *, ProjectInfo> pInfoIter(m_projects);
|
||||
QHashIterator<Dialect, QmlJS::ViewerContext> vCtxsIter = m_defaultVContexts;
|
||||
while (pInfoIter.hasNext()) {
|
||||
pInfoIter.next();
|
||||
for (auto pInfoIter = m_projects.cbegin(), end = m_projects.cend(); pInfoIter != end; ++pInfoIter) {
|
||||
const PathsAndLanguages &iPaths = pInfoIter.value().importPaths;
|
||||
for (int i = 0; i < iPaths.size(); ++i) {
|
||||
PathAndLanguage pAndL = iPaths.at(i);
|
||||
@@ -1104,14 +1095,12 @@ void ModelManagerInterface::updateImportPaths()
|
||||
pAndL.language());
|
||||
}
|
||||
}
|
||||
while (vCtxsIter.hasNext()) {
|
||||
vCtxsIter.next();
|
||||
for (auto vCtxsIter = m_defaultVContexts.cbegin(), end = m_defaultVContexts.cend();
|
||||
vCtxsIter != end; ++ vCtxsIter) {
|
||||
foreach (const QString &path, vCtxsIter.value().paths)
|
||||
allImportPaths.maybeInsert(Utils::FilePath::fromString(path), vCtxsIter.value().language);
|
||||
}
|
||||
pInfoIter.toFront();
|
||||
while (pInfoIter.hasNext()) {
|
||||
pInfoIter.next();
|
||||
for (auto pInfoIter = m_projects.cbegin(), end = m_projects.cend(); pInfoIter != end; ++pInfoIter) {
|
||||
activeBundles.mergeLanguageBundles(pInfoIter.value().activeBundle);
|
||||
foreach (Dialect l, pInfoIter.value().activeBundle.languages()) {
|
||||
foreach (const QString &path, pInfoIter.value().activeBundle.bundleForLanguage(l)
|
||||
@@ -1122,9 +1111,7 @@ void ModelManagerInterface::updateImportPaths()
|
||||
}
|
||||
}
|
||||
}
|
||||
pInfoIter.toFront();
|
||||
while (pInfoIter.hasNext()) {
|
||||
pInfoIter.next();
|
||||
for (auto pInfoIter = m_projects.cbegin(), end = m_projects.cend(); pInfoIter != end; ++pInfoIter) {
|
||||
QString pathAtt = pInfoIter.value().qtQmlPath;
|
||||
if (!pathAtt.isEmpty())
|
||||
allImportPaths.maybeInsert(Utils::FilePath::fromString(pathAtt), Dialect::QmlQtQuick2);
|
||||
|
||||
@@ -132,7 +132,6 @@ public:
|
||||
};
|
||||
|
||||
typedef QHash<QString, CppData> CppDataHash;
|
||||
typedef QHashIterator<QString, CppData> CppDataHashIterator;
|
||||
|
||||
public:
|
||||
ModelManagerInterface(QObject *parent = nullptr);
|
||||
|
||||
Reference in New Issue
Block a user