Currently, a DomEnvironment could load QML files with different
DomCreationOptions. This makes things more complicated when loading
dependencies, for example the implicit directory import might load a
qmldir file that imports another module that contains a certain QML
file, and then one has to remember which file triggered all of this
dependency loading and what DomCreationOptions it had.
In addition, there is currently no use case for something that
complicated.
Instead of that, move the DomCreationOptions to the DomEnvironment
itself. When a DomEnvironment is used to load a file and its
dependencies, it will use the DomCreationOptions set on this
DomEnvironment.
This ensures that all dependencies are loaded with the correct
DomCreationOptions, and avoids weird bugs in qmlls features due to
wrong DomCreationOptions used for dependencies.
Remove the DomCreationOptions from the FileToLoad struct, adapt the
DomEnvironment constructor and static factory method to expect a
DomCreationOptions parameter, and change all DomUniverse::load()
methods to have an extra DomCreationOptions parameter.
This commit will break the formatting tests so QSKIP them, at least
until the lazy-loading is done. The reason for the breakage is that the
Dom eagerly loads all QML files from imports, and that takes too much
time or crashes because it loads them now with the correct
DomCreationOptions instead of DomCreationOption::None.
For example, the formatting tests will implicitly load
nestedFunctions.qml via the implicit directory import with the
DomCreationOption::WithScriptExpressions and that will crash because
of the nested functions, see also QTBUG-122707.
Therefore QSKIP the formatting tests.
Also adapt the timeout for a test that imports QtQuick.Controls.Basic,
as the Dom also eagerly loads all the QML files from an imported module,
which takes much more time with the
DomCreationOption::WithScriptExpressions.
Task-number: QTBUG-122645
Change-Id: Icb7eb6d17df15fc6ea133e014c00153df5cd1492
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>