diff options
Diffstat (limited to 'tools/qmlformat/dumpastvisitor.cpp')
-rw-r--r-- | tools/qmlformat/dumpastvisitor.cpp | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/qmlformat/dumpastvisitor.cpp b/tools/qmlformat/dumpastvisitor.cpp index ef6e234cc3..3ad66bc6a1 100644 --- a/tools/qmlformat/dumpastvisitor.cpp +++ b/tools/qmlformat/dumpastvisitor.cpp @@ -1024,6 +1024,47 @@ QHash<QString, UiObjectMember*> findBindings(UiObjectMemberList *list) { return bindings; } +bool DumpAstVisitor::visit(UiInlineComponent *node) +{ + if (scope().m_firstObject) { + if (scope().m_firstOfAll) + scope().m_firstOfAll = false; + else + addNewLine(); + + scope().m_firstObject = false; + } + + addLine(getComment(node, Comment::Location::Front)); + addLine(getComment(node, Comment::Location::Front_Inline)); + addLine("component " + node->name + ": " + + parseUiQualifiedId(node->component->qualifiedTypeNameId) + " {"); + + m_indentLevel++; + + ScopeProperties props; + props.m_bindings = findBindings(node->component->initializer->members); + m_scope_properties.push(props); + + m_result += getOrphanedComments(node); + + return true; +} + +void DumpAstVisitor::endVisit(UiInlineComponent *node) +{ + m_indentLevel--; + + m_scope_properties.pop(); + + bool need_comma = scope().m_inArrayBinding && scope().m_lastInArrayBinding != node; + + addLine(need_comma ? "}," : "}"); + addLine(getComment(node, Comment::Location::Back)); + if (!scope().m_inArrayBinding) + addNewLine(); +} + bool DumpAstVisitor::visit(UiObjectDefinition *node) { if (scope().m_firstObject) { if (scope().m_firstOfAll) |