Commit Graph

1 Commits

Author SHA1 Message Date
Andrei Golubev 5374dc4299 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>
2021-04-13 19:19:56 +02:00