diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-05-29 14:27:46 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-05-29 15:04:10 +0000 |
commit | 2f4b8f159545b545d4b49cb3c1429c09522519ee (patch) | |
tree | 123bba8f26d8cb78ccf676be3a430513ecc6f5e5 /src | |
parent | 854c15cdb64f9693fc8d90f73464d499ebdca4fd (diff) |
Formals come after locals in the CallContext
The method updating the internal class for a CallContext messed
up the order between locals and formals, leading to wrong name
lookups for signal handlers taking implicit arguments
Task-number: QTBUG-68522
Change-Id: I36d55b3b0cfe9af6397455782551498b7ddb940a
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qml/jsruntime/qv4function.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/qml/jsruntime/qv4function.cpp b/src/qml/jsruntime/qv4function.cpp index 83e861138b..6fca9ecd45 100644 --- a/src/qml/jsruntime/qv4function.cpp +++ b/src/qml/jsruntime/qv4function.cpp @@ -112,6 +112,11 @@ void Function::updateInternalClass(ExecutionEngine *engine, const QList<QByteArr internalClass = engine->internalClasses[EngineBase::Class_CallContext]; + // first locals + const quint32_le *localsIndices = compiledFunction->localsTable(); + for (quint32 i = 0; i < compiledFunction->nLocals; ++i) + internalClass = internalClass->addMember(engine->identifierTable->identifier(compilationUnit->runtimeStrings[localsIndices[i]]), Attr_NotConfigurable); + Scope scope(engine); ScopedString arg(scope); for (const QString ¶meterName : parameterNames) { @@ -119,10 +124,6 @@ void Function::updateInternalClass(ExecutionEngine *engine, const QList<QByteArr internalClass = internalClass->addMember(arg, Attr_NotConfigurable); } nFormals = parameters.size(); - - const quint32_le *localsIndices = compiledFunction->localsTable(); - for (quint32 i = 0; i < compiledFunction->nLocals; ++i) - internalClass = internalClass->addMember(engine->identifierTable->identifier(compilationUnit->runtimeStrings[localsIndices[i]]), Attr_NotConfigurable); } QT_END_NAMESPACE |