Commit 9f2d54c9 authored by Fawzi Mohamed's avatar Fawzi Mohamed

qmljs: fixing used imports

Task-number: QTCREATORBUG-12782
Change-Id: I44808f10504991fb9fc621acedd43035698c6afb
Reviewed-by: default avatarThomas Hartmann <Thomas.Hartmann@digia.com>
parent c2be9c01
......@@ -2312,8 +2312,10 @@ const Value *TypeScope::lookupMember(const QString &name, const Context *context
continue;
}
if (const Value *v = import->lookupMember(name, context, foundInObject))
if (const Value *v = import->lookupMember(name, context, foundInObject)) {
i.used = true;
return v;
}
}
if (foundInObject)
*foundInObject = 0;
......@@ -2491,7 +2493,7 @@ bool Imports::importFailed() const
return m_importFailed;
}
QList<Import> Imports::all() const
const QList<Import> &Imports::all() const
{
return m_imports;
}
......
......@@ -1038,7 +1038,7 @@ public:
QString nameForImportedObject(const ObjectValue *value, const Context *context) const;
bool importFailed() const;
QList<Import> all() const;
const QList<Import> &all() const;
const TypeScope *typeScope() const;
const JSImportScope *jsImportScope() const;
......
......@@ -868,7 +868,6 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
setupImports(doc, differenceHandler);
setupPossibleImports(snapshot, vContext);
setupUsedImports();
if (m_rewriterView->model()->imports().isEmpty()) {
const QmlJS::DiagnosticMessage diagnosticMessage(QmlJS::Severity::Error, AST::SourceLocation(0, 0, 0, 0), QCoreApplication::translate("QmlDesigner::TextToModelMerger", "No import statements found"));
......@@ -944,6 +943,7 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
}
}
}
setupUsedImports();
UiObjectMember *astRootNode = 0;
if (UiProgram *program = doc->qmlProgram())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment