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
81
82
83
84
85
86
87
88
89
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
163
164
165
166
167
170
171
174BindingsPrivate::BindingsPrivate(QQmlSA::Binding::Bindings *iface) : q_ptr{ iface } { }
177
178
185
186
190 : m_bindings{ other.m_bindings.begin(), other.m_bindings.end() }, q_ptr{ iface }
195 : m_bindings{ std::move(other.m_bindings) }, q_ptr{ iface }
200
201
209
210
211
215 return m_bindings.constBegin();
219
220
228
229
230
234 return m_bindings.constEnd();
238
239
240
241
242
245
246
252
253
257
258
264
265
280
281
296
297
309 m_isAttached{ other.m_isAttached }
313QQmlSA::Binding
BindingPrivate::createBinding(
const QQmlJSMetaPropertyBinding &binding)
316 saBinding.d_func()->m_binding = binding;
325const QQmlJSMetaPropertyBinding
BindingPrivate::binding(
const QQmlSA::Binding &binding)
327 return binding.d_func()->m_binding;
331
332
333
340
341
348
349
356
357
358
365
366
373
374
381
382
383
389#if QT_DEPRECATED_SINCE(6
, 9
)
391
392
393
394
395
403
404
412
413
414
421
422
423
430
431
438
439
440
447
448
449
450
459
460
461
462
463
472
473
474
481
482
483
484
485
487
488
489
490
491
494
495
499
500
507
508
512
513
521
522
523
527 return m_methods.constBegin();
531
532
540
541
542
546 return m_methods.constEnd();
549MethodsPrivate::MethodsPrivate(QQmlSA::Method::Methods *iface) : q_ptr{ iface } { }
570 return m_method.methodName();
575 return QQmlSA::SourceLocationPrivate::createQQmlSASourceLocation(m_method.sourceLocation());
580 return m_method.methodType();
584
585
586
587
588
591
592
596
597
601
602
609
610
622
623
635
636
640
641
649
650
658
659
660
662
663
664
667
668
682 QQmlSA::Method saMethod;
683 auto &wrappedMethod = saMethod.d_func()->m_method;
684 wrappedMethod = jsMethod;
688QQmlSA::Method::Methods
691 QMultiHash<QString, QQmlSA::Method> saMethods;
692 for (
const auto &[key, value] : hash.asKeyValueRange()) {
693 saMethods.insert(key, MethodPrivate::createMethod(value));
696 QQmlSA::Method::Methods methods;
697 methods.d_func()->m_methods =
std::move(saMethods);
703 return method.d_func()->m_method;
707
708
709
710
734
735
736
737
744
745
765
766
767
768
769
772
773
777
778
783
784
791
792
804
805
817
818
822
823
831
832
840
841
849
850
858
859
860
862
863
864
873
874
875
876
877
880
881
888
889
896
897
898
901
902
913
914
915
918
919
926
927
934
935
942
943
950
951
958
959
966
967
974
975
982
983
990
991
992
999
1000
1007
1008
1015
1016
1017
1024
1025
1026
1033
1034
1035
1042
1043
1044
1051
1052
1059
1060
1061
1062
1063
1066
1067
1068
1075
1076
1084
1085
1093
1094
1101
1102
1109
1110
1111
1118
1119
1120
1127
1128
1129
1137
1138
1150QQmlSA::Binding::Bindings
1151BindingsPrivate::createBindings(
const QMultiHash<QString, QQmlJSMetaPropertyBinding> &hash)
1153 QMultiHash<QString, QQmlSA::Binding> saBindings;
1154 for (
const auto &[key, value] : hash.asKeyValueRange()) {
1155 saBindings.insert(key, BindingPrivate::createBinding(value));
1158 QQmlSA::Binding::Bindings bindings;
1159 bindings.d_func()->m_bindings =
std::move(saBindings);
1178
1179
1186
1187
1194
1195
1204
1205
1206
1208
1209
1210
1218
1219
1220
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1240 Q_DECLARE_PUBLIC(GenericPass);
1250 PassManager *m_manager =
nullptr;
1252 GenericPass *q_ptr =
nullptr;
1256
1257
1262
1263
1267
1268
1275
1276
1277
1289
1290
1291
1304
1305
1306
1316
1317
1318
1331
1332
1333
1334
1335
1336
1348
1349
1350
1351
1352
1353
1370
1371
1384
1385
1386
1396
1397
1408
1409
1420
1421
1432
1433
1434
1435
1436
1443
1444
1452
1453
1454
1455
1456
1466 if (element.isNull() || QQmlJSScope::scope(element)->internalName().isEmpty()) {
1469 if (element.isNull() || element.baseType().isNull())
1470 return u"$INVALID$"_s;
1471 name = QQmlJSScope::scope(element.baseType())->internalName();
1473 name = QQmlJSScope::scope(element)->internalName();
1476 const QString filePath =
1477 (mode ==
Register || !element.baseType() ? element : element.baseType()).filePath();
1479 if (QQmlJSScope::scope(element)->isComposite() && !filePath.endsWith(u".h"))
1480 name += u'@' + filePath;
1485
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
1527 qWarning() <<
"Both the moduleName and the typeName must be specified "
1528 "for the pass to be registered for a specific element.";
1610
1611
1620 return QQmlJSScope::scope(element)->childScopesBegin();
1625 return QQmlJSScope::scope(element)->childScopesEnd();
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1721
1722
1767
1768
1769
1770
1771
1774
1775
1776
1779
1780
1781
1784
1785
1786
1787
1790
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
1839
1840
1841
1844
1845
1846
1847
1848
1849
1850
1853
1854
1855
1856
1857
1858
1866
1867
1868
1869
1870
1874
1875
1879
1880
1881
1882
1883
1896
1897
1898
1899
1900
1901
1902
1903
1914
1915
1916
1917
1918
1919
1920
1921
1922
1933
1934
1935
1936
1937
1938
1951
1952
1962 FixSuggestion *iface,
const QString &description,
const SourceLocation &location,
1963 const QList<DocumentEdit> &documentEdits)
1964 : m_fixSuggestion{ description, SourceLocationPrivate::sourceLocation(location),
1965 DocumentEditPrivate::documentEdits(documentEdits) }
1983 return m_fixSuggestion.description();
1988 return QQmlSA::SourceLocationPrivate::createQQmlSASourceLocation(m_fixSuggestion.location());
1993 auto editJS = DocumentEditPrivate::documentEdit(editSA);
1994 m_fixSuggestion.addDocumentEdit(editJS);
1999 QList<DocumentEdit> edits;
2000 for (
const auto &edit : m_fixSuggestion.documentEdits())
2001 edits << DocumentEditPrivate::createQQmlSADocumentEdit(edit);
2007 m_fixSuggestion.setFilename(fileName);
2012 return m_fixSuggestion.filename();
2017 m_fixSuggestion.setAutoApplicable(autoApplicable);
2022 return m_fixSuggestion.isAutoApplicable();
2032 return saFixSuggestion.d_func()->m_fixSuggestion;
2037 auto saLocation = SourceLocationPrivate::createQQmlSASourceLocation(jsFix.location());
2038 FixSuggestion saFix(jsFix.description(), saLocation);
2039 saFix.d_ptr->m_fixSuggestion.setDocumentEdits(jsFix.documentEdits());
2040 saFix.setAutoApplicable(jsFix.isAutoApplicable());
2045
2046
2047
2048
2049
2052
2053
2061
2062
2069
2070
2077
2078
2090
2091
2103
2104
2108
2109
2117
2118
2126
2127
2135
2136
2137
2139
2140
2141
2145 DocumentEdit *iface,
const QString &filename,
const SourceLocation &location,
2146 const QString &replacement)
2147 : m_documentEdit{ filename, SourceLocationPrivate::sourceLocation(location), replacement }
2166 return m_documentEdit.m_filename;
2171 return QQmlSA::SourceLocationPrivate::createQQmlSASourceLocation(m_documentEdit.m_location);
2176 return m_documentEdit.m_replacement;
2181 return edit.d_ptr->m_documentEdit;
2186 QList<QQmlJSDocumentEdit> editsJS;
2187 for (
const auto &editsSA : editsSA)
2188 editsJS << DocumentEditPrivate::documentEdit(editsSA);
2194 auto saLocation = QQmlSA::SourceLocationPrivate::createQQmlSASourceLocation(jsEdit.m_location);
2195 return DocumentEdit{ jsEdit.m_filename, saLocation, jsEdit.m_replacement };
2199
2200
2201
2202
2203
2207
2208
2217
2218
2226
2227
2234
2235
2242
2243
2254
2255
2266
2267
2271
2272
2280
2281
2289
2290
2298
2299
2307
2308
2315
2316
2323
2324
2325
2333
2334
2342
2343
2344
2346
2347
2348
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.