Details
-
Task
-
Resolution: Fixed
-
P2: Important
-
6.7
-
None
-
404963f8a (dev), 9d3126b2e (dev), 1a32fdda6 (dev), 447b56439 (dev), e561321a4 (dev), d5663c9fd (dev)
Description
Make Dom's dependency loading work with qqmljsscope dependency loading, instead of having duplicate qqmljsscopes.
From the chat:
So, while investigating how to make
QTBUG-113827(find usages on multiple files) work, I realised that there was a misconception in QQmlDomAstCreatorWithQQmlJSScope.
The idea behind QQmlDomAstCreatorWithQQmlJSScope was to combine a QQmlDomAstCreator (that creates a Dom for one file) and a QmlJSimportVisitor (that creates a tree of QQmlJSScopes for one file), to be able to insert the QQmlJSScope inside the Dom during construction (like this it is easier to map where to put which QQmlJSScope in which DomItem).
Let's say we have two files Base.qml and Derived.qml in the implicit import directory. qmlls will try to load both files in the Dom, and one would expect to have one Dom with two files and one tree of QQmlJSScopes.... except we end up with two identical trees of QQmlJSScope: one for each QmlFile( =Dom representation of one qml file). This means we can't use `==` to compare scopes from one QmlFile to another QmlFile, which breaks the find usages feature of qmlls for multiple files.
So why two QQmlJSScope trees? Well, it turns out that QmlJSimportVisitor processes its imports via QQmlJSImporter which in turn imports files of the implicit import directory lazily via QmlJSImportVisitor.
So once I have loaded any file in the Dom (let's say Base.qml), I already have a tree of QQmlJSScope's for Base.qml and Derived.qml!
And if I load Derived.qml in the Dom, I will get another tree of QQmlJSScope's for Base.qml and Derived.qml... The good news: If I load a third file Third.qml, then (because we reuse the same QQmlJSImporter), then QQmlJSImporter should find Base.qml (from the Derived.qml loading) and Derived.qml (from the Base.qml loading) in the cache and won't attempt to recreate the QQmlJSScope trees again.
Attachments
Issue Links
- blocks
-
QTBUG-113827 qmlls: find usages in other files
- Closed
- relates to
-
QTBUG-120640 Refactor dependency management in DOM
- Reported
- resulted in
-
QTBUG-123295 DomBase: clean up doCopy() and copy constructors and mutexes
- Reported
For Gerrit Dashboard: QTBUG-122645 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
537265,8 | dom: move createDom into DomEnvironment + rename | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
537266,15 | dom: move the importer and mapper to DomEnvironment | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
537267,21 | dom: enable populateQmlFile as visitor in importer | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
537748,20 | dom: make QmlFile aware of its laziness | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
538091,12 | dom: load imported modules lazily | dev | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |
541740,13 | qqmljsimporter: always run the importvisitor | dev | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |
541742,16 | qmlls: do not instantiate scopes when watching | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
541743,16 | MutableDomItem: ensure that domitems are populated | dev | qt/qtdeclarative | Status: ABANDONED | +2 | 0 |
541984,11 | dom: use only one DomCreationOptions per DomEnvironment | dev | qt/qtdeclarative | Status: MERGED | +2 | 0 |
542287,8 | dom: adapt commitToBase to laziness | dev | qt/qtdeclarative | Status: ABANDONED | 0 | 0 |