Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
Represents a consistent set of types organized in modules, it is the top level of the DOM. More...
#include <qqmldomtop_p.h>
Classes | |
struct | LoadResult |
Public Types | |
enum class | Option { Default = 0x0 , KeepValid = 0x1 , Exported = 0x2 , NoReload = 0x4 , WeakLoad = 0x8 , SingleThreaded = 0x10 , NoDependencies = 0x20 } |
Public Types inherited from QQmlJS::Dom::DomTop | |
using | Callback = DomItem::Callback |
Public Types inherited from QQmlJS::Dom::DomBase | |
using | FilterT = function_ref<bool(const DomItem &, const PathEls::PathComponent &, const DomItem &)> |
Static Public Member Functions | |
static ErrorGroups | myErrors () |
static std::shared_ptr< DomEnvironment > | create (const QStringList &loadPaths, Options options=Option::SingleThreaded, DomCreationOptions creationOptions=DomCreationOption::None, const DomItem &universe=DomItem::empty) |
static QList< Import > | defaultImplicitImports () |
Static Public Member Functions inherited from QQmlJS::Dom::OwningItem | |
static int | nextRevision () |
Static Public Attributes | |
static constexpr DomType | kindValue = DomType::DomEnvironment |
Protected Member Functions | |
std::shared_ptr< OwningItem > | doCopy (const DomItem &self) const override |
Friends | |
class | RefCacheEntry |
Represents a consistent set of types organized in modules, it is the top level of the DOM.
The DomEnvironment keeps a pointer m_lastValidBase to the last used valid DomEnvironment in the commitToBase() method. This allows the qqmldomastcreator to commit lazily loaded dependencies to the valid environment used by qmlls.
Definition at line 716 of file qqmldomtop_p.h.
|
strong |
Enumerator | |
---|---|
Default | |
KeepValid | |
Exported | |
NoReload | |
WeakLoad | |
SingleThreaded | |
NoDependencies |
Definition at line 725 of file qqmldomtop_p.h.
|
explicit |
|
explicit |
|
delete |
void QQmlJS::Dom::DomEnvironment::addAllLoadedCallback | ( | const DomItem & | self, |
DomTop::Callback | c ) |
Definition at line 2153 of file qqmldomtop.cpp.
References QList< T >::append(), and QQmlJS::Dom::OwningItem::mutex().
Depending on the creation options, this function adds LoadInfo of the provided path
Definition at line 1740 of file qqmldomtop.cpp.
References Q_ASSERT.
|
inline |
Definition at line 898 of file qqmldomtop_p.h.
References el, QQmlJS::Dom::DomItem::path(), Q_ASSERT, and qScopeGuard().
void QQmlJS::Dom::DomEnvironment::addGlobalScope | ( | const std::shared_ptr< GlobalScope > & | file, |
AddOption | option = AddOption::KeepExisting ) |
Definition at line 1932 of file qqmldomtop.cpp.
References options().
void QQmlJS::Dom::DomEnvironment::addJsFile | ( | const std::shared_ptr< JsFile > & | file, |
AddOption | option = AddOption::KeepExisting ) |
Definition at line 1927 of file qqmldomtop.cpp.
References file, and options().
void QQmlJS::Dom::DomEnvironment::addQmlDirectory | ( | const std::shared_ptr< QmlDirectory > & | file, |
AddOption | option = AddOption::KeepExisting ) |
Definition at line 1912 of file qqmldomtop.cpp.
References file, and options().
void QQmlJS::Dom::DomEnvironment::addQmldirFile | ( | const std::shared_ptr< QmldirFile > & | file, |
AddOption | option = AddOption::KeepExisting ) |
Definition at line 1917 of file qqmldomtop.cpp.
References file, and options().
void QQmlJS::Dom::DomEnvironment::addQmlFile | ( | const std::shared_ptr< QmlFile > & | file, |
AddOption | option = AddOption::KeepExisting ) |
Definition at line 1902 of file qqmldomtop.cpp.
References domCreationOptions(), file, options(), testFlag(), and QQmlJS::Dom::WithSemanticAnalysis.
void QQmlJS::Dom::DomEnvironment::addQmltypesFile | ( | const std::shared_ptr< QmltypesFile > & | file, |
AddOption | option = AddOption::KeepExisting ) |
Definition at line 1922 of file qqmldomtop.cpp.
References file, and options().
Definition at line 2100 of file qqmldomtop.cpp.
References QQmlJS::Dom::OwningItem::mutex().
std::shared_ptr< DomEnvironment > QQmlJS::Dom::DomEnvironment::base | ( | ) | const |
Definition at line 2111 of file qqmldomtop.cpp.
Referenced by commitToBase().
|
overridevirtual |
Implements QQmlJS::Dom::DomTop.
Definition at line 879 of file qqmldomtop.cpp.
|
virtual |
Implements QQmlJS::Dom::DomTop.
QQml::Dom::DomTop::loadFile.
filePath | the file path to load |
logicalPath | the path from the |
callback | a callback called with an canonical path, the old value, and the current value. |
loadOptions | are if force is true the file is always read |
Implements QQmlJS::Dom::OwningItem.
Definition at line 153 of file qqmldomtop.cpp.
void QQmlJS::Dom::DomEnvironment::clearReferenceCache | ( | ) |
Definition at line 2169 of file qqmldomtop.cpp.
bool QQmlJS::Dom::DomEnvironment::commitToBase | ( | const DomItem & | self, |
const std::shared_ptr< DomEnvironment > & | validEnv = nullptr ) |
Definition at line 1937 of file qqmldomtop.cpp.
References base(), QSet< T >::cbegin(), QSet< T >::cend(), QString::insert(), it, and QQmlJS::Dom::OwningItem::mutex().
|
static |
Definition at line 1882 of file qqmldomtop.cpp.
References domCreationOptions(), loadPaths(), options(), and universe().
Definition at line 2142 of file qqmldomtop.cpp.
References QQmlJS::Dom::QmlUri::fromUriString(), QQmlJS::Dom::Import::fromUriString(), QQmlJS::Dom::Import, and QQmlJS::Dom::Version.
|
overrideprotectedvirtual |
Implements QQmlJS::Dom::OwningItem.
Definition at line 1103 of file qqmldomtop.cpp.
References m_options.
|
inline |
Definition at line 933 of file qqmldomtop_p.h.
Referenced by addQmlFile(), and create().
std::shared_ptr< ExternalItemInfo< GlobalScope > > QQmlJS::Dom::DomEnvironment::ensureGlobalScopeWithName | ( | const DomItem & | self, |
const QString & | name, | ||
EnvLookup | lookup = EnvLookup::Normal ) |
Definition at line 1688 of file qqmldomtop.cpp.
References QQmlJS::Dom::DomItem::copy(), QQmlJS::Dom::DomItem::makeCopy(), mutex, and Q_ASSERT_X.
|
finaloverridevirtual |
Reimplemented from QQmlJS::Dom::DomBase.
Definition at line 1093 of file qqmldomtop.cpp.
bool QQmlJS::Dom::DomEnvironment::finishLoadingDependencies | ( | int | waitMSec = 30000 | ) |
Definition at line 2072 of file qqmldomtop.cpp.
References QSet< T >::cbegin(), QDateTime::currentDateTimeUtc(), QQmlJS::Dom::LoadInfo::Done, i, it, loadInfos(), loadPendingDependencies(), and QThread::msleep().
QString QQmlJS::Dom::DomEnvironment::globalScopeName | ( | ) | const |
Definition at line 2137 of file qqmldomtop.cpp.
QSet< QString > QQmlJS::Dom::DomEnvironment::globalScopeNames | ( | const DomItem & | self, |
EnvLookup | lookup = EnvLookup::Normal ) const |
Definition at line 1711 of file qqmldomtop.cpp.
References it, QMap< Key, T >::keyBegin(), QMap< Key, T >::keyEnd(), map, and mutex.
std::shared_ptr< ExternalItemInfo< GlobalScope > > QQmlJS::Dom::DomEnvironment::globalScopeWithName | ( | const DomItem & | self, |
const QString & | name, | ||
EnvLookup | lookup = EnvLookup::Normal ) const |
Definition at line 1681 of file qqmldomtop.cpp.
Definition at line 2148 of file qqmldomtop.cpp.
|
inline |
Definition at line 858 of file qqmldomtop_p.h.
References QQmlJS::Dom::DomItem::copy(), QDateTime::currentDateTimeUtc(), QMap< Key, T >::end(), QMap< Key, T >::find(), QMap< Key, T >::insert(), it, map, and mutex.
|
overridevirtual |
Implements QQmlJS::Dom::DomBase.
Definition at line 884 of file qqmldomtop.cpp.
References base, i, QMap< Key, T >::key(), map, QString::number(), and QQmlJS::Dom::DomItem::owner().
QSet< QString > QQmlJS::Dom::DomEnvironment::jsFilePaths | ( | const DomItem & | self, |
EnvLookup | lookup = EnvLookup::Normal ) const |
Definition at line 1654 of file qqmldomtop.cpp.
std::shared_ptr< ExternalItemInfo< JsFile > > QQmlJS::Dom::DomEnvironment::jsFileWithPath | ( | const DomItem & | self, |
const QString & | path, | ||
EnvLookup | options = EnvLookup::Normal ) const |
Definition at line 1649 of file qqmldomtop.cpp.
|
overridevirtual |
Implements QQmlJS::Dom::DomBase.
Definition at line 874 of file qqmldomtop.cpp.
void QQmlJS::Dom::DomEnvironment::loadBuiltins | ( | const Callback & | callback = nullptr, |
const ErrorHandler & | h = nullptr ) |
Definition at line 1368 of file qqmldomtop.cpp.
void QQmlJS::Dom::DomEnvironment::loadFile | ( | const FileToLoad & | file, |
const Callback & | callback, | ||
std::optional< DomType > | fileType = std::optional<DomType>(), | ||
const ErrorHandler & | h = nullptr ) |
Definition at line 1115 of file qqmldomtop.cpp.
References file, and fileType().
Referenced by QmlLsp::QQmlCodeModel::newDocForOpenFile(), and CompletionRequest::patchInvalidFileForParser().
Definition at line 1777 of file qqmldomtop.cpp.
References mutex.
Referenced by loadPendingDependencies().
Definition at line 1789 of file qqmldomtop.cpp.
Definition at line 1783 of file qqmldomtop.cpp.
References mutex.
Referenced by finishLoadingDependencies().
void QQmlJS::Dom::DomEnvironment::loadModuleDependency | ( | const QString & | uri, |
Version | v, | ||
const Callback & | callback = nullptr, | ||
const ErrorHandler & | = nullptr ) |
QStringList QQmlJS::Dom::DomEnvironment::loadPaths | ( | ) | const |
Definition at line 2125 of file qqmldomtop.cpp.
References QQmlJS::Dom::OwningItem::mutex().
Referenced by create().
void QQmlJS::Dom::DomEnvironment::loadPendingDependencies | ( | ) |
Definition at line 2028 of file qqmldomtop.cpp.
References cb, QList< T >::clear(), loadInfo(), QQmlJS::Dom::OwningItem::mutex(), myErrors(), Q_ASSERT, and qScopeGuard().
Referenced by finishLoadingDependencies().
std::shared_ptr< DomEnvironment > QQmlJS::Dom::DomEnvironment::makeCopy | ( | const DomItem & | self | ) | const |
Definition at line 1098 of file qqmldomtop.cpp.
QSet< int > QQmlJS::Dom::DomEnvironment::moduleIndexMajorVersions | ( | const DomItem & | self, |
const QString & | uri, | ||
EnvLookup | lookup = EnvLookup::Normal ) const |
Definition at line 1440 of file qqmldomtop.cpp.
References it, QMap< Key, T >::keyBegin(), QMap< Key, T >::keyEnd(), map, mutex, and QMap< Key, T >::value().
QSet< QString > QQmlJS::Dom::DomEnvironment::moduleIndexUris | ( | const DomItem & | self, |
EnvLookup | lookup = EnvLookup::Normal ) const |
Definition at line 1432 of file qqmldomtop.cpp.
std::shared_ptr< ModuleIndex > QQmlJS::Dom::DomEnvironment::moduleIndexWithUri | ( | const DomItem & | self, |
const QString & | uri, | ||
int | majorVersion, | ||
EnvLookup | lookup, | ||
Changeable | changeable, | ||
const ErrorHandler & | errorHandler = nullptr ) |
Definition at line 1509 of file qqmldomtop.cpp.
References arg, QSet< T >::cend(), QSet< T >::constFind(), QSet< T >::insert(), it, m_options, mutex, Q_ASSERT, and tr.
std::shared_ptr< ModuleIndex > QQmlJS::Dom::DomEnvironment::moduleIndexWithUri | ( | const DomItem & | self, |
const QString & | uri, | ||
int | majorVersion, | ||
EnvLookup | lookup = EnvLookup::Normal ) const |
Definition at line 1568 of file qqmldomtop.cpp.
|
static |
Definition at line 868 of file qqmldomtop.cpp.
References NewErrorGroup.
Referenced by QQmlJS::Dom::LoadInfo::advanceLoad(), QQmlJS::Dom::LoadInfo::doCopy(), QQmlJS::Dom::LoadInfo::finishedLoadingDep(), and loadPendingDependencies().
DomEnvironment::Options QQmlJS::Dom::DomEnvironment::options | ( | ) | const |
Definition at line 2106 of file qqmldomtop.cpp.
Referenced by addGlobalScope(), addJsFile(), addQmlDirectory(), addQmldirFile(), addQmlFile(), addQmltypesFile(), create(), QQmlJS::Dom::QQmlDomAstCreator::visit(), and QQmlJS::Dom::QQmlDomAstCreator::visit().
void QQmlJS::Dom::DomEnvironment::populateFromQmlFile | ( | MutableDomItem && | qmlFile | ) |
Definition at line 2174 of file qqmldomtop.cpp.
References QQmlJS::AST::Node::accept(), QQmlJS::Dom::CommentCollector::collectComments(), Q_UNUSED, qCWarning, QQmlJSLogger::setFileName(), QQmlJS::Dom::WithScriptExpressions, and QQmlJS::Dom::WithSemanticAnalysis.
QSet< QString > QQmlJS::Dom::DomEnvironment::qmlDirectoryPaths | ( | const DomItem & | self, |
EnvLookup | options = EnvLookup::Normal ) const |
Definition at line 1581 of file qqmldomtop.cpp.
std::shared_ptr< ExternalItemInfo< QmlDirectory > > QQmlJS::Dom::DomEnvironment::qmlDirectoryWithPath | ( | const DomItem & | self, |
const QString & | path, | ||
EnvLookup | options = EnvLookup::Normal ) const |
Definition at line 1576 of file qqmldomtop.cpp.
QSet< QString > QQmlJS::Dom::DomEnvironment::qmldirFilePaths | ( | const DomItem & | self, |
EnvLookup | options = EnvLookup::Normal ) const |
Definition at line 1597 of file qqmldomtop.cpp.
QStringList QQmlJS::Dom::DomEnvironment::qmldirFiles | ( | ) | const |
Definition at line 2131 of file qqmldomtop.cpp.
References QQmlJS::Dom::OwningItem::mutex().
std::shared_ptr< ExternalItemInfo< QmldirFile > > QQmlJS::Dom::DomEnvironment::qmldirFileWithPath | ( | const DomItem & | self, |
const QString & | path, | ||
EnvLookup | options = EnvLookup::Normal ) const |
Definition at line 1592 of file qqmldomtop.cpp.
QSet< QString > QQmlJS::Dom::DomEnvironment::qmlDirPaths | ( | const DomItem & | self, |
EnvLookup | options = EnvLookup::Normal ) const |
Definition at line 1615 of file qqmldomtop.cpp.
std::shared_ptr< ExternalItemInfoBase > QQmlJS::Dom::DomEnvironment::qmlDirWithPath | ( | const DomItem & | self, |
const QString & | path, | ||
EnvLookup | options = EnvLookup::Normal ) const |
Definition at line 1607 of file qqmldomtop.cpp.
QSet< QString > QQmlJS::Dom::DomEnvironment::qmlFilePaths | ( | const DomItem & | self, |
EnvLookup | lookup = EnvLookup::Normal ) const |
Definition at line 1638 of file qqmldomtop.cpp.
std::shared_ptr< ExternalItemInfo< QmlFile > > QQmlJS::Dom::DomEnvironment::qmlFileWithPath | ( | const DomItem & | self, |
const QString & | path, | ||
EnvLookup | options = EnvLookup::Normal ) const |
Definition at line 1633 of file qqmldomtop.cpp.
QSet< QString > QQmlJS::Dom::DomEnvironment::qmltypesFilePaths | ( | const DomItem & | self, |
EnvLookup | lookup = EnvLookup::Normal ) const |
Definition at line 1670 of file qqmldomtop.cpp.
std::shared_ptr< ExternalItemInfo< QmltypesFile > > QQmlJS::Dom::DomEnvironment::qmltypesFileWithPath | ( | const DomItem & | self, |
const QString & | path, | ||
EnvLookup | options = EnvLookup::Normal ) const |
Definition at line 1665 of file qqmldomtop.cpp.
Definition at line 1384 of file qqmldomtop.cpp.
References it, mutex, and QSet< T >::removeIf().
void QQmlJS::Dom::DomEnvironment::setLoadPaths | ( | const QStringList & | v | ) |
Definition at line 2116 of file qqmldomtop.cpp.
References QQmlJS::Dom::OwningItem::mutex().
shared_ptr< DomUniverse > QQmlJS::Dom::DomEnvironment::universe | ( | ) | const |
Definition at line 1398 of file qqmldomtop.cpp.
Referenced by create().
|
friend |
Definition at line 936 of file qqmldomtop_p.h.
|
staticconstexpr |
Definition at line 738 of file qqmldomtop_p.h.