forked from qt-creator/qt-creator
QmlJS: Import 'as' has precedence over types imported without as.
Change-Id: Iece286c9d1725d2bb1e3eff57cd73af97dd8c748 Reviewed-on: http://codereview.qt.nokia.com/181 Reviewed-by: Fawzi Mohamed <fawzi.mohamed@nokia.com>
This commit is contained in:
committed by
Fawzi Mohamed
parent
f0a4e7e225
commit
88dc2d71fb
@@ -3104,7 +3104,20 @@ Imports::Imports(Engine *engine)
|
|||||||
|
|
||||||
void Imports::append(const Import &import)
|
void Imports::append(const Import &import)
|
||||||
{
|
{
|
||||||
_imports.append(import);
|
// when doing lookup, imports with 'as' clause are looked at first
|
||||||
|
if (!import.info.id().isEmpty()) {
|
||||||
|
_imports.append(import);
|
||||||
|
} else {
|
||||||
|
// find first as-import and prepend
|
||||||
|
for (int i = 0; i < _imports.size(); ++i) {
|
||||||
|
if (!_imports.at(i).info.id().isEmpty()) {
|
||||||
|
_imports.insert(i, import);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// not found, append
|
||||||
|
_imports.append(import);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ImportInfo Imports::info(const QString &name, const Context *context) const
|
ImportInfo Imports::info(const QString &name, const Context *context) const
|
||||||
|
Reference in New Issue
Block a user