diff --git a/src/libs/qmljs/qmljsinterpreter.cpp b/src/libs/qmljs/qmljsinterpreter.cpp index feb6fa65057..bb36c1b25c1 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 936edced6e6..cf8d22a3846 100644 --- a/src/libs/qmljs/qmljsinterpreter.h +++ b/src/libs/qmljs/qmljsinterpreter.h @@ -40,6 +40,7 @@ #include #include #include +#include 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;