QmlJS: Use "import" commands from qmldir files

qmldir files can have lines like "import QtQml". These were already
parsed, but not stored in LibraryInfo. Store them.

When imports are resolved in Link and a library has such an import, also
load the module it refers to, with the same version and "as" scope.

Add a test to verify the behavior works.

Change-Id: I80b260bfaa36a9e5de0849fa5632b3361077ef01
Task-number: QTCREATORBUG-23986
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
Christian Kamm
2020-05-10 15:57:22 +02:00
parent 338fa26bc3
commit f64146741d
15 changed files with 749 additions and 12 deletions

View File

@@ -157,7 +157,8 @@ private:
typedef QList<LanguageUtils::FakeMetaObject::ConstPtr> FakeMetaObjectList;
FakeMetaObjectList _metaObjects;
QList<ModuleApiInfo> _moduleApis;
QStringList _dependencies;
QStringList _dependencies; // from qmltypes "dependencies: [...]"
QStringList _imports; // from qmldir "import" commands
QByteArray _fingerprint;
PluginTypeInfoStatus _dumpStatus = NoTypeInfo;
@@ -203,6 +204,12 @@ public:
void setDependencies(const QStringList &deps)
{ _dependencies = deps; }
QStringList imports() const
{ return _imports; }
void setImports(const QStringList &imports)
{ _imports = imports; }
bool isValid() const
{ return _status == Found; }