From be4f0622f8c0d89371e9314e2d53c246dd77871b Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Fri, 24 May 2013 12:10:46 +0200 Subject: Remove the remaining dependencies onto the binding rewriter Remove the remaining places that were rewriting bindings. Remove the binding rewriter class. Change-Id: Ib1e9121dc10f4526ddb7cf0ae32fecd8ce2d4993 Reviewed-by: Simon Hausmann --- src/qml/debugger/qqmlenginedebugservice.cpp | 2 +- src/qml/qml/qqmlbinding.cpp | 12 +- src/qml/qml/qqmlbinding_p.h | 2 +- src/qml/qml/qqmlcompiler.cpp | 33 +--- src/qml/qml/qqmlcompiler_p.h | 10 +- src/qml/qml/qqmlcustomparser.cpp | 5 +- src/qml/qml/qqmlcustomparser_p.h | 2 +- src/qml/qml/qqmlexpression.cpp | 15 +- src/qml/qml/qqmlexpression_p.h | 3 +- src/qml/qml/qqmlrewrite.cpp | 271 ---------------------------- src/qml/qml/qqmlrewrite_p.h | 52 ------ src/qml/qml/qqmlscript.cpp | 1 - src/qml/qml/qqmlvme.cpp | 2 +- src/quick/qtquick2.cpp | 2 +- src/quick/util/qquickpropertychanges.cpp | 5 +- 15 files changed, 30 insertions(+), 387 deletions(-) diff --git a/src/qml/debugger/qqmlenginedebugservice.cpp b/src/qml/debugger/qqmlenginedebugservice.cpp index bf52c42d54..65f7419ee3 100644 --- a/src/qml/debugger/qqmlenginedebugservice.cpp +++ b/src/qml/debugger/qqmlenginedebugservice.cpp @@ -626,7 +626,7 @@ bool QQmlEngineDebugService::setBinding(int objectId, false, filename, line, column); QQmlPropertyPrivate::takeSignalExpression(property, qmlExpression); } else if (property.isProperty()) { - QQmlBinding *binding = new QQmlBinding(expression.toString(), false, object, QQmlContextData::get(context), filename, line, column);; + QQmlBinding *binding = new QQmlBinding(expression.toString(), object, QQmlContextData::get(context), filename, line, column);; binding->setTarget(property); QQmlAbstractBinding *oldBinding = QQmlPropertyPrivate::setBinding(property, binding); if (oldBinding) diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index 936c63f35e..209fac531d 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -49,7 +49,6 @@ #include #include #include -#include #include #include @@ -86,7 +85,7 @@ QQmlBinding::createBinding(Identifier id, QObject *obj, QQmlContext *ctxt, Q_ASSERT(typeData); if (QQmlCompiledData *cdata = typeData->compiledData()) { - rv = new QQmlBinding(cdata->primitives.at(id), true, obj, ctxtdata, url, lineNumber, 0); + rv = new QQmlBinding(cdata->primitives.at(id), obj, ctxtdata, url, lineNumber, 0); } typeData->release(); @@ -134,7 +133,7 @@ QQmlBinding::QQmlBinding(const QQmlScriptString &script, QObject *obj, QQmlConte Q_ASSERT(typeData); if (QQmlCompiledData *cdata = typeData->compiledData()) { - needRewrite = false; + needRewrite = true; code = cdata->primitives.at(id); m_url = cdata->name; } @@ -169,7 +168,7 @@ QQmlBinding::QQmlBinding(const QString &str, QObject *obj, QQmlContextData *ctxt v4function = qmlBinding(ctxt, obj, str, QString(), 0); } -QQmlBinding::QQmlBinding(const QString &str, bool isRewritten, QObject *obj, +QQmlBinding::QQmlBinding(const QString &str, QObject *obj, QQmlContextData *ctxt, const QString &url, quint16 lineNumber, quint16 columnNumber) : QQmlJavaScriptExpression(&QQmlBinding_jsvtable), QQmlAbstractBinding(Binding), @@ -181,10 +180,7 @@ QQmlBinding::QQmlBinding(const QString &str, bool isRewritten, QObject *obj, m_expression = str.toUtf8(); - if (isRewritten) - v4function = evalFunction(ctxt, obj, str, url, m_lineNumber); - else - v4function = qmlBinding(ctxt, obj, str, url, m_lineNumber); + v4function = qmlBinding(ctxt, obj, str, url, m_lineNumber); } /*! diff --git a/src/qml/qml/qqmlbinding_p.h b/src/qml/qml/qqmlbinding_p.h index f2a4bf293e..87e9d5eb4e 100644 --- a/src/qml/qml/qqmlbinding_p.h +++ b/src/qml/qml/qqmlbinding_p.h @@ -82,7 +82,7 @@ public: QQmlBinding(const QString &, QObject *, QQmlContext *); QQmlBinding(const QQmlScriptString &, QObject *, QQmlContext *); QQmlBinding(const QString &, QObject *, QQmlContextData *); - QQmlBinding(const QString &, bool isRewritten, QObject *, QQmlContextData *, + QQmlBinding(const QString &, QObject *, QQmlContextData *, const QString &url, quint16 lineNumber, quint16 columnNumber); QQmlBinding(void *, QObject *, QQmlContextData *, const QString &url, quint16 lineNumber, quint16 columnNumber); diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp index 7b5f195fc7..07a29e5a63 100644 --- a/src/qml/qml/qqmlcompiler.cpp +++ b/src/qml/qml/qqmlcompiler.cpp @@ -1247,8 +1247,7 @@ void QQmlCompiler::genObjectBody(QQmlScript::Object *obj) ss.propertyIndex = prop->index; ss.value = output->indexForString(script); ss.scope = prop->scriptStringScope; -// ss.bindingId = rewriteBinding(script, prop->name()); - ss.bindingId = rewriteBinding(prop->values.first()->value, QString()); // XXX + ss.bindingId = output->indexForString(prop->values.first()->value.asScript()); ss.line = prop->location.start.line; ss.column = prop->location.start.column; ss.isStringLiteral = prop->values.first()->value.isString(); @@ -2280,7 +2279,6 @@ bool QQmlCompiler::buildListProperty(QQmlScript::Property *prop, assignedBinding = true; COMPILE_CHECK(buildBinding(v, prop, ctxt)); - v->type = Value::PropertyBinding; } else { COMPILE_EXCEPTION(v, tr("Cannot assign primitives to lists")); } @@ -2487,8 +2485,6 @@ bool QQmlCompiler::buildPropertyLiteralAssignment(QQmlScript::Property *prop, if (!buildLiteralBinding(v, prop, ctxt)) COMPILE_CHECK(buildBinding(v, prop, ctxt)); - v->type = Value::PropertyBinding; - } else { COMPILE_CHECK(testLiteralAssignment(prop, v)); @@ -2620,16 +2616,9 @@ const QMetaObject *QQmlCompiler::resolveType(const QString& name) const return qmltype->metaObject(); } -// similar to logic of completeComponentBuild, but also sticks data -// into primitives at the end -int QQmlCompiler::rewriteBinding(const QQmlScript::Variant& value, const QString& name) +int QQmlCompiler::bindingIdentifier(const Variant &value) { - QQmlRewrite::RewriteBinding rewriteBinding; - rewriteBinding.setName(QLatin1Char('$') + name.mid(name.lastIndexOf(QLatin1Char('.')) + 1)); - - QString rewrite = rewriteBinding(value.asAST(), value.asScript(), 0); - - return output->indexForString(rewrite); + return output->indexForString(value.asScript()); } QString QQmlCompiler::rewriteSignalHandler(const QQmlScript::Variant& value, const QString &name) @@ -3413,6 +3402,7 @@ bool QQmlCompiler::buildBinding(QQmlScript::Value *value, reference->value = value; reference->bindingContext = ctxt; addBindingReference(reference); + value->type = Value::PropertyBinding; return true; } @@ -3450,6 +3440,7 @@ bool QQmlCompiler::buildLiteralBinding(QQmlScript::Value *v, reference->text = text; reference->n = n; v->bindingReference = reference; + v->type = Value::PropertyBinding; return true; } @@ -3478,6 +3469,7 @@ bool QQmlCompiler::buildLiteralBinding(QQmlScript::Value *v, reference->comment = comment; reference->n = n; v->bindingReference = reference; + v->type = Value::PropertyBinding; return true; } @@ -3524,7 +3516,7 @@ void QQmlCompiler::genBindingAssignment(QQmlScript::Value *binding, const JSBindingReference &js = static_cast(ref); Instruction::StoreBinding store; - store.value = output->indexForString(js.rewrittenExpression); + store.value = output->indexForString(js.expression.asScript()); store.context = js.bindingContext.stack; store.owner = js.bindingContext.owner; store.line = binding->location.start.line; @@ -3587,17 +3579,6 @@ bool QQmlCompiler::completeComponentBuild() for (JSBindingReference *b = compileState->bindings.first(); b; b = b->nextReference) { JSBindingReference &binding = *b; - - // Pre-rewrite the expression - QString expression = binding.expression.asScript(); - - QQmlRewrite::RewriteBinding rewriteBinding; - rewriteBinding.setName(QLatin1Char('$')+binding.property->name().toString()); - bool isSharable = false; - bool isSafe = false; - binding.rewrittenExpression = rewriteBinding(binding.expression.asAST(), expression, &isSharable, &isSafe); - binding.isSafe = isSafe; - binding.dataType = BindingReference::QtScript; if (componentStats) diff --git a/src/qml/qml/qqmlcompiler_p.h b/src/qml/qml/qqmlcompiler_p.h index 1b2796248e..70155f9039 100644 --- a/src/qml/qml/qqmlcompiler_p.h +++ b/src/qml/qml/qqmlcompiler_p.h @@ -195,17 +195,15 @@ namespace QQmlCompilerTypes { struct JSBindingReference : public QQmlPool::Class, public BindingReference { - JSBindingReference() : isSafe(false), nextReference(0) {} + JSBindingReference() : nextReference(0) {} QQmlScript::Variant expression; QQmlScript::Property *property; QQmlScript::Value *value; - int compiledIndex:15; - int sharedIndex:15; - bool isSafe:1; + int compiledIndex : 16; + int sharedIndex : 16; - QString rewrittenExpression; BindingContext bindingContext; JSBindingReference *nextReference; @@ -297,7 +295,7 @@ public: int evaluateEnum(const QHashedStringRef &scope, const QByteArray& enumValue, bool *ok) const; // for QQmlCustomParser::evaluateEnum const QMetaObject *resolveType(const QString& name) const; // for QQmlCustomParser::resolveType - int rewriteBinding(const QQmlScript::Variant& value, const QString& name); // for QQmlCustomParser::rewriteBinding + int bindingIdentifier(const QQmlScript::Variant& value); // for QQmlCustomParser::bindingIndex QString rewriteSignalHandler(const QQmlScript::Variant& value, const QString &name); // for QQmlCustomParser::rewriteSignalHandler private: diff --git a/src/qml/qml/qqmlcustomparser.cpp b/src/qml/qml/qqmlcustomparser.cpp index e2ec48f30d..3787c34ac6 100644 --- a/src/qml/qml/qqmlcustomparser.cpp +++ b/src/qml/qml/qqmlcustomparser.cpp @@ -311,9 +311,10 @@ const QMetaObject *QQmlCustomParser::resolveType(const QString& name) const used to construct the binding later. \a name is used as the name of the rewritten function. */ -QQmlBinding::Identifier QQmlCustomParser::rewriteBinding(const QQmlScript::Variant &value, const QString& name) +QQmlBinding::Identifier QQmlCustomParser::bindingIdentifier(const QQmlScript::Variant &value, const QString& name) { - return compiler->rewriteBinding(value, name); + Q_UNUSED(name); + return compiler->bindingIdentifier(value); } /*! diff --git a/src/qml/qml/qqmlcustomparser_p.h b/src/qml/qml/qqmlcustomparser_p.h index 7a3fd47b46..038badae22 100644 --- a/src/qml/qml/qqmlcustomparser_p.h +++ b/src/qml/qml/qqmlcustomparser_p.h @@ -139,7 +139,7 @@ protected: const QMetaObject *resolveType(const QString&) const; - QQmlBinding::Identifier rewriteBinding(const QQmlScript::Variant&, const QString&); + QQmlBinding::Identifier bindingIdentifier(const QQmlScript::Variant&, const QString&); QString rewriteSignalHandler(const QQmlScript::Variant&, const QString&); private: diff --git a/src/qml/qml/qqmlexpression.cpp b/src/qml/qml/qqmlexpression.cpp index 419ea86ad9..2f2bee6dea 100644 --- a/src/qml/qml/qqmlexpression.cpp +++ b/src/qml/qml/qqmlexpression.cpp @@ -45,7 +45,6 @@ #include "qqmlglobal_p.h" #include "qqmlengine_p.h" #include "qqmlcontext_p.h" -#include "qqmlrewrite_p.h" #include "qqmlscriptstring_p.h" #include "qqmlcompiler_p.h" @@ -60,7 +59,7 @@ static QQmlJavaScriptExpression::VTable QQmlExpressionPrivate_jsvtable = { QQmlExpressionPrivate::QQmlExpressionPrivate() : QQmlJavaScriptExpression(&QQmlExpressionPrivate_jsvtable), - expressionFunctionValid(true), expressionFunctionRewritten(false), + expressionFunctionValid(true), line(0), column(0) { } @@ -76,11 +75,10 @@ void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr, QOb QQmlAbstractExpression::setContext(ctxt); setScopeObject(me); expressionFunctionValid = false; - expressionFunctionRewritten = false; } void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr, - bool isRewritten, QObject *me, const QString &srcUrl, + QObject *me, const QString &srcUrl, quint16 lineNumber, quint16 columnNumber) { url = srcUrl; @@ -90,7 +88,6 @@ void QQmlExpressionPrivate::init(QQmlContextData *ctxt, const QString &expr, expression = expr; expressionFunctionValid = false; - expressionFunctionRewritten = isRewritten; QQmlAbstractExpression::setContext(ctxt); setScopeObject(me); @@ -172,7 +169,7 @@ QQmlExpression::QQmlExpression(const QQmlScriptString &script, QQmlContext *ctxt if (QQmlCompiledData *cdata = typeData->compiledData()) { defaultConstruction = false; - d->init(evalCtxtData, cdata->primitives.at(id), true, scopeObject, + d->init(evalCtxtData, cdata->primitives.at(id), scopeObject, cdata->name, scriptPrivate->lineNumber, scriptPrivate->columnNumber); } @@ -259,17 +256,13 @@ void QQmlExpression::setExpression(const QString &expression) d->resetNotifyOnValueChanged(); d->expression = expression; d->expressionFunctionValid = false; - d->expressionFunctionRewritten = false; } // Must be called with a valid handle scope v8::Handle QQmlExpressionPrivate::v8value(bool *isUndefined) { if (!expressionFunctionValid) { - if (expressionFunctionRewritten) - v8function = evalFunction(context(), scopeObject(), expression, url, line, &v8qmlscope); - else - v8function = qmlBinding(context(), scopeObject(), expression, url, line, &v8qmlscope); + v8function = qmlBinding(context(), scopeObject(), expression, url, line, &v8qmlscope); setUseSharedContext(false); expressionFunctionValid = true; } diff --git a/src/qml/qml/qqmlexpression_p.h b/src/qml/qml/qqmlexpression_p.h index 0c407a2367..d0e819f7c3 100644 --- a/src/qml/qml/qqmlexpression_p.h +++ b/src/qml/qml/qqmlexpression_p.h @@ -79,7 +79,7 @@ public: ~QQmlExpressionPrivate(); void init(QQmlContextData *, const QString &, QObject *); - void init(QQmlContextData *, const QString &, bool, QObject *, const QString &, quint16, quint16); + void init(QQmlContextData *, const QString &, QObject *, const QString &, quint16, quint16); QVariant value(bool *isUndefined = 0); @@ -91,7 +91,6 @@ public: void _q_notify(); bool expressionFunctionValid:1; - bool expressionFunctionRewritten:1; // "Inherited" from QQmlJavaScriptExpression static QString expressionIdentifier(QQmlJavaScriptExpression *); diff --git a/src/qml/qml/qqmlrewrite.cpp b/src/qml/qml/qqmlrewrite.cpp index 0e281428ed..af168f7c48 100644 --- a/src/qml/qml/qqmlrewrite.cpp +++ b/src/qml/qml/qqmlrewrite.cpp @@ -196,277 +196,6 @@ bool SharedBindingTester::visit(AST::BinaryExpression *e) return true; } -QString RewriteBinding::operator()(const QString &code, bool *ok, bool *sharable, bool *safe) -{ - Engine engine; - Lexer lexer(&engine); - Parser parser(&engine); - lexer.setCode(code, 0); - parser.parseStatement(); - if (!parser.statement()) { - if (ok) *ok = false; - return QString(); - } else { - if (ok) *ok = true; - if (sharable || safe) { - SharedBindingTester tester; - tester.parse(parser.statement()); - if (sharable) *sharable = tester.isSharable(); - if (safe) *safe = tester.isSafe(); - } - } - return rewrite(code, 0, parser.statement()); -} - -QString RewriteBinding::operator()(QQmlJS::AST::Node *node, const QString &code, bool *sharable, bool *safe) -{ - if (!node) - return code; - - if (sharable || safe) { - SharedBindingTester tester; - tester.parse(node); - if (sharable) *sharable = tester.isSharable(); - if (safe) *safe = tester.isSafe(); - } - - QQmlJS::AST::ExpressionNode *expression = node->expressionCast(); - QQmlJS::AST::Statement *statement = node->statementCast(); - if(!expression && !statement) - return code; - - TextWriter w; - _writer = &w; - _position = expression ? expression->firstSourceLocation().begin() : statement->firstSourceLocation().begin(); - _inLoop = 0; - _code = &code; - - accept(node); - - unsigned startOfStatement = 0; - unsigned endOfStatement = (expression ? expression->lastSourceLocation().end() : statement->lastSourceLocation().end()) - _position; - - QString startString = QLatin1String("(function ") + _name + QLatin1String("() { "); - if (expression) - startString += QLatin1String("return "); - _writer->replace(startOfStatement, 0, startString); - _writer->replace(endOfStatement, 0, QLatin1String(" })")); - - if (rewriteDump()) { - qWarning() << "============================================================="; - qWarning() << "Rewrote:"; - qWarning() << qPrintable(code); - } - - QString codeCopy = code; - w.write(&codeCopy); - - if (rewriteDump()) { - qWarning() << "To:"; - qWarning() << qPrintable(codeCopy); - qWarning() << "============================================================="; - } - - return codeCopy; -} - -void RewriteBinding::accept(AST::Node *node) -{ - AST::Node::acceptChild(node, this); -} - -QString RewriteBinding::rewrite(QString code, unsigned position, - AST::Statement *node) -{ - TextWriter w; - _writer = &w; - _position = position; - _inLoop = 0; - _code = &code; - - accept(node); - - unsigned startOfStatement = node->firstSourceLocation().begin() - _position; - unsigned endOfStatement = node->lastSourceLocation().end() - _position; - - _writer->replace(startOfStatement, 0, QLatin1String("(function ") + _name + QLatin1String("() { ")); - _writer->replace(endOfStatement, 0, QLatin1String(" })")); - - if (rewriteDump()) { - qWarning() << "============================================================="; - qWarning() << "Rewrote:"; - qWarning() << qPrintable(code); - } - - w.write(&code); - - if (rewriteDump()) { - qWarning() << "To:"; - qWarning() << qPrintable(code); - qWarning() << "============================================================="; - } - - return code; -} - -bool RewriteBinding::visit(AST::Block *ast) -{ - for (AST::StatementList *it = ast->statements; it; it = it->next) { - if (! it->next) { - // we need to rewrite only the last statement of a block. - accept(it->statement); - } - } - - return false; -} - -bool RewriteBinding::visit(AST::ExpressionStatement *ast) -{ - if (! _inLoop) { - unsigned startOfExpressionStatement = ast->firstSourceLocation().begin() - _position; - _writer->replace(startOfExpressionStatement, 0, QLatin1String("return ")); - } - - return false; -} - -bool RewriteBinding::visit(AST::StringLiteral *ast) -{ - rewriteStringLiteral(ast, _code, _position, _writer); - return false; -} - -bool RewriteBinding::visit(AST::DoWhileStatement *) -{ - ++_inLoop; - return true; -} - -void RewriteBinding::endVisit(AST::DoWhileStatement *) -{ - --_inLoop; -} - -bool RewriteBinding::visit(AST::WhileStatement *) -{ - ++_inLoop; - return true; -} - -void RewriteBinding::endVisit(AST::WhileStatement *) -{ - --_inLoop; -} - -bool RewriteBinding::visit(AST::ForStatement *) -{ - ++_inLoop; - return true; -} - -void RewriteBinding::endVisit(AST::ForStatement *) -{ - --_inLoop; -} - -bool RewriteBinding::visit(AST::LocalForStatement *) -{ - ++_inLoop; - return true; -} - -void RewriteBinding::endVisit(AST::LocalForStatement *) -{ - --_inLoop; -} - -bool RewriteBinding::visit(AST::ForEachStatement *) -{ - ++_inLoop; - return true; -} - -void RewriteBinding::endVisit(AST::ForEachStatement *) -{ - --_inLoop; -} - -bool RewriteBinding::visit(AST::LocalForEachStatement *) -{ - ++_inLoop; - return true; -} - -void RewriteBinding::endVisit(AST::LocalForEachStatement *) -{ - --_inLoop; -} - -bool RewriteBinding::visit(AST::FunctionExpression *) -{ - return false; -} - -bool RewriteBinding::visit(AST::FunctionDeclaration *) -{ - return false; -} - -bool RewriteBinding::visit(AST::CaseBlock *ast) -{ - // Process the initial sequence of the case clauses. - for (AST::CaseClauses *it = ast->clauses; it; it = it->next) { - // Return the value of the last statement in the block, if this is the last `case clause' - // of the switch statement. - bool returnTheValueOfLastStatement = (it->next == 0) && (ast->defaultClause == 0) && (ast->moreClauses == 0); - - if (AST::CaseClause *clause = it->clause) { - accept(clause->expression); - rewriteCaseStatements(clause->statements, returnTheValueOfLastStatement); - } - } - - // Process the default case clause - if (ast->defaultClause) { - // Return the value of the last statement in the block, if this is the last `case clause' - // of the switch statement. - bool rewriteTheLastStatement = (ast->moreClauses == 0); - - rewriteCaseStatements(ast->defaultClause->statements, rewriteTheLastStatement); - } - - // Process trailing `case clauses' - for (AST::CaseClauses *it = ast->moreClauses; it; it = it->next) { - // Return the value of the last statement in the block, if this is the last `case clause' - // of the switch statement. - bool returnTheValueOfLastStatement = (it->next == 0); - - if (AST::CaseClause *clause = it->clause) { - accept(clause->expression); - rewriteCaseStatements(clause->statements, returnTheValueOfLastStatement); - } - } - - return false; -} - -void RewriteBinding::rewriteCaseStatements(AST::StatementList *statements, bool rewriteTheLastStatement) -{ - for (AST::StatementList *it = statements; it; it = it->next) { - if (it->next && AST::cast(it->next->statement) != 0) { - // The value of the first statement followed by a `break'. - accept(it->statement); - break; - } else if (!it->next) { - if (rewriteTheLastStatement) - accept(it->statement); - else if (AST::Block *block = AST::cast(it->statement)) - rewriteCaseStatements(block->statements, rewriteTheLastStatement); - } - } -} - /* RewriteSignalHandler performs two different types of rewrites, depending on what information diff --git a/src/qml/qml/qqmlrewrite_p.h b/src/qml/qml/qqmlrewrite_p.h index c3139c6a2f..127c0811cc 100644 --- a/src/qml/qml/qqmlrewrite_p.h +++ b/src/qml/qml/qqmlrewrite_p.h @@ -88,58 +88,6 @@ public: virtual bool visit(AST::BinaryExpression *); }; -class RewriteBinding: protected AST::Visitor -{ - unsigned _position; - TextWriter *_writer; - QString _name; - const QString *_code; - -public: - QString operator()(const QString &code, bool *ok = 0, bool *sharable = 0, bool *safe = 0); - QString operator()(QQmlJS::AST::Node *node, const QString &code, bool *sharable = 0, bool *safe = 0); - - //name of the function: used for the debugger - void setName(const QString &name) { _name = name; } - -protected: - using AST::Visitor::visit; - - void accept(AST::Node *node); - QString rewrite(QString code, unsigned position, AST::Statement *node); - void rewriteCaseStatements(AST::StatementList *statements, bool rewriteTheLastStatement); - - virtual bool visit(AST::StringLiteral *ast); - virtual bool visit(AST::Block *ast); - virtual bool visit(AST::ExpressionStatement *ast); - - virtual bool visit(AST::DoWhileStatement *ast); - virtual void endVisit(AST::DoWhileStatement *ast); - - virtual bool visit(AST::WhileStatement *ast); - virtual void endVisit(AST::WhileStatement *ast); - - virtual bool visit(AST::ForStatement *ast); - virtual void endVisit(AST::ForStatement *ast); - - virtual bool visit(AST::LocalForStatement *ast); - virtual void endVisit(AST::LocalForStatement *ast); - - virtual bool visit(AST::ForEachStatement *ast); - virtual void endVisit(AST::ForEachStatement *ast); - - virtual bool visit(AST::LocalForEachStatement *ast); - virtual void endVisit(AST::LocalForEachStatement *ast); - - virtual bool visit(AST::CaseBlock *ast); - - virtual bool visit(AST::FunctionExpression *ast); - virtual bool visit(AST::FunctionDeclaration *ast); - -private: - int _inLoop; -}; - class RewriteSignalHandler: protected AST::Visitor { public: diff --git a/src/qml/qml/qqmlscript.cpp b/src/qml/qml/qqmlscript.cpp index 613ff24f20..c24891f6d6 100644 --- a/src/qml/qml/qqmlscript.cpp +++ b/src/qml/qml/qqmlscript.cpp @@ -47,7 +47,6 @@ #include "parser/qqmljsmemorypool_p.h" #include "parser/qqmljsastvisitor_p.h" #include "parser/qqmljsast_p.h" -#include #include #include diff --git a/src/qml/qml/qqmlvme.cpp b/src/qml/qml/qqmlvme.cpp index 48bd4beb84..b6067b57e5 100644 --- a/src/qml/qml/qqmlvme.cpp +++ b/src/qml/qml/qqmlvme.cpp @@ -801,7 +801,7 @@ QObject *QQmlVME::run(QList *errors, if (instr.isRoot && BINDINGSKIPLIST.testBit(instr.property.coreIndex)) QML_NEXT_INSTR(StoreBinding); - QQmlBinding *bind = new QQmlBinding(PRIMITIVES.at(instr.value), true, + QQmlBinding *bind = new QQmlBinding(PRIMITIVES.at(instr.value), context, CTXT, COMP->name, instr.line, instr.column); bindValues.push(bind); diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp index 97c745cbda..fad2d91732 100644 --- a/src/quick/qtquick2.cpp +++ b/src/quick/qtquick2.cpp @@ -130,7 +130,7 @@ void QQmlQtQuick2DebugStatesDelegate::updateBinding(QQmlContext *context, QQmlBinding *newBinding = 0; if (!isLiteralValue) { - newBinding = new QQmlBinding(expression.toString(), false, object, + newBinding = new QQmlBinding(expression.toString(), object, QQmlContextData::get(context), fileName, line, column); newBinding->setTarget(property); diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp index 0193d3def0..c1173d70f5 100644 --- a/src/quick/util/qquickpropertychanges.cpp +++ b/src/quick/util/qquickpropertychanges.cpp @@ -42,7 +42,6 @@ #include "qquickpropertychanges_p.h" #include -#include #include #include @@ -292,7 +291,7 @@ QQuickPropertyChangesParser::compile(const QList &prop var = QVariant(v.asScript()); { // Pre-rewrite the expression - id = rewriteBinding(v, data.at(ii).first); + id = bindingIdentifier(v, data.at(ii).first); } break; } @@ -483,7 +482,7 @@ QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions() QQmlBinding *newBinding = e.id != QQmlBinding::Invalid ? QQmlBinding::createBinding(e.id, object(), qmlContext(this), e.url.toString(), e.column) : 0; if (!newBinding) - newBinding = new QQmlBinding(e.expression, false, object(), QQmlContextData::get(qmlContext(this)), e.url.toString(), e.line, e.column); + newBinding = new QQmlBinding(e.expression, object(), QQmlContextData::get(qmlContext(this)), e.url.toString(), e.line, e.column); if (d->isExplicit) { // in this case, we don't want to assign a binding, per se, -- cgit v1.2.3