diff options
| author | Andrei Golubev <andrei.golubev@qt.io> | 2021-04-12 15:45:48 +0200 |
|---|---|---|
| committer | Andrei Golubev <andrei.golubev@qt.io> | 2021-04-13 19:19:56 +0200 |
| commit | 5374dc429902f934f3e9a9e54d0abe9f051cb51b (patch) | |
| tree | 72752599cb140c0191518d2803d5cf7f5f7d23ed /src/qml/compiler/qv4codegen.cpp | |
| parent | 583fc6f3b67aba50f729cc729b17a8bbf03f4d5c (diff) | |
QQmlJSImportVisitor: add find-or-create version of enterEnvironment
It seems that in cases of grouped and attached properties we don't want
to create a new scope every time, but instead reuse the created one,
falling back to create if the scope doesn't exist
Consider:
```qml
QtObject {
myGroup.property1: 42 // case 1
myGroup.property2: "hello" // case 2
MyAttached.property1: 42 // case 3
MyAttached.property2: "hello" // case 4
}
```
The intuition tells that cases 1 and 2 should use the same shared
scope "myGroup" and so should cases 3 and 4 both use the same "MyAttached".
Creating a new scope each time for attached and grouped properties seems
erroneous
As a drive-by, add attached property type to tst_qmllint and test
that this still works after the changes to the related code
Change-Id: Ib1ae85b404a7954a3a3211cbd267c414b98ac59d
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'src/qml/compiler/qv4codegen.cpp')
0 files changed, 0 insertions, 0 deletions
