diff --git a/src/libs/qmljs/qmljscodeformatter.cpp b/src/libs/qmljs/qmljscodeformatter.cpp
index 0da48216b3e7246f6d582bd51cb75f55d82f9d8c..3213cf31e2fe5bc1cb2abf2918d14cdb6320a161 100644
--- a/src/libs/qmljs/qmljscodeformatter.cpp
+++ b/src/libs/qmljs/qmljscodeformatter.cpp
@@ -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);
diff --git a/src/libs/qmljs/qmljscodeformatter.h b/src/libs/qmljs/qmljscodeformatter.h
index b4a0855546ef887c34cbbc642d51ea267e7f7c0d..aad77a5f527ff58ceaf96a3651cfe940c96f31ac 100644
--- a/src/libs/qmljs/qmljscodeformatter.h
+++ b/src/libs/qmljs/qmljscodeformatter.h
@@ -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 (...)
diff --git a/tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp b/tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp
index 7c5cf69784247b5c46bd46c065a5b2885e6418f8..5e1f4c29e70c1b663bef5d368ffb244435fd2d98 100644
--- a/tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp
+++ b/tests/auto/qml/qmleditor/qmlcodeformatter/tst_qmlcodeformatter.cpp
@@ -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"