Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqmldomastcreator_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QQMLDOMASTCREATOR_P_H
5#define QQMLDOMASTCREATOR_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "qqmldomelements_p.h"
19#include "qqmldomitem_p.h"
20#include "qqmldompath_p.h"
22
23#include <QtQmlCompiler/private/qqmljsimportvisitor_p.h>
24
25#include <QtQml/private/qqmljsastvisitor_p.h>
26#include <memory>
27#include <type_traits>
28#include <variant>
29
31
32namespace QQmlJS {
33namespace Dom {
34
35class QQmlDomAstCreator final : public AST::Visitor
36{
38 using AST::Visitor::endVisit;
39 using AST::Visitor::visit;
40
41 static constexpr const auto className = "QmlDomAstCreator";
42
43 class DomValue
44 {
45 public:
46 template<typename T>
47 DomValue(const T &obj) : kind(T::kindValue), value(obj)
48 {
49 }
50 DomType kind;
53 value;
54 };
55
56 class QmlStackElement
57 {
58 public:
59 Path path;
60 DomValue item;
61 FileLocations::Tree fileLocations;
62 };
63
77 class ScriptStackElement
78 {
79 public:
80 template<typename T>
81 static ScriptStackElement from(const T &obj)
82 {
83 if constexpr (std::is_same_v<T, ScriptElements::ScriptList>) {
84 ScriptStackElement s{ ScriptElements::ScriptList::kindValue, obj };
85 return s;
86 } else {
87 ScriptStackElement s{ obj->kind(), ScriptElementVariant::fromElement(obj) };
88 return s;
89 }
90 Q_UNREACHABLE();
91 }
92
93 DomType kind;
94 using Variant = std::variant<ScriptElementVariant, ScriptElements::ScriptList>;
95 Variant value;
96
97 ScriptElementVariant takeVariant()
98 {
99 Q_ASSERT_X(std::holds_alternative<ScriptElementVariant>(value), "takeVariant",
100 "Should be a variant, did the parser change?");
101 return std::get<ScriptElementVariant>(std::move(value));
102 }
103
104 bool isList() const { return std::holds_alternative<ScriptElements::ScriptList>(value); };
105
107 {
108 Q_ASSERT_X(std::holds_alternative<ScriptElements::ScriptList>(value), "takeList",
109 "Should be a List, did the parser change?");
110 return std::get<ScriptElements::ScriptList>(std::move(value));
111 }
112
113 void setSemanticScope(const QQmlJSScope::ConstPtr &scope)
114 {
115 if (auto x = std::get_if<ScriptElementVariant>(&value)) {
116 x->base()->setSemanticScope(scope);
117 return;
118 } else if (auto x = std::get_if<ScriptElements::ScriptList>(&value)) {
119 x->setSemanticScope(scope);
120 return;
121 }
122 Q_UNREACHABLE();
123 }
124 };
125
126public:
127 void enableScriptExpressions(bool enable = true) { m_enableScriptExpressions = enable; }
128 void enableLoadFileLazily(bool enable = true) { m_loadFileLazily = enable; }
129
130private:
131
132 MutableDomItem qmlFile;
133 std::shared_ptr<QmlFile> qmlFilePtr;
134 QVector<QmlStackElement> nodeStack;
135 QList<ScriptStackElement> scriptNodeStack;
136 QVector<int> arrayBindingLevels;
137 FileLocations::Tree rootMap;
138 int m_nestedFunctionDepth = 0;
139 bool m_enableScriptExpressions = false;
140 bool m_loadFileLazily = false;
141
142 // A Binding inside a UiPublicMember (= a Property definition) will shadow the
143 // propertydefinition's binding identifiers with its own binding identifiers. Therefore, disable
144 // bindingIdentifiers for the Binding inside a Property definition by using this flag.
145 bool m_skipBindingIdentifiers = false;
146
147 void setBindingIdentifiers(const Path &pathFromOwner, const AST::UiQualifiedId *identifiers,
148 Binding *bindingPtr);
149 template<typename T>
150 QmlStackElement &currentEl(int idx = 0)
151 {
152 Q_ASSERT_X(idx < nodeStack.size() && idx >= 0, "currentQmlObjectOrComponentEl",
153 "Stack does not contain enough elements!");
154 int i = nodeStack.size() - idx;
155 while (i-- > 0) {
156 DomType k = nodeStack.at(i).item.kind;
157 if (k == T::kindValue)
158 return nodeStack[i];
159 }
160 Q_ASSERT_X(false, "currentEl", "Stack does not contan object of type ");
161 return nodeStack.last();
162 }
163
164 template<typename T>
165 ScriptStackElement &currentScriptEl(int idx = 0)
166 {
167 Q_ASSERT_X(m_enableScriptExpressions, "currentScriptEl",
168 "Cannot access script elements when they are disabled!");
169
170 Q_ASSERT_X(idx < scriptNodeStack.size() && idx >= 0, "currentQmlObjectOrComponentEl",
171 "Stack does not contain enough elements!");
172 int i = scriptNodeStack.size() - idx;
173 while (i-- > 0) {
174 DomType k = scriptNodeStack.at(i).kind;
175 if (k == T::element_type::kindValue)
176 return scriptNodeStack[i];
177 }
178 Q_ASSERT_X(false, "currentEl", "Stack does not contain object of type ");
179 return scriptNodeStack.last();
180 }
181
182 template<typename T>
183 T &current(int idx = 0)
184 {
185 return std::get<T>(currentEl<T>(idx).item.value);
186 }
187
188 index_type currentIndex() { return currentNodeEl().path.last().headIndex(); }
189
190 QmlStackElement &currentQmlObjectOrComponentEl(int idx = 0);
191
192 QmlStackElement &currentNodeEl(int i = 0);
193 ScriptStackElement &currentScriptNodeEl(int i = 0);
194
195 DomValue &currentNode(int i = 0);
196
197 void removeCurrentNode(std::optional<DomType> expectedType);
198 void removeCurrentScriptNode(std::optional<DomType> expectedType);
199
200 void pushEl(const Path &p, const DomValue &it, AST::Node *n)
201 {
202 nodeStack.append({ p, it, createMap(it.kind, p, n) });
203 }
204
205 FileLocations::Tree createMap(const FileLocations::Tree &base, const Path &p, AST::Node *n);
206
207 FileLocations::Tree createMap(DomType k, const Path &p, AST::Node *n);
208
209 const ScriptElementVariant &
210 finalizeScriptExpression(const ScriptElementVariant &element, const Path &pathFromOwner,
211 const FileLocations::Tree &ownerFileLocations);
212
213 void setScriptExpression (const std::shared_ptr<ScriptExpression>& value);
214
215 Path pathOfLastScriptNode() const;
216
221 template<typename AstNodeT>
222 static std::shared_ptr<ScriptElements::Literal> makeStringLiteral(QStringView value,
223 AstNodeT *ast)
224 {
225 auto myExp = std::make_shared<ScriptElements::Literal>(ast->firstSourceLocation(),
226 ast->lastSourceLocation());
227 myExp->setLiteralValue(value.toString());
228 return myExp;
229 }
230
231 static std::shared_ptr<ScriptElements::Literal> makeStringLiteral(QStringView value,
233 {
234 auto myExp = std::make_shared<ScriptElements::Literal>(loc);
235 myExp->setLiteralValue(value.toString());
236 return myExp;
237 }
238
245 template<typename ScriptElementT, typename AstNodeT,
246 typename Enable =
247 std::enable_if_t<!std::is_same_v<ScriptElementT, ScriptElements::ScriptList>>>
248 static decltype(auto) makeScriptElement(AstNodeT *ast)
249 {
250 auto myExp = std::make_shared<ScriptElementT>(ast->firstSourceLocation(),
251 ast->lastSourceLocation());
252 return myExp;
253 }
254
260 template<typename AstNodeT>
261 static std::shared_ptr<ScriptElements::GenericScriptElement>
262 makeGenericScriptElement(AstNodeT *ast, DomType kind)
263 {
264 auto myExp = std::make_shared<ScriptElements::GenericScriptElement>(
265 ast->firstSourceLocation(), ast->lastSourceLocation());
266 myExp->setKind(kind);
267 return myExp;
268 }
269
270 enum UnaryExpressionKind { Prefix, Postfix };
271 std::shared_ptr<ScriptElements::GenericScriptElement>
272 makeUnaryExpression(AST::Node *expression, QQmlJS::SourceLocation operatorToken,
273 bool hasExpression, UnaryExpressionKind type);
274
275 static std::shared_ptr<ScriptElements::GenericScriptElement>
276 makeGenericScriptElement(SourceLocation location, DomType kind)
277 {
278 auto myExp = std::make_shared<ScriptElements::GenericScriptElement>(location);
279 myExp->setKind(kind);
280 return myExp;
281 }
282
288 template<typename AstNodeT>
289 static decltype(auto) makeScriptList(AstNodeT *ast)
290 {
291 auto myExp =
292 ScriptElements::ScriptList(ast->firstSourceLocation(), ast->lastSourceLocation());
293 return myExp;
294 }
295
296 template<typename ScriptElementT>
297 void pushScriptElement(const ScriptElementT &element)
298 {
299 Q_ASSERT_X(m_enableScriptExpressions, "pushScriptElement",
300 "Cannot create script elements when they are disabled!");
301 scriptNodeStack.append(ScriptStackElement::from(element));
302 }
303
304 void disableScriptElements()
305 {
306 m_enableScriptExpressions = false;
307 scriptNodeStack.clear();
308 }
309
310 ScriptElementVariant scriptElementForQualifiedId(AST::UiQualifiedId *expression);
311
312public:
313 explicit QQmlDomAstCreator(const MutableDomItem &qmlFile);
314
315 bool visit(AST::UiProgram *program) override;
316 void endVisit(AST::UiProgram *) override;
317
318 bool visit(AST::UiPragma *el) override;
319
320 bool visit(AST::UiImport *el) override;
321
322 bool visit(AST::UiPublicMember *el) override;
323 void endVisit(AST::UiPublicMember *el) override;
324
325private:
326 ScriptElementVariant prepareBodyForFunction(AST::FunctionExpression *fExpression);
327
328public:
329 bool visit(AST::FunctionExpression *el) override;
330 void endVisit(AST::FunctionExpression *) override;
331
332 bool visit(AST::FunctionDeclaration *el) override;
333 void endVisit(AST::FunctionDeclaration *) override;
334
335 bool visit(AST::UiSourceElement *el) override;
336 void endVisit(AST::UiSourceElement *) override;
337
339
340 bool visit(AST::UiObjectDefinition *el) override;
341 void endVisit(AST::UiObjectDefinition *) override;
342
343 bool visit(AST::UiObjectBinding *el) override;
344 void endVisit(AST::UiObjectBinding *) override;
345
346 bool visit(AST::UiScriptBinding *el) override;
347 void endVisit(AST::UiScriptBinding *) override;
348
349 bool visit(AST::UiArrayBinding *el) override;
350 void endVisit(AST::UiArrayBinding *) override;
351
352 bool visit(AST::UiQualifiedId *) override;
353
354 bool visit(AST::UiEnumDeclaration *el) override;
355 void endVisit(AST::UiEnumDeclaration *) override;
356
357 bool visit(AST::UiEnumMemberList *el) override;
358 void endVisit(AST::UiEnumMemberList *el) override;
359
360 bool visit(AST::UiInlineComponent *el) override;
361 void endVisit(AST::UiInlineComponent *) override;
362
363 bool visit(AST::UiRequired *el) override;
364
365 bool visit(AST::UiAnnotation *el) override;
366 void endVisit(AST::UiAnnotation *) override;
367
368 // for Script elements:
369 bool visit(AST::BinaryExpression *exp) override;
370 void endVisit(AST::BinaryExpression *exp) override;
371
372 bool visit(AST::Block *block) override;
373 void endVisit(AST::Block *) override;
374
375 bool visit(AST::YieldExpression *block) override;
376 void endVisit(AST::YieldExpression *) override;
377
378 bool visit(AST::ReturnStatement *block) override;
379 void endVisit(AST::ReturnStatement *) override;
380
381 bool visit(AST::ForStatement *forStatement) override;
382 void endVisit(AST::ForStatement *forStatement) override;
383
384 bool visit(AST::PatternElement *pe) override;
385 void endVisit(AST::PatternElement *pe) override;
387 const std::shared_ptr<ScriptElements::GenericScriptElement> &element);
388
389 bool visit(AST::IfStatement *) override;
390 void endVisit(AST::IfStatement *) override;
391
392 bool visit(AST::FieldMemberExpression *) override;
393 void endVisit(AST::FieldMemberExpression *) override;
394
395 bool visit(AST::ArrayMemberExpression *) override;
396 void endVisit(AST::ArrayMemberExpression *) override;
397
398 bool visit(AST::CallExpression *) override;
399 void endVisit(AST::CallExpression *) override;
400
401 bool visit(AST::ArrayPattern *) override;
402 void endVisit(AST::ArrayPattern *) override;
403
404 bool visit(AST::ObjectPattern *) override;
405 void endVisit(AST::ObjectPattern *) override;
406
407 bool visit(AST::PatternProperty *) override;
408 void endVisit(AST::PatternProperty *) override;
409
410 bool visit(AST::VariableStatement *) override;
411 void endVisit(AST::VariableStatement *) override;
412
413 bool visit(AST::Type *expression) override;
414 void endVisit(AST::Type *expression) override;
415
416 bool visit(AST::DefaultClause *) override;
417 void endVisit(AST::DefaultClause *) override;
418
419 bool visit(AST::CaseClause *) override;
420 void endVisit(AST::CaseClause *) override;
421
422 bool visit(AST::CaseClauses *) override;
423 void endVisit(AST::CaseClauses *) override;
424
425 bool visit(AST::CaseBlock *) override;
426 void endVisit(AST::CaseBlock *) override;
427
428 bool visit(AST::SwitchStatement *) override;
429 void endVisit(AST::SwitchStatement *) override;
430
431 bool visit(AST::WhileStatement *) override;
432 void endVisit(AST::WhileStatement *) override;
433
434 bool visit(AST::DoWhileStatement *) override;
435 void endVisit(AST::DoWhileStatement *) override;
436
437 bool visit(AST::ForEachStatement *) override;
438 void endVisit(AST::ForEachStatement *) override;
439
440 bool visit(AST::ClassExpression *) override;
441 void endVisit(AST::ClassExpression *) override;
442
443 bool visit(AST::TemplateLiteral *) override;
444
445 bool visit(AST::TryStatement *) override;
446 void endVisit(AST::TryStatement *) override;
447
448 bool visit(AST::Catch *) override;
449 void endVisit(AST::Catch *) override;
450
451 bool visit(AST::Finally *) override;
452 void endVisit(AST::Finally *) override;
453
454 bool visit(AST::ThrowStatement *) override;
455 void endVisit(AST::ThrowStatement *) override;
456
457 bool visit(AST::LabelledStatement *) override;
458 void endVisit(AST::LabelledStatement *) override;
459
460 bool visit(AST::ContinueStatement *) override;
461 void endVisit(AST::ContinueStatement *) override;
462
463 bool visit(AST::BreakStatement *) override;
464 void endVisit(AST::BreakStatement *) override;
465
466 bool visit(AST::Expression *) override;
467 void endVisit(AST::Expression *) override;
468
469 bool visit(AST::ConditionalExpression *) override;
470 void endVisit(AST::ConditionalExpression *) override;
471
472 bool visit(AST::UnaryMinusExpression *) override;
473 void endVisit(AST::UnaryMinusExpression *) override;
474
475 bool visit(AST::UnaryPlusExpression *) override;
476 void endVisit(AST::UnaryPlusExpression *) override;
477
478 bool visit(AST::TildeExpression *) override;
479 void endVisit(AST::TildeExpression *) override;
480
481 bool visit(AST::NotExpression *) override;
482 void endVisit(AST::NotExpression *) override;
483
484 bool visit(AST::TypeOfExpression *) override;
485 void endVisit(AST::TypeOfExpression *) override;
486
487 bool visit(AST::DeleteExpression *) override;
488 void endVisit(AST::DeleteExpression *) override;
489
490 bool visit(AST::VoidExpression *) override;
491 void endVisit(AST::VoidExpression *) override;
492
493 bool visit(AST::PostDecrementExpression *) override;
494 void endVisit(AST::PostDecrementExpression *) override;
495
496 bool visit(AST::PostIncrementExpression *) override;
497 void endVisit(AST::PostIncrementExpression *) override;
498
499 bool visit(AST::PreDecrementExpression *) override;
500 void endVisit(AST::PreDecrementExpression *) override;
501
502 bool visit(AST::PreIncrementExpression *) override;
503 void endVisit(AST::PreIncrementExpression *) override;
504
505 bool visit(AST::EmptyStatement *) override;
506 void endVisit(AST::EmptyStatement *) override;
507
508 bool visit(AST::NestedExpression *) override;
509 void endVisit(AST::NestedExpression *) override;
510
511
512 // lists of stuff whose children don't need a qqmljsscope: visitation order can be custom
513 bool visit(AST::UiParameterList *) override;
514 bool visit(AST::Elision *elision) override;
515
516
517 // lists of stuff whose children need a qqmljsscope: visitation order cannot be custom
518 void endVisit(AST::StatementList *list) override;
519 void endVisit(AST::VariableDeclarationList *vdl) override;
520 void endVisit(AST::ArgumentList *) override;
521 void endVisit(AST::PatternElementList *) override;
522 void endVisit(AST::PatternPropertyList *) override;
523 void endVisit(AST::FormalParameterList *el) override;
524
525
526 // literals and ids
527 bool visit(AST::IdentifierExpression *expression) override;
528 bool visit(AST::NumericLiteral *expression) override;
529 bool visit(AST::StringLiteral *expression) override;
530 bool visit(AST::NullExpression *expression) override;
531 bool visit(AST::TrueLiteral *expression) override;
532 bool visit(AST::FalseLiteral *expression) override;
533 bool visit(AST::ComputedPropertyName *expression) override;
534 bool visit(AST::IdentifierPropertyName *expression) override;
535 bool visit(AST::NumericLiteralPropertyName *expression) override;
536 bool visit(AST::StringLiteralPropertyName *expression) override;
537 bool visit(AST::TypeAnnotation *expression) override;
538
539 void throwRecursionDepthError() override;
540
542 {
543 return !scriptNodeStack.isEmpty() && !scriptNodeStack.last().isList();
544 }
546 {
547 return !scriptNodeStack.isEmpty() && scriptNodeStack.last().isList();
548 }
549
550private:
551 template<typename T>
552 void endVisitForLists(T *list, const std::function<int(T *)> &scriptElementsPerEntry = {});
553
554public:
556};
557
559{
560public:
562 QQmlJSLogger *logger, QQmlJSImporter *importer);
563
564#define X(name) \
565 bool visit(AST::name *) override; \
566 void endVisit(AST::name *) override;
568#undef X
569
570 virtual void throwRecursionDepthError() override;
577 {
578 m_enableScriptExpressions = enable;
579 m_domCreator.enableScriptExpressions(enable);
580 }
581
582 void enableLoadFileLazily(bool enable = true)
583 {
584 m_loadFileLazily = enable;
585 m_domCreator.enableLoadFileLazily(enable);
586 }
587
588 QQmlJSImportVisitor &scopeCreator() { return m_scopeCreator; }
589
590private:
591 void setScopeInDomAfterEndvisit();
592 void setScopeInDomBeforeEndvisit();
593
594 template<typename U, typename... V>
595 using IsInList = std::disjunction<std::is_same<U, V>...>;
596 template<typename U>
597 using RequiresCustomIteration =
600
601 enum VisitorKind : bool { DomCreator, ScopeCreator };
607 struct InactiveVisitorMarker
608 {
610 AST::Node::Kind nodeKind;
611 VisitorKind inactiveVisitorKind;
612
613 VisitorKind stillActiveVisitorKind() const
614 {
615 return inactiveVisitorKind == DomCreator ? ScopeCreator : DomCreator;
616 }
617 };
618
619 template<typename T>
620 void customListIteration(T *t)
621 {
622 static_assert(RequiresCustomIteration<T>::value);
623 for (T* it = t; it; it = it->next) {
624 if constexpr (std::is_same_v<T, AST::PatternElementList>) {
625 AST::Node::accept(it->elision, this);
626 AST::Node::accept(it->element, this);
627 } else if constexpr (std::is_same_v<T, AST::PatternPropertyList>) {
628 AST::Node::accept(it->property, this);
629 } else if constexpr (std::is_same_v<T, AST::FormalParameterList>) {
630 AST::Node::accept(it->element, this);
631 } else if constexpr (std::is_same_v<T, AST::VariableDeclarationList>) {
632 AST::Node::accept(it->declaration, this);
633 } else if constexpr (std::is_same_v<T, AST::ArgumentList>) {
634 AST::Node::accept(it->expression, this);
635 } else if constexpr (std::is_same_v<T, AST::PatternElementList>) {
636 AST::Node::accept(it->elision, this);
637 AST::Node::accept(it->element, this);
638 } else {
639 Q_UNREACHABLE();
640 }
641 }
642 }
643
644 static void initMarkerForActiveVisitor(std::optional<InactiveVisitorMarker> &inactiveVisitorMarker,
645 AST::Node::Kind nodeKind, bool continueForDom)
646 {
647 inactiveVisitorMarker.emplace();
648 inactiveVisitorMarker->inactiveVisitorKind = continueForDom ? ScopeCreator : DomCreator;
649 inactiveVisitorMarker->count = 1;
650 inactiveVisitorMarker->nodeKind = nodeKind;
651 };
652
653 template<typename T>
654 bool performListIterationIfRequired(T *t)
655 {
656 if constexpr (RequiresCustomIteration<T>::value) {
657 customListIteration(t);
658 return false;
659 }
660 Q_UNUSED(t);
661 return true;
662 }
663
664 template<typename T>
665 bool visitT(T *t)
666 {
667 const auto handleVisitResult = [this, t](const bool continueVisit) {
668 if (m_inactiveVisitorMarker && m_inactiveVisitorMarker->nodeKind == t->kind)
669 m_inactiveVisitorMarker->count += 1;
670
671 if (continueVisit)
672 return performListIterationIfRequired(t);
673 return continueVisit;
674 };
675
676 // first case: no marker, both can visit
677 if (!m_inactiveVisitorMarker) {
678 bool continueForDom = m_domCreator.visit(t);
679 bool continueForScope = m_scopeCreator.visit(t);
680 if (!continueForDom && !continueForScope)
681 return false;
682 else if (continueForDom ^ continueForScope) {
683 initMarkerForActiveVisitor(m_inactiveVisitorMarker, AST::Node::Kind(t->kind),
684 continueForDom);
685 return performListIterationIfRequired(t);
686 } else {
687 Q_ASSERT(continueForDom && continueForScope);
688 return performListIterationIfRequired(t);
689 }
690 Q_UNREACHABLE();
691 }
692
693 // second case: a marker, just one visit
694 switch (m_inactiveVisitorMarker->stillActiveVisitorKind()) {
695 case DomCreator:
696 return handleVisitResult(m_domCreator.visit(t));
697 case ScopeCreator:
698 return handleVisitResult(m_scopeCreator.visit(t));
699 };
700 Q_UNREACHABLE();
701 }
702
703 template<typename T>
704 void endVisitT(T *t)
705 {
706 if (m_inactiveVisitorMarker && m_inactiveVisitorMarker->nodeKind == t->kind) {
707 m_inactiveVisitorMarker->count -= 1;
708 if (m_inactiveVisitorMarker->count == 0)
709 m_inactiveVisitorMarker.reset();
710 }
711 if (m_inactiveVisitorMarker) {
712 switch (m_inactiveVisitorMarker->stillActiveVisitorKind()) {
713 case DomCreator:
714 m_domCreator.endVisit(t);
715 return;
716 case ScopeCreator:
717 m_scopeCreator.endVisit(t);
718 return;
719 };
720 Q_UNREACHABLE();
721 }
722
723 setScopeInDomBeforeEndvisit();
724 m_domCreator.endVisit(t);
725 setScopeInDomAfterEndvisit();
726 m_scopeCreator.endVisit(t);
727 }
728
729 QQmlJSScope::Ptr m_root;
730 QQmlJSLogger *m_logger = nullptr;
731 QQmlJSImporter *m_importer = nullptr;
732 QString m_implicitImportDirectory;
733 QQmlJSImportVisitor m_scopeCreator;
734 QQmlDomAstCreator m_domCreator;
735
736 std::optional<InactiveVisitorMarker> m_inactiveVisitorMarker;
737 bool m_enableScriptExpressions = false;
738 bool m_loadFileLazily = false;
739};
740
741} // end namespace Dom
742} // end namespace QQmlJS
743
745#endif // QQMLDOMASTCREATOR_P_H
void endVisit(QQmlJS::AST::ExpressionStatement *ast) override
bool visit(QQmlJS::AST::StringLiteral *) override
void accept(BaseVisitor *visitor)
std::shared_ptr< AttachedInfoT< FileLocations > > Tree
index_type headIndex(index_type defaultValue=-1) const
Path last() const
virtual QQmlJSASTClassListToVisit void throwRecursionDepthError() override
QQmlDomAstCreatorWithQQmlJSScope(const QQmlJSScope::Ptr &current, MutableDomItem &qmlFile, QQmlJSLogger *logger, QQmlJSImporter *importer)
void endVisit(AST::UiProgram *) override
void enableLoadFileLazily(bool enable=true)
void endVisitHelper(AST::PatternElement *pe, const std::shared_ptr< ScriptElements::GenericScriptElement > &element)
void enableScriptExpressions(bool enable=true)
QQmlDomAstCreator(const MutableDomItem &qmlFile)
bool visit(AST::UiProgram *program) override
void loadAnnotations(AST::UiObjectMember *el)
Use this to contain any script element.
static ScriptElementVariant fromElement(const T &element)
\inmodule QtCore
Definition qstringview.h:78
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QSet< QString >::iterator it
qint64 index_type
Combined button and popup list for selecting options.
#define Q_DECLARE_TR_FUNCTIONS(context)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLint location
GLint GLint GLint GLint GLint x
[0]
GLenum GLenum GLsizei count
GLenum type
GLboolean enable
GLuint program
GLfloat n
GLhandleARB obj
[2]
GLdouble s
[6]
Definition qopenglext.h:235
GLdouble GLdouble t
Definition qopenglext.h:243
GLsizei const GLchar *const * path
GLfloat GLfloat p
[1]
#define QQmlJSASTClassListToVisit
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
#define Q_ASSERT_X(cond, x, msg)
Definition qrandom.cpp:48
#define Q_UNUSED(x)
ptrdiff_t qsizetype
Definition qtypes.h:165
static const uint base
Definition qurlidna.cpp:20
QList< int > list
[14]
QGraphicsItem * item
QStringView el