diff options
Diffstat (limited to 'src/qml/qml/qqmlrewrite_p.h')
-rw-r--r-- | src/qml/qml/qqmlrewrite_p.h | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlrewrite_p.h b/src/qml/qml/qqmlrewrite_p.h index 1d69839878..efa10ce316 100644 --- a/src/qml/qml/qqmlrewrite_p.h +++ b/src/qml/qml/qqmlrewrite_p.h @@ -70,9 +70,11 @@ public: bool isSharable(const QString &code); bool isSharable(AST::Node *Node); - virtual bool visit(AST::FunctionDeclaration *) { _sharable = false; return false; } - virtual bool visit(AST::FunctionExpression *) { _sharable = false; return false; } - virtual bool visit(AST::CallExpression *) { _sharable = false; return false; } + inline virtual bool visit(AST::FunctionDeclaration *); + inline virtual bool visit(AST::FunctionExpression *); + inline virtual bool visit(AST::IdentifierExpression *); + + static QString evalString; }; class RewriteBinding: protected AST::Visitor @@ -133,6 +135,7 @@ class RewriteSignalHandler: protected AST::Visitor public: RewriteSignalHandler(); QString operator()(QQmlJS::AST::Node *node, const QString &code, const QString &name); + QString operator()(const QString &code, const QString &name, bool *ok = 0); protected: void rewriteMultilineStrings(QString &code); @@ -142,6 +145,26 @@ protected: virtual bool visit(AST::StringLiteral *ast); }; +bool SharedBindingTester::visit(AST::FunctionDeclaration *) +{ + _sharable = false; + return false; +} + +bool SharedBindingTester::visit(AST::FunctionExpression *) +{ + _sharable = false; + return false; +} + +bool SharedBindingTester::visit(AST::IdentifierExpression *e) +{ + if (e->name == evalString) + _sharable = false; + + return false; // IdentifierExpression is a leaf node anyway +} + } // namespace QQmlRewrite QT_END_NAMESPACE |