diff options
Diffstat (limited to 'src/qmldom/qqmldomelements.cpp')
-rw-r--r-- | src/qmldom/qqmldomelements.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/qmldom/qqmldomelements.cpp b/src/qmldom/qqmldomelements.cpp index 914c72e34f..0b5d36b4a0 100644 --- a/src/qmldom/qqmldomelements.cpp +++ b/src/qmldom/qqmldomelements.cpp @@ -1197,9 +1197,10 @@ void EnumDecl::writeOut(DomItem &self, OutWriter &ow) const QList<Path> ImportScope::allSources(DomItem &self) const { - DomItem env = self.environment(); + DomItem top = self.top(); + DomItem env = top.environment(); Path selfPath = self.canonicalPath().field(Fields::allSources); - RefCacheEntry cached = RefCacheEntry::forPath(env, selfPath); + RefCacheEntry cached = (env ? RefCacheEntry::forPath(env, selfPath) : RefCacheEntry()); if (cached.cached == RefCacheEntry::Cached::All) return cached.canonicalPaths; QList<Path> res; @@ -1211,7 +1212,7 @@ QList<Path> ImportScope::allSources(DomItem &self) const continue; knownPaths.insert(pNow); res.append(pNow); - DomItem sourceBase = env.path(pNow); + DomItem sourceBase = top.path(pNow); for (DomItem autoExp : sourceBase.field(Fields::autoExports).values()) { if (const ModuleAutoExport *autoExpPtr = autoExp.as<ModuleAutoExport>()) { Path newSource; @@ -1241,7 +1242,8 @@ QList<Path> ImportScope::allSources(DomItem &self) const } } } - RefCacheEntry::addForPath(env, selfPath, RefCacheEntry { RefCacheEntry::Cached::All, res }); + if (env) + RefCacheEntry::addForPath(env, selfPath, RefCacheEntry { RefCacheEntry::Cached::All, res }); return res; } |