forked from qt-creator/qt-creator
qmljs: simple tracking of used modules
Change-Id: Idc977a8c5a6c6caa3749599cb6f4a236046f53d7 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
@@ -2181,7 +2181,12 @@ UiImport *ImportInfo::ast() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
Import::Import()
|
Import::Import()
|
||||||
: object(0)
|
: object(0), valid(false), used(false)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Import::Import(const Import &other)
|
||||||
|
: object(other.object), info(other.info), libraryPath(other.libraryPath),
|
||||||
|
valid(other.valid), used(false)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
TypeScope::TypeScope(const Imports *imports, ValueOwner *valueOwner)
|
TypeScope::TypeScope(const Imports *imports, ValueOwner *valueOwner)
|
||||||
@@ -2208,6 +2213,7 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context
|
|||||||
if (info.as() == name) {
|
if (info.as() == name) {
|
||||||
if (foundInObject)
|
if (foundInObject)
|
||||||
*foundInObject = this;
|
*foundInObject = this;
|
||||||
|
i.used = true;
|
||||||
return import;
|
return import;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
@@ -2264,6 +2270,7 @@ const Value *JSImportScope::lookupMember(const QString &name, const Context *,
|
|||||||
if (info.as() == name) {
|
if (info.as() == name) {
|
||||||
if (foundInObject)
|
if (foundInObject)
|
||||||
*foundInObject = this;
|
*foundInObject = this;
|
||||||
|
i.used = true;
|
||||||
return import;
|
return import;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
#include <QMutex>
|
#include <QMutex>
|
||||||
|
#include <QSharedPointer>
|
||||||
|
|
||||||
namespace QmlJS {
|
namespace QmlJS {
|
||||||
|
|
||||||
@@ -906,6 +907,7 @@ private:
|
|||||||
class QMLJS_EXPORT Import {
|
class QMLJS_EXPORT Import {
|
||||||
public:
|
public:
|
||||||
Import();
|
Import();
|
||||||
|
Import(const Import &other);
|
||||||
|
|
||||||
// const!
|
// const!
|
||||||
ObjectValue *object;
|
ObjectValue *object;
|
||||||
@@ -914,6 +916,7 @@ public:
|
|||||||
QString libraryPath;
|
QString libraryPath;
|
||||||
// whether the import succeeded
|
// whether the import succeeded
|
||||||
bool valid;
|
bool valid;
|
||||||
|
mutable bool used;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Imports;
|
class Imports;
|
||||||
|
|||||||
Reference in New Issue
Block a user