16#include <QtQmlCompiler/private/qqmlsasourcelocation_p.h>
22using namespace Qt::StringLiterals;
29
30
31
32
33
36
37
38
39
40
41
42
43
44
47
48
49
50
51
52
53
54
55
56
57
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
82
83
84
85
86
87
88
89
90
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
164
165
166
167
168
171
172
175BindingsPrivate::BindingsPrivate(QQmlSA::Binding::Bindings *iface) : q_ptr{ iface } { }
178
179
186
187
191 : m_bindings{ other.m_bindings.begin(), other.m_bindings.end() }, q_ptr{ iface }
196 : m_bindings{ std::move(other.m_bindings) }, q_ptr{ iface }
201
202
210
211
212
216 return m_bindings.constBegin();
220
221
229
230
231
235 return m_bindings.constEnd();
239
240
241
242
243
246
247
253
254
258
259
265
266
281
282
297
298
310 m_isAttached{ other.m_isAttached }
314QQmlSA::Binding
BindingPrivate::createBinding(
const QQmlJSMetaPropertyBinding &binding)
317 saBinding.d_func()->m_binding = binding;
326const QQmlJSMetaPropertyBinding
BindingPrivate::binding(
const QQmlSA::Binding &binding)
328 return binding.d_func()->m_binding;
332
333
334
341
342
349
350
357
358
359
366
367
374
375
382
383
384
390#if QT_DEPRECATED_SINCE(6
, 9
)
392
393
394
395
396
404
405
413
414
415
422
423
424
431
432
439
440
441
448
449
450
451
460
461
462
463
464
473
474
475
482
483
484
485
486
488
489
490
491
492
495
496
500
501
508
509
513
514
522
523
524
528 return m_methods.constBegin();
532
533
541
542
543
547 return m_methods.constEnd();
550MethodsPrivate::MethodsPrivate(QQmlSA::Method::Methods *iface) : q_ptr{ iface } { }
571 return m_method.methodName();
576 return QQmlSA::SourceLocationPrivate::createQQmlSASourceLocation(m_method.sourceLocation());
581 return m_method.methodType();
585
586
587
588
589
592
593
597
598
602
603
610
611
623
624
636
637
641
642
650
651
659
660
661
663
664
665
668
669
683 QQmlSA::Method saMethod;
684 auto &wrappedMethod = saMethod.d_func()->m_method;
685 wrappedMethod = jsMethod;
689QQmlSA::Method::Methods
692 QMultiHash<QString, QQmlSA::Method> saMethods;
693 for (
const auto &[key, value] : hash.asKeyValueRange()) {
694 saMethods.insert(key, MethodPrivate::createMethod(value));
697 QQmlSA::Method::Methods methods;
698 methods.d_func()->m_methods =
std::move(saMethods);
704 return method.d_func()->m_method;
708
709
710
711
735
736
737
738
745
746
766
767
768
769
770
773
774
778
779
784
785
792
793
805
806
818
819
823
824
832
833
841
842
850
851
859
860
861
863
864
865
874
875
876
877
878
881
882
889
890
897
898
899
902
903
914
915
916
919
920
927
928
935
936
943
944
951
952
959
960
967
968
975
976
983
984
991
992
993
1000
1001
1008
1009
1016
1017
1018
1025
1026
1027
1034
1035
1036
1043
1044
1045
1052
1053
1060
1061
1062
1063
1064
1067
1068
1069
1076
1077
1085
1086
1094
1095
1102
1103
1110
1111
1112
1119
1120
1121
1128
1129
1130
1138
1139
1151QQmlSA::Binding::Bindings
1152BindingsPrivate::createBindings(
const QMultiHash<QString, QQmlJSMetaPropertyBinding> &hash)
1154 QMultiHash<QString, QQmlSA::Binding> saBindings;
1155 for (
const auto &[key, value] : hash.asKeyValueRange()) {
1156 saBindings.insert(key, BindingPrivate::createBinding(value));
1159 QQmlSA::Binding::Bindings bindings;
1160 bindings.d_func()->m_bindings =
std::move(saBindings);
1179
1180
1187
1188
1195
1196
1205
1206
1207
1209
1210
1211
1219
1220
1221
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1241 Q_DECLARE_PUBLIC(GenericPass);
1251 PassManager *m_manager =
nullptr;
1253 GenericPass *q_ptr =
nullptr;
1257
1258
1263
1264
1268
1269
1276
1277
1278
1290
1291
1292
1305
1306
1307
1317
1318
1319
1332
1333
1334
1335
1336
1337
1349
1350
1351
1352
1353
1354
1371
1372
1385
1386
1387
1397
1398
1409
1410
1421
1422
1433
1434
1435
1436
1437
1444
1445
1453
1454
1455
1456
1457
1467 if (element.isNull() || QQmlJSScope::scope(element)->internalName().isEmpty()) {
1470 if (element.isNull() || element.baseType().isNull())
1471 return u"$INVALID$"_s;
1472 name = QQmlJSScope::scope(element.baseType())->internalName();
1474 name = QQmlJSScope::scope(element)->internalName();
1477 const QString filePath =
1478 (mode ==
Register || !element.baseType() ? element : element.baseType()).filePath();
1480 if (QQmlJSScope::scope(element)->isComposite() && !filePath.endsWith(u".h"))
1481 name += u'@' + filePath;
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1528 qWarning() <<
"Both the moduleName and the typeName must be specified "
1529 "for the pass to be registered for a specific element.";
1611
1612
1621 return QQmlJSScope::scope(element)->childScopesBegin();
1626 return QQmlJSScope::scope(element)->childScopesEnd();
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1722
1723
1768
1769
1770
1771
1772
1775
1776
1777
1780
1781
1782
1785
1786
1787
1788
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1840
1841
1842
1845
1846
1847
1848
1849
1850
1851
1854
1855
1856
1857
1858
1859
1867
1868
1869
1870
1871
1875
1876
1880
1881
1882
1883
1884
1897
1898
1899
1900
1901
1902
1903
1904
1915
1916
1917
1918
1919
1920
1921
1922
1923
1934
1935
1936
1937
1938
1939
1952
1953
1963 FixSuggestion *iface,
const QString &description,
const SourceLocation &location,
1964 const QList<DocumentEdit> &documentEdits)
1965 : m_fixSuggestion{ description, SourceLocationPrivate::sourceLocation(location),
1966 DocumentEditPrivate::documentEdits(documentEdits) }
1984 return m_fixSuggestion.description();
1989 return QQmlSA::SourceLocationPrivate::createQQmlSASourceLocation(m_fixSuggestion.location());
1994 auto editJS = DocumentEditPrivate::documentEdit(editSA);
1995 m_fixSuggestion.addDocumentEdit(editJS);
2000 QList<DocumentEdit> edits;
2001 for (
const auto &edit : m_fixSuggestion.documentEdits())
2002 edits << DocumentEditPrivate::createQQmlSADocumentEdit(edit);
2008 m_fixSuggestion.setFilename(fileName);
2013 return m_fixSuggestion.filename();
2018 m_fixSuggestion.setAutoApplicable(autoApplicable);
2023 return m_fixSuggestion.isAutoApplicable();
2033 return saFixSuggestion.d_func()->m_fixSuggestion;
2038 auto saLocation = SourceLocationPrivate::createQQmlSASourceLocation(jsFix.location());
2039 FixSuggestion saFix(jsFix.description(), saLocation);
2040 saFix.d_ptr->m_fixSuggestion.setDocumentEdits(jsFix.documentEdits());
2041 saFix.setAutoApplicable(jsFix.isAutoApplicable());
2046
2047
2048
2049
2050
2053
2054
2062
2063
2070
2071
2078
2079
2091
2092
2104
2105
2109
2110
2118
2119
2127
2128
2136
2137
2138
2140
2141
2142
2146 DocumentEdit *iface,
const QString &filename,
const SourceLocation &location,
2147 const QString &replacement)
2148 : m_documentEdit{ filename, SourceLocationPrivate::sourceLocation(location), replacement }
2167 return m_documentEdit.m_filename;
2172 return QQmlSA::SourceLocationPrivate::createQQmlSASourceLocation(m_documentEdit.m_location);
2177 return m_documentEdit.m_replacement;
2182 return edit.d_ptr->m_documentEdit;
2187 QList<QQmlJSDocumentEdit> editsJS;
2188 for (
const auto &editsSA : editsSA)
2189 editsJS << DocumentEditPrivate::documentEdit(editsSA);
2195 auto saLocation = QQmlSA::SourceLocationPrivate::createQQmlSASourceLocation(jsEdit.m_location);
2196 return DocumentEdit{ jsEdit.m_filename, saLocation, jsEdit.m_replacement };
2200
2201
2202
2203
2204
2208
2209
2218
2219
2227
2228
2235
2236
2243
2244
2255
2256
2267
2268
2272
2273
2281
2282
2290
2291
2299
2300
2308
2309
2316
2317
2324
2325
2326
2334
2335
2343
2344
2345
2347
2348
2349
BindingPrivate(Binding *, const BindingPrivate &)
QMultiHash< QString, Binding >::const_iterator constBegin() const
QMultiHash< QString, Binding >::const_iterator constEnd() const
DocumentEditPrivate(DocumentEdit *, DocumentEditPrivate &&)
QString replacement() const
DocumentEditPrivate(DocumentEdit *, const DocumentEditPrivate &)
SourceLocation location() const
QList< DocumentEdit > documentEdits() const
SourceLocation location() const
QString description() const
void setFileName(const QString &)
void addDocumentEdit(const DocumentEdit &)
FixSuggestionPrivate(FixSuggestion *)
bool isAutoApplicable() const
void setAutoApplicable(bool autoApplicable=true)
FixSuggestionPrivate(FixSuggestion *, FixSuggestionPrivate &&)
FixSuggestionPrivate(FixSuggestion *, const FixSuggestionPrivate &)
GenericPassPrivate(GenericPass *iface, PassManager *manager)
MethodPrivate(Method *, const MethodPrivate &)
QQmlSA::SourceLocation sourceLocation() const
MethodType methodType() const
QString methodName() const
MethodsPrivate(QQmlSA::Method::Methods *, MethodsPrivate &&)
QMultiHash< QString, Method >::const_iterator constEnd() const
MethodsPrivate(QQmlSA::Method::Methods *, const MethodsPrivate &)
QMultiHash< QString, Method >::const_iterator constBegin() const
Q_QMLCOMPILER_EXPORT void emitWarningWithOptionalFix(GenericPass &pass, QAnyStringView diagnostic, const LoggerWarningId &id, const QQmlSA::SourceLocation &srcLocation, const std::optional< QQmlJSFixSuggestion > &fixSuggestion)
static QQmlJS::ChildScopesIterator childScopesEnd(const Element &element)
static QQmlJS::ChildScopesIterator childScopesBegin(const Element &element)
bool isRegularBindingType(BindingType type)
static QString lookupName(const QQmlSA::Element &element, LookupMode mode=Lookup)
Combined button and popup list for selecting options.