blob: ce0cd1d04618895bbd5b11c3edbe5b875d4904c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
Item {
function f() {
let sum = 0, sum2 = 0
for(let i = 1; i < 42; i = i + 2) {
sum = sum + i
{
let sum = 42; // another unrelated sum
}
}
}
property int helloProperty: 0
property int p2: 1
function withProperty() {
let sum = 0, sum2 = 0
for(let i = 1; i < 42; i = i + 2) {
sum = sum + i
helloProperty = helloProperty + sum - i * p2;
{
let helloProperty = "evil"
}
}
}
Item {
function f() {
return helloProperty + p2
}
property string helloProperty
}
component IC: Item {
property var helloProperty
function f() {
return helloProperty + p2
}
}
component NestedComponent: Item {
property NestedComponent2 inner: NestedComponent2 {}
property int p2
}
component NestedComponent2: Item {
property NestedComponent3 inner
property int p2
inner: NestedComponent3 {}
}
component NestedComponent3: Item {
property NestedComponent4 inner
property int p2
inner: NestedComponent4 {}
}
component NestedComponent4: Item {
property int helloProperty
property int p2
}
NestedComponent {
id: myNested
}
function nestedUsages() {
let x = myNested.inner.inner.inner.helloProperty + helloProperty;
let a = myNested.p2 + p2
let b = myNested.inner.p2 + p2
let c = myNested.inner.inner.p2 + p2
let d = myNested.inner.inner.inner.p2 + p2
}
function recursive(n: int): int {
if (n > 3)
return 1 + recursive(recursive(x-1) + recursive(x-2) - recursive(x-3));
else
return recursive(0);
}
property int helloRecursive: recursive(42)
id: rootId
Rectangle {
function f() {
return rootId.recursive(123)
}
}
signal helloSignal()
function callSignals() {
helloSignal()
if (false) {
helloSignal()
} else {
// helloSignal() // not a usage btw
if (true)
helloSignal()
}
}
function callSignals2() {
helloSignal()
if (false) {
widthChanged()
} else {
// helloSignal() // not a usage btw
if (true)
widthChanged()
rootId.widthChanged()
}
}
Item {
function callSignalsInChild() {
widthChanged()
rootId.widthChanged()
}
}
function myHelloHandler() { let x = 32; }
onHelloSignal: myHelloHandler
property int helloPropertyBinding
helloPropertyBinding: 123
property int checkHandlers
onCheckHandlersChanged: myHelloHandler
onChildrenChanged: myHelloHandler
function callChanged() {
checkHandlersChanged()
childrenChanged()
}
property int _: 48
property int ______42: 48
property int _123a: 48
on_Changed: myHelloHandler
on______42Changed: myHelloHandler
on_123AChanged: myHelloHandler
function weirdPropertynames() {
_Changed()
______42Changed()
_123aChanged()
}
TapHandler {
onTapped: myHelloHandler
function f() {
tapped()
}
}
function anotherF() {
helloPropertyChanged()
}
onHelloPropertyChanged: myHelloHandler
Type {}
function foo(mouse) {}
MouseArea {
id: area1
onClicked: foo
property int insideMouseArea1
}
MouseArea {
id: area2
Connections {
function onClicked(mouse) {
area1.clicked()
area3.clicked()
}
}
property int insideMouseArea2
MouseArea {id: area3}
}
property Connections c: Connections {
target: area3
onClicked: function(mouse) {
//
}
}
function useMouseAreas() {
area1.clicked()
area2.clicked()
area3.clicked()
}
function checkParameters(a: int, b: double, {x, y={}, z=[x,y]}) {
return a + b + c + x + y + z
}
function deconstructingUsages(xxx) {
let {a, b} = xxx;
let c = a + b;
}
}
|