diff options
Diffstat (limited to 'tools/qmlformat/dumpastvisitor.cpp')
-rw-r--r-- | tools/qmlformat/dumpastvisitor.cpp | 47 |
1 files changed, 10 insertions, 37 deletions
diff --git a/tools/qmlformat/dumpastvisitor.cpp b/tools/qmlformat/dumpastvisitor.cpp index ada713aa9d..008f10ae17 100644 --- a/tools/qmlformat/dumpastvisitor.cpp +++ b/tools/qmlformat/dumpastvisitor.cpp @@ -1071,45 +1071,10 @@ QHash<QString, UiObjectMember*> findBindings(UiObjectMemberList *list) { 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); - + m_component_name = node->name.toString(); 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) @@ -1122,7 +1087,15 @@ bool DumpAstVisitor::visit(UiObjectDefinition *node) { addLine(getComment(node, Comment::Location::Front)); addLine(getComment(node, Comment::Location::Front_Inline)); - addLine(parseUiQualifiedId(node->qualifiedTypeNameId) + " {"); + + QString component = ""; + + if (!m_component_name.isEmpty()) { + component = "component "+m_component_name+": "; + m_component_name = ""; + } + + addLine(component + parseUiQualifiedId(node->qualifiedTypeNameId) + " {"); m_indentLevel++; |