summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml/qmlrewrite.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/qml/qmlrewrite.cpp')
-rw-r--r--src/declarative/qml/qmlrewrite.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/declarative/qml/qmlrewrite.cpp b/src/declarative/qml/qmlrewrite.cpp
index b86f2f2..32e2fef 100644
--- a/src/declarative/qml/qmlrewrite.cpp
+++ b/src/declarative/qml/qmlrewrite.cpp
@@ -49,7 +49,7 @@ DEFINE_BOOL_CONFIG_OPTION(rewriteDump, QML_REWRITE_DUMP);
namespace QmlRewrite {
-QString RewriteBinding::operator()(const QString &code)
+QString RewriteBinding::operator()(const QString &code, bool *ok)
{
Engine engine;
NodePool pool(QString(), &engine);
@@ -57,6 +57,12 @@ QString RewriteBinding::operator()(const QString &code)
Parser parser(&engine);
lexer.setCode(code, 0);
parser.parseStatement();
+ if (!parser.statement()) {
+ if (ok) *ok = false;
+ return QString();
+ } else {
+ if (ok) *ok = true;
+ }
return rewrite(code, 0, parser.statement());
}