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.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/declarative/qml/qmlrewrite.cpp b/src/declarative/qml/qmlrewrite.cpp
index 32e2fef..2964a75 100644
--- a/src/declarative/qml/qmlrewrite.cpp
+++ b/src/declarative/qml/qmlrewrite.cpp
@@ -49,6 +49,22 @@ DEFINE_BOOL_CONFIG_OPTION(rewriteDump, QML_REWRITE_DUMP);
namespace QmlRewrite {
+bool SharedBindingTester::isSharable(const QString &code)
+{
+ Engine engine;
+ NodePool pool(QString(), &engine);
+ Lexer lexer(&engine);
+ Parser parser(&engine);
+ lexer.setCode(code, 0);
+ parser.parseStatement();
+ if (!parser.statement())
+ return false;
+
+ _sharable = true;
+ AST::Node::acceptChild(parser.statement(), this);
+ return _sharable;
+}
+
QString RewriteBinding::operator()(const QString &code, bool *ok)
{
Engine engine;