aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qqmlcodegenerator.cpp4
-rw-r--r--src/qml/compiler/qqmlcodegenerator_p.h2
-rw-r--r--src/qml/qml/qqmlcompiler.cpp5
-rw-r--r--src/qml/qml/qqmltypeloader.cpp3
4 files changed, 9 insertions, 5 deletions
diff --git a/src/qml/compiler/qqmlcodegenerator.cpp b/src/qml/compiler/qqmlcodegenerator.cpp
index 51a4961050..546c92cd04 100644
--- a/src/qml/compiler/qqmlcodegenerator.cpp
+++ b/src/qml/compiler/qqmlcodegenerator.cpp
@@ -1226,7 +1226,7 @@ void JSCodeGen::beginObjectScope(QQmlPropertyCache *scopeObject)
_scopeObject = scopeObject;
}
-QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<AST::Node*> &functions)
+QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<AST::Node*> &functions, const QHash<int, QString> &functionNames)
{
QVector<int> runtimeFunctionIndices(functions.size());
@@ -1257,7 +1257,7 @@ QVector<int> JSCodeGen::generateJSCodeForFunctionsAndBindings(const QList<AST::N
if (function)
name = function->name.toString();
else
- name = QStringLiteral("%qml-expression-entry");
+ name = functionNames.value(i, QStringLiteral("%qml-expression-entry"));
AST::SourceElements *body;
if (function)
diff --git a/src/qml/compiler/qqmlcodegenerator_p.h b/src/qml/compiler/qqmlcodegenerator_p.h
index d077bff6db..1cc5b1e2f6 100644
--- a/src/qml/compiler/qqmlcodegenerator_p.h
+++ b/src/qml/compiler/qqmlcodegenerator_p.h
@@ -362,7 +362,7 @@ struct Q_QML_EXPORT JSCodeGen : public QQmlJS::Codegen
void beginObjectScope(QQmlPropertyCache *scopeObject);
// Returns mapping from input functions to index in V4IR::Module::functions / compiledData->runtimeFunctions
- QVector<int> generateJSCodeForFunctionsAndBindings(const QList<AST::Node*> &functions);
+ QVector<int> generateJSCodeForFunctionsAndBindings(const QList<AST::Node*> &functions, const QHash<int, QString> &functionNames);
// Resolve QObject members with the help of QQmlEngine's meta type registry
virtual V4IR::Expr *member(V4IR::Expr *base, const QString *name);
diff --git a/src/qml/qml/qqmlcompiler.cpp b/src/qml/qml/qqmlcompiler.cpp
index fc8570d128..0ba90aad27 100644
--- a/src/qml/qml/qqmlcompiler.cpp
+++ b/src/qml/qml/qqmlcompiler.cpp
@@ -3632,6 +3632,8 @@ bool QQmlCompiler::completeComponentBuild()
QQmlJS::Engine *jsEngine = parser.jsEngine();
QQmlJS::MemoryPool *pool = jsEngine->pool();
+ QHash<int, QString> expressionNames;
+
for (JSBindingReference *b = compileState->bindings.first(); b; b = b->nextReference) {
JSBindingReference &binding = *b;
@@ -3648,6 +3650,7 @@ bool QQmlCompiler::completeComponentBuild()
ComponentCompileState::PerObjectCompileData *cd = &compileState->jsCompileData[b->bindingContext.object];
cd->functionsToCompile.append(node);
binding.compiledIndex = cd->functionsToCompile.count() - 1;
+ expressionNames.insert(binding.compiledIndex, binding.property->name().toString().prepend(QStringLiteral("expression for ")));
if (componentStats)
componentStats->componentStat.scriptBindings.append(b->value->location);
@@ -3680,7 +3683,7 @@ bool QQmlCompiler::completeComponentBuild()
jsCodeGen.beginObjectScope(scopeObject->metatype);
- cd->runtimeFunctionIndices = jsCodeGen.generateJSCodeForFunctionsAndBindings(cd->functionsToCompile);
+ cd->runtimeFunctionIndices = jsCodeGen.generateJSCodeForFunctionsAndBindings(cd->functionsToCompile, expressionNames);
foreach (const QQmlCompilerTypes::ComponentCompileState::CompiledMetaMethod &cmm, cd->compiledMetaMethods) {
typedef QQmlVMEMetaData VMD;
diff --git a/src/qml/qml/qqmltypeloader.cpp b/src/qml/qml/qqmltypeloader.cpp
index 1d2748de99..4abc33a49e 100644
--- a/src/qml/qml/qqmltypeloader.cpp
+++ b/src/qml/qml/qqmltypeloader.cpp
@@ -2359,7 +2359,8 @@ void QQmlTypeData::compile()
// Compile JS binding expressions and signal handlers
JSCodeGen jsCodeGen(enginePrivate, finalUrlString(), parsedQML->code, &parsedQML->jsModule, &parsedQML->jsParserEngine, parsedQML->program, m_compiledData->importCache);
- const QVector<int> runtimeFunctionIndices = jsCodeGen.generateJSCodeForFunctionsAndBindings(parsedQML->functions);
+ QHash<int, QString> expressionNames; // ### TODO
+ const QVector<int> runtimeFunctionIndices = jsCodeGen.generateJSCodeForFunctionsAndBindings(parsedQML->functions, expressionNames);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(m_typeLoader->engine());