2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-07-09 15:47:07 +02:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2010-07-09 15:47:07 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-07-09 15:47:07 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2010-07-09 15:47:07 +02:00
|
|
|
**
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
**
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-07-09 15:47:07 +02:00
|
|
|
|
2010-01-28 14:53:53 +01:00
|
|
|
#include "qmljslink.h"
|
|
|
|
|
|
|
|
#include "parser/qmljsast_p.h"
|
|
|
|
#include "qmljsdocument.h"
|
|
|
|
#include "qmljsbind.h"
|
2011-10-07 14:04:06 +02:00
|
|
|
#include "qmljsutils.h"
|
2010-08-25 14:15:57 +02:00
|
|
|
#include "qmljsmodelmanagerinterface.h"
|
2013-10-16 15:08:27 +02:00
|
|
|
#include "qmljsqrcparser.h"
|
|
|
|
#include "qmljsconstants.h"
|
2010-01-28 14:53:53 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QDir>
|
2010-01-28 14:53:53 +01:00
|
|
|
|
2010-12-03 11:17:25 +01:00
|
|
|
using namespace LanguageUtils;
|
2010-01-28 14:53:53 +01:00
|
|
|
using namespace QmlJS;
|
|
|
|
using namespace QmlJS::AST;
|
|
|
|
|
2010-09-16 15:29:37 +02:00
|
|
|
namespace {
|
|
|
|
class ImportCacheKey
|
|
|
|
{
|
|
|
|
public:
|
2011-08-08 12:47:49 +02:00
|
|
|
explicit ImportCacheKey(const ImportInfo &info)
|
2010-09-16 15:29:37 +02:00
|
|
|
: type(info.type())
|
2011-09-21 12:42:27 +02:00
|
|
|
, path(info.path())
|
2010-09-16 15:29:37 +02:00
|
|
|
, majorVersion(info.version().majorVersion())
|
|
|
|
, minorVersion(info.version().minorVersion())
|
|
|
|
{}
|
|
|
|
|
|
|
|
int type;
|
2011-09-21 12:42:27 +02:00
|
|
|
QString path;
|
2010-09-16 15:29:37 +02:00
|
|
|
int majorVersion;
|
|
|
|
int minorVersion;
|
|
|
|
};
|
|
|
|
|
|
|
|
uint qHash(const ImportCacheKey &info)
|
|
|
|
{
|
2011-09-21 12:42:27 +02:00
|
|
|
return ::qHash(info.type) ^ ::qHash(info.path) ^
|
2010-09-16 15:29:37 +02:00
|
|
|
::qHash(info.majorVersion) ^ ::qHash(info.minorVersion);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const ImportCacheKey &i1, const ImportCacheKey &i2)
|
|
|
|
{
|
|
|
|
return i1.type == i2.type
|
2011-09-21 12:42:27 +02:00
|
|
|
&& i1.path == i2.path
|
2010-09-16 15:29:37 +02:00
|
|
|
&& i1.majorVersion == i2.majorVersion
|
|
|
|
&& i1.minorVersion == i2.minorVersion;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class QmlJS::LinkPrivate
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Snapshot snapshot;
|
2011-08-08 12:47:49 +02:00
|
|
|
ValueOwner *valueOwner;
|
2010-09-16 15:29:37 +02:00
|
|
|
QStringList importPaths;
|
2011-06-28 12:01:56 +02:00
|
|
|
LibraryInfo builtins;
|
2013-10-16 15:08:27 +02:00
|
|
|
ViewerContext vContext;
|
2010-09-16 15:29:37 +02:00
|
|
|
|
2011-05-27 10:43:06 +02:00
|
|
|
QHash<ImportCacheKey, Import> importCache;
|
2010-09-16 15:29:37 +02:00
|
|
|
|
2011-10-12 08:36:02 +02:00
|
|
|
QHash<QString, QList<ModuleApiInfo> > importableModuleApis;
|
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
Document::Ptr document;
|
2011-04-21 11:09:29 +02:00
|
|
|
QList<DiagnosticMessage> *diagnosticMessages;
|
|
|
|
|
|
|
|
QHash<QString, QList<DiagnosticMessage> > *allDiagnosticMessages;
|
2011-09-13 13:32:29 +02:00
|
|
|
|
|
|
|
Context::ImportsPerDocument linkImports();
|
|
|
|
|
|
|
|
void populateImportedTypes(Imports *imports, Document::Ptr doc);
|
|
|
|
Import importFileOrDirectory(
|
|
|
|
Document::Ptr doc,
|
|
|
|
const ImportInfo &importInfo);
|
|
|
|
Import importNonFile(
|
|
|
|
Document::Ptr doc,
|
|
|
|
const ImportInfo &importInfo);
|
|
|
|
void importObject(Bind *bind, const QString &name, ObjectValue *object, NameId *targetNamespace);
|
|
|
|
|
|
|
|
bool importLibrary(Document::Ptr doc,
|
|
|
|
const QString &libraryPath,
|
|
|
|
Import *import,
|
|
|
|
const QString &importPath = QString());
|
|
|
|
void loadQmldirComponents(ObjectValue *import,
|
|
|
|
LanguageUtils::ComponentVersion version,
|
|
|
|
const LibraryInfo &libraryInfo,
|
|
|
|
const QString &libraryPath);
|
|
|
|
void loadImplicitDirectoryImports(Imports *imports, Document::Ptr doc);
|
|
|
|
void loadImplicitDefaultImports(Imports *imports);
|
|
|
|
|
|
|
|
void error(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message);
|
|
|
|
void warning(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message);
|
|
|
|
void appendDiagnostic(const Document::Ptr &doc, const DiagnosticMessage &message);
|
2010-09-16 15:29:37 +02:00
|
|
|
};
|
|
|
|
|
2010-09-15 15:25:59 +02:00
|
|
|
/*!
|
|
|
|
\class QmlJS::Link
|
2013-06-05 14:29:24 +02:00
|
|
|
\brief The Link class creates a Context for a Snapshot.
|
2011-11-09 16:02:59 +01:00
|
|
|
\sa Context Snapshot
|
2010-09-15 15:25:59 +02:00
|
|
|
|
2011-11-01 14:01:07 +01:00
|
|
|
Initializes a context by resolving imports. This is an expensive operation.
|
2010-09-15 15:25:59 +02:00
|
|
|
|
2011-11-01 14:01:07 +01:00
|
|
|
Instead of making a fresh context, consider reusing the one maintained in the
|
2014-01-24 16:53:16 +01:00
|
|
|
\l{QmlJSEditor::SemanticInfo} of a \l{QmlJSEditor::QmlJSEditorDocument}.
|
2010-09-15 15:25:59 +02:00
|
|
|
*/
|
|
|
|
|
2013-10-16 15:08:27 +02:00
|
|
|
Link::Link(const Snapshot &snapshot, const ViewerContext &vContext, const LibraryInfo &builtins)
|
2011-09-13 13:32:29 +02:00
|
|
|
: d(new LinkPrivate)
|
2010-02-02 15:55:17 +01:00
|
|
|
{
|
2011-07-01 13:41:40 +02:00
|
|
|
d->valueOwner = new ValueOwner;
|
2010-09-16 15:29:37 +02:00
|
|
|
d->snapshot = snapshot;
|
2013-10-16 15:08:27 +02:00
|
|
|
d->importPaths = vContext.paths;
|
2011-06-28 12:01:56 +02:00
|
|
|
d->builtins = builtins;
|
2013-10-16 15:08:27 +02:00
|
|
|
d->vContext = vContext;
|
2010-09-16 15:29:37 +02:00
|
|
|
|
2011-04-21 11:09:29 +02:00
|
|
|
d->diagnosticMessages = 0;
|
2011-05-06 13:31:30 +02:00
|
|
|
d->allDiagnosticMessages = 0;
|
2011-04-21 11:09:29 +02:00
|
|
|
|
|
|
|
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
|
|
|
if (modelManager) {
|
2011-08-25 12:35:55 +02:00
|
|
|
ModelManagerInterface::CppDataHash cppDataHash = modelManager->cppData();
|
|
|
|
|
|
|
|
// populate engine with types from C++
|
|
|
|
foreach (const ModelManagerInterface::CppData &cppData, cppDataHash) {
|
2011-09-16 13:55:10 +02:00
|
|
|
d->valueOwner->cppQmlTypes().load(cppData.exportedTypes);
|
2011-08-25 12:35:55 +02:00
|
|
|
}
|
|
|
|
|
2011-11-21 14:51:03 +01:00
|
|
|
// build an object with the context properties from C++
|
|
|
|
ObjectValue *cppContextProperties = d->valueOwner->newObject(/* prototype = */ 0);
|
2011-08-25 12:35:55 +02:00
|
|
|
foreach (const ModelManagerInterface::CppData &cppData, cppDataHash) {
|
2011-09-16 10:35:48 +02:00
|
|
|
QHashIterator<QString, QString> it(cppData.contextProperties);
|
2011-08-25 12:35:55 +02:00
|
|
|
while (it.hasNext()) {
|
|
|
|
it.next();
|
|
|
|
const Value *value = 0;
|
|
|
|
const QString cppTypeName = it.value();
|
|
|
|
if (!cppTypeName.isEmpty())
|
2011-09-16 13:55:10 +02:00
|
|
|
value = d->valueOwner->cppQmlTypes().objectByCppName(cppTypeName);
|
2011-08-25 12:35:55 +02:00
|
|
|
if (!value)
|
2011-10-10 12:53:28 +02:00
|
|
|
value = d->valueOwner->unknownValue();
|
2011-11-21 14:51:03 +01:00
|
|
|
cppContextProperties->setMember(it.key(), value);
|
2011-08-25 12:35:55 +02:00
|
|
|
}
|
2011-04-21 11:09:29 +02:00
|
|
|
}
|
2011-11-21 14:51:03 +01:00
|
|
|
d->valueOwner->cppQmlTypes().setCppContextProperties(cppContextProperties);
|
2011-04-21 11:09:29 +02:00
|
|
|
}
|
2011-05-06 13:31:30 +02:00
|
|
|
}
|
2011-04-21 11:09:29 +02:00
|
|
|
|
2011-07-13 15:04:27 +02:00
|
|
|
ContextPtr Link::operator()(QHash<QString, QList<DiagnosticMessage> > *messages)
|
2011-05-06 13:31:30 +02:00
|
|
|
{
|
|
|
|
d->allDiagnosticMessages = messages;
|
2013-10-16 15:08:27 +02:00
|
|
|
return Context::create(d->snapshot, d->valueOwner, d->linkImports(), d->vContext);
|
2011-04-21 11:09:29 +02:00
|
|
|
}
|
|
|
|
|
2011-07-13 15:04:27 +02:00
|
|
|
ContextPtr Link::operator()(const Document::Ptr &doc, QList<DiagnosticMessage> *messages)
|
2011-04-21 11:09:29 +02:00
|
|
|
{
|
2011-09-13 13:32:29 +02:00
|
|
|
d->document = doc;
|
2011-04-21 11:09:29 +02:00
|
|
|
d->diagnosticMessages = messages;
|
2013-10-16 15:08:27 +02:00
|
|
|
return Context::create(d->snapshot, d->valueOwner, d->linkImports(), d->vContext);
|
2010-02-02 15:55:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
Link::~Link()
|
|
|
|
{
|
2011-09-13 13:32:29 +02:00
|
|
|
delete d;
|
2010-02-02 15:55:17 +01:00
|
|
|
}
|
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
Context::ImportsPerDocument LinkPrivate::linkImports()
|
2010-02-02 15:55:17 +01:00
|
|
|
{
|
2011-07-05 12:06:41 +02:00
|
|
|
Context::ImportsPerDocument importsPerDocument;
|
|
|
|
|
2011-06-28 12:01:56 +02:00
|
|
|
// load builtin objects
|
2011-09-13 13:32:29 +02:00
|
|
|
if (builtins.pluginTypeInfoStatus() == LibraryInfo::DumpDone
|
|
|
|
|| builtins.pluginTypeInfoStatus() == LibraryInfo::TypeInfoFileDone) {
|
2011-09-16 13:55:10 +02:00
|
|
|
valueOwner->cppQmlTypes().load(builtins.metaObjects());
|
2011-06-28 12:01:56 +02:00
|
|
|
} else {
|
2011-09-16 13:55:10 +02:00
|
|
|
valueOwner->cppQmlTypes().load(CppQmlTypesLoader::defaultQtObjects);
|
2011-06-28 12:01:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// load library objects shipped with Creator
|
2011-09-16 13:55:10 +02:00
|
|
|
valueOwner->cppQmlTypes().load(CppQmlTypesLoader::defaultLibraryObjects);
|
2011-06-28 12:01:56 +02:00
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
if (document) {
|
|
|
|
// do it on document first, to make sure import errors are shown
|
2011-06-28 12:01:56 +02:00
|
|
|
Imports *imports = new Imports(valueOwner);
|
2011-09-13 13:32:29 +02:00
|
|
|
populateImportedTypes(imports, document);
|
|
|
|
importsPerDocument.insert(document.data(), QSharedPointer<Imports>(imports));
|
2011-04-21 11:09:29 +02:00
|
|
|
}
|
2010-02-04 09:44:43 +01:00
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
foreach (Document::Ptr doc, snapshot) {
|
|
|
|
if (doc == document)
|
2010-09-16 15:29:37 +02:00
|
|
|
continue;
|
|
|
|
|
2011-06-28 12:01:56 +02:00
|
|
|
Imports *imports = new Imports(valueOwner);
|
2011-05-27 10:43:06 +02:00
|
|
|
populateImportedTypes(imports, doc);
|
2011-07-05 12:06:41 +02:00
|
|
|
importsPerDocument.insert(doc.data(), QSharedPointer<Imports>(imports));
|
2010-02-02 15:55:17 +01:00
|
|
|
}
|
2011-07-05 12:06:41 +02:00
|
|
|
|
|
|
|
return importsPerDocument;
|
2010-02-02 15:55:17 +01:00
|
|
|
}
|
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
void LinkPrivate::populateImportedTypes(Imports *imports, Document::Ptr doc)
|
2010-01-28 14:53:53 +01:00
|
|
|
{
|
2011-10-12 08:36:02 +02:00
|
|
|
importableModuleApis.clear();
|
|
|
|
|
2010-12-03 10:13:15 +01:00
|
|
|
// implicit imports: the <default> package is always available
|
2011-05-27 10:43:06 +02:00
|
|
|
loadImplicitDefaultImports(imports);
|
2010-12-03 10:13:15 +01:00
|
|
|
|
2010-01-29 13:21:50 +01:00
|
|
|
// implicit imports:
|
|
|
|
// qml files in the same directory are available without explicit imports
|
2011-09-27 15:12:22 +02:00
|
|
|
if (doc->isQmlDocument())
|
|
|
|
loadImplicitDirectoryImports(imports, doc);
|
2011-02-25 16:16:37 +01:00
|
|
|
|
2010-09-16 15:29:37 +02:00
|
|
|
// explicit imports, whether directories, files or libraries
|
|
|
|
foreach (const ImportInfo &info, doc->bind()->imports()) {
|
2011-09-13 13:32:29 +02:00
|
|
|
Import import = importCache.value(ImportCacheKey(info));
|
2011-04-06 09:19:46 +02:00
|
|
|
|
2011-05-27 11:00:39 +02:00
|
|
|
// ensure usage of the right ImportInfo, the cached import
|
|
|
|
// can have a different 'as' clause...
|
|
|
|
import.info = info;
|
|
|
|
|
2011-05-12 15:29:00 +02:00
|
|
|
if (!import.object) {
|
2010-09-16 15:29:37 +02:00
|
|
|
switch (info.type()) {
|
2013-10-16 14:59:28 +02:00
|
|
|
case ImportType::File:
|
|
|
|
case ImportType::Directory:
|
|
|
|
case ImportType::QrcFile:
|
|
|
|
case ImportType::QrcDirectory:
|
2011-03-10 14:49:38 +01:00
|
|
|
import = importFileOrDirectory(doc, info);
|
2010-09-16 15:29:37 +02:00
|
|
|
break;
|
2013-10-16 14:59:28 +02:00
|
|
|
case ImportType::Library:
|
2010-09-16 15:29:37 +02:00
|
|
|
import = importNonFile(doc, info);
|
|
|
|
break;
|
2013-10-16 14:59:28 +02:00
|
|
|
case ImportType::UnknownFile:
|
2011-09-29 11:48:13 +02:00
|
|
|
imports->setImportFailed();
|
2011-09-27 15:12:22 +02:00
|
|
|
if (info.ast()) {
|
|
|
|
error(doc, info.ast()->fileNameToken,
|
|
|
|
Link::tr("file or directory not found"));
|
|
|
|
}
|
2011-08-10 09:00:40 +02:00
|
|
|
break;
|
2010-09-16 15:29:37 +02:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2011-05-12 15:29:00 +02:00
|
|
|
if (import.object)
|
2011-09-13 13:32:29 +02:00
|
|
|
importCache.insert(ImportCacheKey(info), import);
|
2010-02-02 15:55:17 +01:00
|
|
|
}
|
2011-05-16 12:21:20 +02:00
|
|
|
if (import.object)
|
2011-05-27 10:43:06 +02:00
|
|
|
imports->append(import);
|
2010-02-02 15:55:17 +01:00
|
|
|
}
|
|
|
|
}
|
2010-01-28 14:53:53 +01:00
|
|
|
|
2010-02-02 15:55:17 +01:00
|
|
|
/*
|
|
|
|
import "content"
|
|
|
|
import "content" as Xxx
|
|
|
|
import "content" 4.6
|
|
|
|
import "content" 4.6 as Xxx
|
2010-01-29 13:36:07 +01:00
|
|
|
|
2010-02-02 15:55:17 +01:00
|
|
|
import "http://www.ovi.com/" as Ovi
|
2011-05-27 10:43:06 +02:00
|
|
|
|
|
|
|
import "file.js" as Foo
|
2010-02-02 15:55:17 +01:00
|
|
|
*/
|
2011-09-13 13:32:29 +02:00
|
|
|
Import LinkPrivate::importFileOrDirectory(Document::Ptr doc, const ImportInfo &importInfo)
|
2010-02-02 15:55:17 +01:00
|
|
|
{
|
2011-05-27 10:43:06 +02:00
|
|
|
Import import;
|
2011-05-12 15:29:00 +02:00
|
|
|
import.info = importInfo;
|
|
|
|
import.object = 0;
|
2011-09-29 11:48:13 +02:00
|
|
|
import.valid = true;
|
2011-05-12 15:29:00 +02:00
|
|
|
|
2013-05-21 11:35:15 +02:00
|
|
|
QString path = importInfo.path();
|
2010-01-29 13:36:07 +01:00
|
|
|
|
2013-10-16 14:59:28 +02:00
|
|
|
if (importInfo.type() == ImportType::Directory
|
|
|
|
|| importInfo.type() == ImportType::ImplicitDirectory) {
|
2011-09-13 13:32:29 +02:00
|
|
|
import.object = new ObjectValue(valueOwner);
|
2011-03-10 14:49:38 +01:00
|
|
|
|
2011-05-12 15:29:00 +02:00
|
|
|
importLibrary(doc, path, &import);
|
2011-03-10 14:49:38 +01:00
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
const QList<Document::Ptr> &documentsInDirectory = snapshot.documentsInDirectory(path);
|
2010-04-01 11:27:49 +02:00
|
|
|
foreach (Document::Ptr importedDoc, documentsInDirectory) {
|
2010-05-20 14:00:19 +02:00
|
|
|
if (importedDoc->bind()->rootObjectValue()) {
|
|
|
|
const QString targetName = importedDoc->componentName();
|
2011-05-24 11:50:10 +02:00
|
|
|
import.object->setMember(targetName, importedDoc->bind()->rootObjectValue());
|
2010-05-20 14:00:19 +02:00
|
|
|
}
|
2010-03-16 16:34:33 +01:00
|
|
|
}
|
2013-10-16 14:59:28 +02:00
|
|
|
} else if (importInfo.type() == ImportType::File) {
|
2011-09-13 13:32:29 +02:00
|
|
|
Document::Ptr importedDoc = snapshot.document(path);
|
2010-09-24 09:49:35 +02:00
|
|
|
if (importedDoc)
|
2011-05-12 15:29:00 +02:00
|
|
|
import.object = importedDoc->bind()->rootObjectValue();
|
2013-10-16 14:59:28 +02:00
|
|
|
} else if (importInfo.type() == ImportType::QrcFile) {
|
2013-05-21 11:35:15 +02:00
|
|
|
QLocale locale;
|
|
|
|
QStringList filePaths = ModelManagerInterface::instance()
|
|
|
|
->filesAtQrcPath(path, &locale, 0, ModelManagerInterface::ActiveQrcResources);
|
2013-11-11 22:20:47 +02:00
|
|
|
if (filePaths.isEmpty())
|
2013-05-21 11:35:15 +02:00
|
|
|
filePaths = ModelManagerInterface::instance()->filesAtQrcPath(path);
|
|
|
|
if (!filePaths.isEmpty()) {
|
|
|
|
Document::Ptr importedDoc = snapshot.document(filePaths.at(0));
|
|
|
|
if (importedDoc)
|
|
|
|
import.object = importedDoc->bind()->rootObjectValue();
|
|
|
|
}
|
2013-10-16 14:59:28 +02:00
|
|
|
} else if (importInfo.type() == ImportType::QrcDirectory){
|
2013-05-21 11:35:15 +02:00
|
|
|
import.object = new ObjectValue(valueOwner);
|
|
|
|
|
|
|
|
importLibrary(doc, path, &import);
|
2010-02-02 15:55:17 +01:00
|
|
|
|
2013-05-21 11:35:15 +02:00
|
|
|
QMapIterator<QString,QStringList> iter(ModelManagerInterface::instance()
|
|
|
|
->filesInQrcPath(path));
|
|
|
|
while (iter.hasNext()) {
|
|
|
|
iter.next();
|
2014-01-22 18:38:45 +01:00
|
|
|
if (Document::isQmlLikeLanguage(ModelManagerInterface::guessLanguageOfFile(iter.key()))) {
|
2013-05-21 11:35:15 +02:00
|
|
|
Document::Ptr importedDoc = snapshot.document(iter.value().at(0));
|
|
|
|
if (importedDoc && importedDoc->bind()->rootObjectValue()) {
|
|
|
|
const QString targetName = QFileInfo(iter.key()).baseName();
|
|
|
|
import.object->setMember(targetName, importedDoc->bind()->rootObjectValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-09-16 15:29:37 +02:00
|
|
|
return import;
|
2010-03-25 14:47:28 +01:00
|
|
|
}
|
|
|
|
|
2011-10-12 08:36:02 +02:00
|
|
|
static ModuleApiInfo findBestModuleApi(const QList<ModuleApiInfo> &apis, const ComponentVersion &version)
|
|
|
|
{
|
|
|
|
ModuleApiInfo best;
|
|
|
|
foreach (const ModuleApiInfo &moduleApi, apis) {
|
|
|
|
if (moduleApi.version <= version
|
|
|
|
&& (!best.version.isValid() || best.version < moduleApi.version)) {
|
|
|
|
best = moduleApi;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return best;
|
|
|
|
}
|
|
|
|
|
2010-02-02 15:55:17 +01:00
|
|
|
/*
|
|
|
|
import Qt 4.6
|
|
|
|
import Qt 4.6 as Xxx
|
|
|
|
(import com.nokia.qt is the same as the ones above)
|
|
|
|
*/
|
2011-09-13 13:32:29 +02:00
|
|
|
Import LinkPrivate::importNonFile(Document::Ptr doc, const ImportInfo &importInfo)
|
2010-02-02 15:55:17 +01:00
|
|
|
{
|
2011-05-27 10:43:06 +02:00
|
|
|
Import import;
|
2011-05-12 15:29:00 +02:00
|
|
|
import.info = importInfo;
|
2011-09-13 13:32:29 +02:00
|
|
|
import.object = new ObjectValue(valueOwner);
|
2011-09-29 11:48:13 +02:00
|
|
|
import.valid = true;
|
2011-05-12 15:29:00 +02:00
|
|
|
|
2011-09-21 12:42:27 +02:00
|
|
|
const QString packageName = importInfo.name();
|
2010-09-16 15:29:37 +02:00
|
|
|
const ComponentVersion version = importInfo.version();
|
2010-03-01 13:01:05 +01:00
|
|
|
|
2010-06-09 14:27:30 +02:00
|
|
|
bool importFound = false;
|
2010-03-16 16:34:33 +01:00
|
|
|
|
2011-09-21 12:42:27 +02:00
|
|
|
const QString &packagePath = importInfo.path();
|
2011-05-27 14:51:30 +02:00
|
|
|
// check the filesystem with full version
|
2011-09-13 13:32:29 +02:00
|
|
|
foreach (const QString &importPath, importPaths) {
|
2012-11-27 20:20:02 +02:00
|
|
|
QString libraryPath = QString::fromLatin1("%1/%2.%3").arg(importPath, packagePath, version.toString());
|
2011-05-12 15:29:00 +02:00
|
|
|
if (importLibrary(doc, libraryPath, &import, importPath)) {
|
2011-03-10 14:49:38 +01:00
|
|
|
importFound = true;
|
|
|
|
break;
|
2010-08-25 14:15:57 +02:00
|
|
|
}
|
2010-06-09 14:27:30 +02:00
|
|
|
}
|
2011-05-27 14:51:30 +02:00
|
|
|
if (!importFound) {
|
|
|
|
// check the filesystem with major version
|
2011-09-13 13:32:29 +02:00
|
|
|
foreach (const QString &importPath, importPaths) {
|
2012-11-27 20:20:02 +02:00
|
|
|
QString libraryPath = QString::fromLatin1("%1/%2.%3").arg(importPath, packagePath,
|
2011-05-27 14:51:30 +02:00
|
|
|
QString::number(version.majorVersion()));
|
|
|
|
if (importLibrary(doc, libraryPath, &import, importPath)) {
|
|
|
|
importFound = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!importFound) {
|
|
|
|
// check the filesystem with no version
|
2011-09-13 13:32:29 +02:00
|
|
|
foreach (const QString &importPath, importPaths) {
|
2012-11-27 20:20:02 +02:00
|
|
|
QString libraryPath = QString::fromLatin1("%1/%2").arg(importPath, packagePath);
|
2011-05-27 14:51:30 +02:00
|
|
|
if (importLibrary(doc, libraryPath, &import, importPath)) {
|
|
|
|
importFound = true;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-06-09 14:27:30 +02:00
|
|
|
|
|
|
|
// if there are cpp-based types for this package, use them too
|
2011-09-16 13:55:10 +02:00
|
|
|
if (valueOwner->cppQmlTypes().hasModule(packageName)) {
|
2010-06-09 14:27:30 +02:00
|
|
|
importFound = true;
|
2011-10-10 10:32:33 +02:00
|
|
|
foreach (const CppComponentValue *object,
|
2011-09-16 13:55:10 +02:00
|
|
|
valueOwner->cppQmlTypes().createObjectsForImport(packageName, version)) {
|
2011-05-24 11:50:10 +02:00
|
|
|
import.object->setMember(object->className(), object);
|
2010-03-16 16:34:33 +01:00
|
|
|
}
|
2010-02-02 15:55:17 +01:00
|
|
|
}
|
2010-03-25 14:47:28 +01:00
|
|
|
|
2011-10-12 08:36:02 +02:00
|
|
|
// check module apis that previous imports may have enabled
|
|
|
|
ModuleApiInfo moduleApi = findBestModuleApi(importableModuleApis.value(packageName), version);
|
|
|
|
if (moduleApi.version.isValid()) {
|
|
|
|
importFound = true;
|
2011-10-21 08:58:54 +02:00
|
|
|
import.object->setPrototype(valueOwner->cppQmlTypes().objectByCppName(moduleApi.cppName));
|
2011-10-12 08:36:02 +02:00
|
|
|
}
|
|
|
|
|
2011-04-06 09:19:46 +02:00
|
|
|
if (!importFound && importInfo.ast()) {
|
2011-09-29 11:48:13 +02:00
|
|
|
import.valid = false;
|
2010-09-16 15:29:37 +02:00
|
|
|
error(doc, locationFromRange(importInfo.ast()->firstSourceLocation(),
|
|
|
|
importInfo.ast()->lastSourceLocation()),
|
2011-09-13 13:32:29 +02:00
|
|
|
Link::tr(
|
|
|
|
"QML module not found\n\n"
|
|
|
|
"Import paths:\n"
|
|
|
|
"%1\n\n"
|
|
|
|
"For qmake projects, use the QML_IMPORT_PATH variable to add import paths.\n"
|
|
|
|
"For qmlproject projects, use the importPaths property to add import paths.").arg(
|
|
|
|
importPaths.join(QLatin1String("\n"))));
|
2010-06-09 14:27:30 +02:00
|
|
|
}
|
2010-09-16 15:29:37 +02:00
|
|
|
|
|
|
|
return import;
|
2010-02-02 15:55:17 +01:00
|
|
|
}
|
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
bool LinkPrivate::importLibrary(Document::Ptr doc,
|
2011-03-10 14:49:38 +01:00
|
|
|
const QString &libraryPath,
|
2011-05-27 10:43:06 +02:00
|
|
|
Import *import,
|
2011-03-10 14:49:38 +01:00
|
|
|
const QString &importPath)
|
|
|
|
{
|
2011-05-12 15:29:00 +02:00
|
|
|
const ImportInfo &importInfo = import->info;
|
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
const LibraryInfo libraryInfo = snapshot.libraryInfo(libraryPath);
|
2011-03-10 14:49:38 +01:00
|
|
|
if (!libraryInfo.isValid())
|
|
|
|
return false;
|
|
|
|
|
2011-05-12 15:29:00 +02:00
|
|
|
import->libraryPath = libraryPath;
|
|
|
|
|
2011-03-10 14:49:38 +01:00
|
|
|
const ComponentVersion version = importInfo.version();
|
|
|
|
SourceLocation errorLoc;
|
2011-09-27 15:12:22 +02:00
|
|
|
if (const UiImport *ast = importInfo.ast())
|
2011-03-10 14:49:38 +01:00
|
|
|
errorLoc = locationFromRange(ast->firstSourceLocation(), ast->lastSourceLocation());
|
|
|
|
|
|
|
|
if (!libraryInfo.plugins().isEmpty()) {
|
2011-05-12 15:29:00 +02:00
|
|
|
if (libraryInfo.pluginTypeInfoStatus() == LibraryInfo::NoTypeInfo) {
|
2011-03-10 14:49:38 +01:00
|
|
|
ModelManagerInterface *modelManager = ModelManagerInterface::instance();
|
|
|
|
if (modelManager) {
|
2013-10-16 14:59:28 +02:00
|
|
|
if (importInfo.type() == ImportType::Library) {
|
2011-09-21 12:42:27 +02:00
|
|
|
if (version.isValid()) {
|
|
|
|
const QString uri = importInfo.name();
|
2011-03-16 15:34:50 +01:00
|
|
|
modelManager->loadPluginTypes(
|
|
|
|
libraryPath, importPath,
|
|
|
|
uri, version.toString());
|
|
|
|
}
|
2011-03-10 14:49:38 +01:00
|
|
|
} else {
|
|
|
|
modelManager->loadPluginTypes(
|
|
|
|
libraryPath, libraryPath,
|
|
|
|
QString(), version.toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (errorLoc.isValid()) {
|
|
|
|
warning(doc, errorLoc,
|
2011-09-13 13:32:29 +02:00
|
|
|
Link::tr("QML module contains C++ plugins, currently reading type information..."));
|
2011-09-29 11:48:13 +02:00
|
|
|
import->valid = false;
|
2011-03-10 14:49:38 +01:00
|
|
|
}
|
2011-05-12 15:29:00 +02:00
|
|
|
} else if (libraryInfo.pluginTypeInfoStatus() == LibraryInfo::DumpError
|
|
|
|
|| libraryInfo.pluginTypeInfoStatus() == LibraryInfo::TypeInfoFileError) {
|
2011-06-28 12:01:56 +02:00
|
|
|
// Only underline import if package isn't described in .qmltypes anyway
|
2011-09-21 12:42:27 +02:00
|
|
|
QString packageName = importInfo.name();
|
2011-09-16 13:55:10 +02:00
|
|
|
if (errorLoc.isValid() && (packageName.isEmpty() || !valueOwner->cppQmlTypes().hasModule(packageName))) {
|
2011-06-28 12:01:56 +02:00
|
|
|
error(doc, errorLoc, libraryInfo.pluginTypeInfoError());
|
2011-09-29 11:48:13 +02:00
|
|
|
import->valid = false;
|
2011-03-10 14:49:38 +01:00
|
|
|
}
|
2011-09-21 12:42:27 +02:00
|
|
|
} else {
|
|
|
|
const QString packageName = importInfo.name();
|
2011-09-16 13:55:10 +02:00
|
|
|
valueOwner->cppQmlTypes().load(libraryInfo.metaObjects(), packageName);
|
2011-10-10 10:32:33 +02:00
|
|
|
foreach (const CppComponentValue *object, valueOwner->cppQmlTypes().createObjectsForImport(packageName, version)) {
|
2011-09-16 13:55:10 +02:00
|
|
|
import->object->setMember(object->className(), object);
|
2011-03-10 14:49:38 +01:00
|
|
|
}
|
2011-10-12 08:36:02 +02:00
|
|
|
|
|
|
|
// all but no-uri module apis become available for import
|
|
|
|
QList<ModuleApiInfo> noUriModuleApis;
|
|
|
|
foreach (const ModuleApiInfo &moduleApi, libraryInfo.moduleApis()) {
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
if (moduleApi.uri.isEmpty())
|
2011-10-12 08:36:02 +02:00
|
|
|
noUriModuleApis += moduleApi;
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
else
|
2011-10-12 08:36:02 +02:00
|
|
|
importableModuleApis[moduleApi.uri] += moduleApi;
|
|
|
|
}
|
|
|
|
|
|
|
|
// if a module api has no uri, it shares the same name
|
|
|
|
ModuleApiInfo sameUriModuleApi = findBestModuleApi(noUriModuleApis, version);
|
|
|
|
if (sameUriModuleApi.version.isValid())
|
2011-10-21 08:58:54 +02:00
|
|
|
import->object->setPrototype(valueOwner->cppQmlTypes().objectByCppName(sameUriModuleApi.cppName));
|
2011-03-10 14:49:38 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-05-12 15:29:00 +02:00
|
|
|
loadQmldirComponents(import->object, version, libraryInfo, libraryPath);
|
2011-03-10 14:49:38 +01:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
void LinkPrivate::error(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message)
|
2010-03-29 11:32:11 +02:00
|
|
|
{
|
2013-10-16 14:59:28 +02:00
|
|
|
appendDiagnostic(doc, DiagnosticMessage(Severity::Error, loc, message));
|
2010-03-29 11:32:11 +02:00
|
|
|
}
|
2010-11-24 09:30:46 +01:00
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
void LinkPrivate::warning(const Document::Ptr &doc, const AST::SourceLocation &loc, const QString &message)
|
2011-04-21 11:09:29 +02:00
|
|
|
{
|
2013-10-16 14:59:28 +02:00
|
|
|
appendDiagnostic(doc, DiagnosticMessage(Severity::Warning, loc, message));
|
2011-04-21 11:09:29 +02:00
|
|
|
}
|
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
void LinkPrivate::appendDiagnostic(const Document::Ptr &doc, const DiagnosticMessage &message)
|
2010-11-24 09:30:46 +01:00
|
|
|
{
|
2011-09-13 13:32:29 +02:00
|
|
|
if (diagnosticMessages && doc->fileName() == document->fileName())
|
|
|
|
diagnosticMessages->append(message);
|
|
|
|
if (allDiagnosticMessages)
|
|
|
|
(*allDiagnosticMessages)[doc->fileName()].append(message);
|
2010-11-24 09:30:46 +01:00
|
|
|
}
|
2011-02-25 16:16:37 +01:00
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
void LinkPrivate::loadQmldirComponents(ObjectValue *import, ComponentVersion version,
|
2011-02-25 16:16:37 +01:00
|
|
|
const LibraryInfo &libraryInfo, const QString &libraryPath)
|
|
|
|
{
|
2011-03-10 14:49:38 +01:00
|
|
|
// if the version isn't valid, import the latest
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
if (!version.isValid())
|
2011-05-27 14:51:30 +02:00
|
|
|
version = ComponentVersion(ComponentVersion::MaxVersion, ComponentVersion::MaxVersion);
|
2011-03-10 14:49:38 +01:00
|
|
|
|
|
|
|
|
2011-02-25 16:16:37 +01:00
|
|
|
QSet<QString> importedTypes;
|
|
|
|
foreach (const QmlDirParser::Component &component, libraryInfo.components()) {
|
|
|
|
if (importedTypes.contains(component.typeName))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
ComponentVersion componentVersion(component.majorVersion,
|
|
|
|
component.minorVersion);
|
|
|
|
if (version < componentVersion)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
importedTypes.insert(component.typeName);
|
2011-09-13 13:32:29 +02:00
|
|
|
if (Document::Ptr importedDoc = snapshot.document(
|
2011-02-25 16:16:37 +01:00
|
|
|
libraryPath + QDir::separator() + component.fileName)) {
|
|
|
|
if (ObjectValue *v = importedDoc->bind()->rootObjectValue())
|
2011-05-24 11:50:10 +02:00
|
|
|
import->setMember(component.typeName, v);
|
2011-02-25 16:16:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
void LinkPrivate::loadImplicitDirectoryImports(Imports *imports, Document::Ptr doc)
|
2011-02-25 16:16:37 +01:00
|
|
|
{
|
2011-09-27 15:12:22 +02:00
|
|
|
ImportInfo implcitDirectoryImportInfo = ImportInfo::implicitDirectoryImport(doc->path());
|
2011-03-10 14:49:38 +01:00
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
Import directoryImport = importCache.value(ImportCacheKey(implcitDirectoryImportInfo));
|
2011-05-12 15:29:00 +02:00
|
|
|
if (!directoryImport.object) {
|
2011-03-10 14:49:38 +01:00
|
|
|
directoryImport = importFileOrDirectory(doc, implcitDirectoryImportInfo);
|
2011-05-12 15:29:00 +02:00
|
|
|
if (directoryImport.object)
|
2011-09-13 13:32:29 +02:00
|
|
|
importCache.insert(ImportCacheKey(implcitDirectoryImportInfo), directoryImport);
|
2011-02-25 16:16:37 +01:00
|
|
|
}
|
Remove braces for single lines of conditions
#!/usr/bin/env ruby
Dir.glob('**/*.cpp') { |file|
# skip ast (excluding paste, astpath, and canv'ast'imer)
next if file =~ /ast[^eip]|keywords\.|qualifiers|preprocessor|names.cpp/i
s = File.read(file)
next if s.include?('qlalr')
orig = s.dup
s.gsub!(/\n *if [^\n]*{\n[^\n]*\n\s+}(\s+else if [^\n]* {\n[^\n]*\n\s+})*(\s+else {\n[^\n]*\n\s+})?\n/m) { |m|
res = $&
if res =~ /^\s*(\/\/|[A-Z_]{3,})/ # C++ comment or macro (Q_UNUSED, SDEBUG), do not touch braces
res
else
res.gsub!('} else', 'else')
res.gsub!(/\n +} *\n/m, "\n")
res.gsub(/ *{$/, '')
end
}
s.gsub!(/ *$/, '')
File.open(file, 'wb').write(s) if s != orig
}
Change-Id: I3b30ee60df0986f66c02132c65fc38a3fbb6bbdc
Reviewed-by: hjk <qthjk@ovi.com>
2013-01-08 03:32:53 +02:00
|
|
|
if (directoryImport.object)
|
2011-05-27 10:43:06 +02:00
|
|
|
imports->append(directoryImport);
|
2011-02-25 16:16:37 +01:00
|
|
|
}
|
|
|
|
|
2011-09-13 13:32:29 +02:00
|
|
|
void LinkPrivate::loadImplicitDefaultImports(Imports *imports)
|
2011-02-25 16:16:37 +01:00
|
|
|
{
|
|
|
|
const QString defaultPackage = CppQmlTypes::defaultPackage;
|
2011-09-16 13:55:10 +02:00
|
|
|
if (valueOwner->cppQmlTypes().hasModule(defaultPackage)) {
|
2011-09-27 15:12:22 +02:00
|
|
|
const ComponentVersion maxVersion(ComponentVersion::MaxVersion, ComponentVersion::MaxVersion);
|
|
|
|
const ImportInfo info = ImportInfo::moduleImport(defaultPackage, maxVersion, QString());
|
2011-09-13 13:32:29 +02:00
|
|
|
Import import = importCache.value(ImportCacheKey(info));
|
2011-05-12 15:29:00 +02:00
|
|
|
if (!import.object) {
|
2011-09-29 11:48:13 +02:00
|
|
|
import.valid = true;
|
2011-05-12 15:29:00 +02:00
|
|
|
import.info = info;
|
2011-09-13 13:32:29 +02:00
|
|
|
import.object = new ObjectValue(valueOwner);
|
2011-10-10 10:32:33 +02:00
|
|
|
foreach (const CppComponentValue *object,
|
2011-09-16 13:55:10 +02:00
|
|
|
valueOwner->cppQmlTypes().createObjectsForImport(
|
2011-09-27 15:12:22 +02:00
|
|
|
defaultPackage, maxVersion)) {
|
2011-05-24 11:50:10 +02:00
|
|
|
import.object->setMember(object->className(), object);
|
2011-02-25 16:16:37 +01:00
|
|
|
}
|
2011-09-13 13:32:29 +02:00
|
|
|
importCache.insert(ImportCacheKey(info), import);
|
2011-02-25 16:16:37 +01:00
|
|
|
}
|
2011-05-27 10:43:06 +02:00
|
|
|
imports->append(import);
|
2011-02-25 16:16:37 +01:00
|
|
|
}
|
|
|
|
}
|