summaryrefslogtreecommitdiff
path: root/src/libs
diff options
context:
space:
mode:
authorUladzislau Paulovich <selatnick@gmail.com>2019-06-09 03:31:20 +0300
committerselatnick <selatnick@gmail.com>2019-06-11 10:04:29 +0000
commitab87bdf4ea400c9c3f643fcd4a0aea500be31398 (patch)
treeb7645b02ee8f3b96f742612a7077f0c35c8295e5 /src/libs
parent69cd74f25d28b0fda0db6a958dd34f8c7daab5ca (diff)
downloadqt-creator-ab87bdf4ea400c9c3f643fcd4a0aea500be31398.tar.gz
qml | Add support for enums formatting
Change-Id: Id7e435a7c556c7fc469b9055ca772a7850e16676 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r--src/libs/qmljs/qmljsreformatter.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/libs/qmljs/qmljsreformatter.cpp b/src/libs/qmljs/qmljsreformatter.cpp
index 3d838651e2..9489853247 100644
--- a/src/libs/qmljs/qmljsreformatter.cpp
+++ b/src/libs/qmljs/qmljsreformatter.cpp
@@ -534,6 +534,37 @@ protected:
return false;
}
+ bool visit(UiEnumDeclaration *ast) override
+ {
+ out(ast->enumToken);
+ out(" ");
+ out(ast->name.toString());
+ out(" ");
+ out("{"); // TODO: out(ast->lbraceToken);
+ newLine();
+
+ accept(ast->members);
+
+ out(ast->rbraceToken);
+ return false;
+ }
+
+ bool visit(UiEnumMemberList *list) override
+ {
+ for (UiEnumMemberList *it = list; it; it = it->next) {
+ out(it->memberToken);
+ if (it->valueToken.isValid()) {
+ out(" = ");
+ out(it->valueToken);
+ }
+ if (it->next) {
+ out(",");
+ }
+ newLine();
+ }
+ return false;
+ }
+
bool visit(UiImport *ast) override
{
out("import ", ast->importToken);