Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
F
flatpak-qt-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
e20bfaed
Commit
e20bfaed
authored
Sep 27, 2010
by
Christian Kamm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QmlJS indenter: Fix break/continue/throw in if statement without braces.
Reviewed-by: Roberto Raggi
parent
5f020eeb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
0 deletions
+30
-0
src/libs/qmljs/qmljscodeformatter.cpp
src/libs/qmljs/qmljscodeformatter.cpp
+8
-0
src/libs/qmljs/qmljscodeformatter.h
src/libs/qmljs/qmljscodeformatter.h
+1
-0
tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp
...o/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp
+21
-0
No files found.
src/libs/qmljs/qmljscodeformatter.cpp
View file @
e20bfaed
...
...
@@ -643,6 +643,14 @@ bool CodeFormatter::tryStatement()
enter
(
empty_statement
);
leave
(
true
);
return
true
;
case
Break
:
case
Continue
:
leave
(
true
);
return
true
;
case
Throw
:
enter
(
throw_statement
);
enter
(
expression
);
return
true
;
case
Return
:
enter
(
return_statement
);
enter
(
expression
);
...
...
src/libs/qmljs/qmljscodeformatter.h
View file @
e20bfaed
...
...
@@ -156,6 +156,7 @@ public: // must be public to make Q_GADGET introspection work
substatement_open
,
// The brace that opens a substatement block.
return_statement
,
// After 'return'
throw_statement
,
// After 'throw'
statement_with_condition
,
// After the 'for', 'while', 'catch', ... token
statement_with_condition_paren_open
,
// While inside the (...)
...
...
tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp
View file @
e20bfaed
...
...
@@ -50,6 +50,7 @@ private Q_SLOTS:
// void whitesmithsStyle();
void
expressionContinuation
();
void
objectLiteral
();
void
keywordStatement
();
};
struct
Line
{
...
...
@@ -896,6 +897,26 @@ void tst_QMLCodeFormatter::objectLiteral()
checkIndent
(
data
);
}
void
tst_QMLCodeFormatter
::
keywordStatement
()
{
QList
<
Line
>
data
;
data
<<
Line
(
"function shuffle() {"
)
<<
Line
(
" if (1)"
)
<<
Line
(
" break"
)
<<
Line
(
" if (1)"
)
<<
Line
(
" continue"
)
<<
Line
(
" if (1)"
)
<<
Line
(
" throw 1"
)
<<
Line
(
" if (1)"
)
<<
Line
(
" return"
)
<<
Line
(
" if (1)"
)
<<
Line
(
" return 1"
)
<<
Line
(
" var x = 2"
)
<<
Line
(
"}"
)
;
checkIndent
(
data
);
}
QTEST_APPLESS_MAIN
(
tst_QMLCodeFormatter
)
#include "tst_qmlcodeformatter.moc"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment