diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-07-04 09:58:43 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-07-04 10:22:34 +0000 |
commit | d5ab38b606fa63e6da1425b6fa607f55b3877007 (patch) | |
tree | 31372304cc0106680d37304875d611a530c0b7da /src/qml/compiler/qqmlirbuilder.cpp | |
parent | 968033e33ba2d7d9dd614994ecfca8b68f972032 (diff) |
Properly save/restore the QML temps between functions
This only worked by chance before, as they always for the
same temp indices.
Change-Id: Ib2c8b912fa1dee8b1f12c8f9d895bc023bc265d3
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/qml/compiler/qqmlirbuilder.cpp')
-rw-r--r-- | src/qml/compiler/qqmlirbuilder.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/qml/compiler/qqmlirbuilder.cpp b/src/qml/compiler/qqmlirbuilder.cpp index 312ddd753b..f34a797508 100644 --- a/src/qml/compiler/qqmlirbuilder.cpp +++ b/src/qml/compiler/qqmlirbuilder.cpp @@ -1650,6 +1650,21 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<Compil return runtimeFunctionIndices; } +int JSCodeGen::defineFunction(const QString &name, AST::Node *ast, AST::FormalParameterList *formals, AST::SourceElements *body) +{ + int qmlContextTemp = -1; + int importedScriptsTemp = -1; + qSwap(_qmlContextTemp, qmlContextTemp); + qSwap(_importedScriptsTemp, importedScriptsTemp); + + int result = Codegen::defineFunction(name, ast, formals, body); + + qSwap(_importedScriptsTemp, importedScriptsTemp); + qSwap(_qmlContextTemp, qmlContextTemp); + + return result; +} + #ifndef V4_BOOTSTRAP QQmlPropertyData *JSCodeGen::lookupQmlCompliantProperty(QQmlPropertyCache *cache, const QString &name) { |