diff options
author | Fawzi Mohamed <fawzi.mohamed@digia.com> | 2013-10-17 17:16:29 +0200 |
---|---|---|
committer | Fawzi Mohamed <fawzi.mohamed@digia.com> | 2013-10-23 00:35:52 +0200 |
commit | eed81ea87143e7e06506473dbf71dbf19786c8c3 (patch) | |
tree | 7e668423d79ac4b4dd9747afc36300aab66a7ffd /src | |
parent | 0a4310d3148861062b9679e1415197b3a883164f (diff) | |
download | qt-creator-eed81ea87143e7e06506473dbf71dbf19786c8c3.tar.gz |
qmljs: simple tracking of used modules
Change-Id: Idc977a8c5a6c6caa3749599cb6f4a236046f53d7
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/qmljs/qmljsinterpreter.cpp | 9 | ||||
-rw-r--r-- | src/libs/qmljs/qmljsinterpreter.h | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index feb6fa6505..bb36c1b25c 100644 --- a/src/libs/qmljs/qmljsinterpreter.cpp +++ b/src/libs/qmljs/qmljsinterpreter.cpp @@ -2181,9 +2181,14 @@ UiImport *ImportInfo::ast() const } 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) : ObjectValue(valueOwner) , _imports(imports) @@ -2208,6 +2213,7 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context if (info.as() == name) { if (foundInObject) *foundInObject = this; + i.used = true; return import; } continue; @@ -2264,6 +2270,7 @@ const Value *JSImportScope::lookupMember(const QString &name, const Context *, if (info.as() == name) { if (foundInObject) *foundInObject = this; + i.used = true; return import; } } diff --git a/src/libs/qmljs/qmljsinterpreter.h b/src/libs/qmljs/qmljsinterpreter.h index 936edced6e..cf8d22a384 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -40,6 +40,7 @@ #include <QHash> #include <QSet> #include <QMutex> +#include <QSharedPointer> namespace QmlJS { @@ -906,6 +907,7 @@ private: class QMLJS_EXPORT Import { public: Import(); + Import(const Import &other); // const! ObjectValue *object; @@ -914,6 +916,7 @@ public: QString libraryPath; // whether the import succeeded bool valid; + mutable bool used; }; class Imports; |