aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/qmltc/qmltccompiler.cpp9
-rw-r--r--tools/qmltc/qmltccompilerpieces.h36
-rw-r--r--tools/qmltc/qmltcvisitor.cpp2
3 files changed, 17 insertions, 30 deletions
diff --git a/tools/qmltc/qmltccompiler.cpp b/tools/qmltc/qmltccompiler.cpp
index 31140e5281..d91ceaadf6 100644
--- a/tools/qmltc/qmltccompiler.cpp
+++ b/tools/qmltc/qmltccompiler.cpp
@@ -215,24 +215,21 @@ void QmltcCompiler::compileType(
QmltcVariable ctxtdata(u"const QQmlRefPointer<QQmlContextData>&"_s, u"parentContext"_s);
QmltcVariable finalizeFlag(u"bool"_s, u"canFinalize"_s);
current.baselineCtor.parameterList = { parent };
+ current.endInit.parameterList = { creator, engine };
+ current.setComplexBindings.parameterList = { creator, engine };
+ current.handleOnCompleted.parameterList = { creator };
if (documentRoot) {
current.externalCtor.parameterList = { engine, parent };
current.init.parameterList = { creator, engine, ctxtdata, finalizeFlag };
current.beginClass.parameterList = { creator, finalizeFlag };
- current.endInit.parameterList = { creator, engine, finalizeFlag };
- current.setComplexBindings.parameterList = { creator, engine, finalizeFlag };
current.completeComponent.parameterList = { creator, finalizeFlag };
current.finalizeComponent.parameterList = { creator, finalizeFlag };
- current.handleOnCompleted.parameterList = { creator, finalizeFlag };
} else {
current.externalCtor.parameterList = { creator, engine, parent };
current.init.parameterList = { creator, engine, ctxtdata };
current.beginClass.parameterList = { creator };
- current.endInit.parameterList = { creator, engine };
- current.setComplexBindings.parameterList = { creator, engine };
current.completeComponent.parameterList = { creator };
current.finalizeComponent.parameterList = { creator };
- current.handleOnCompleted.parameterList = { creator };
}
current.externalCtor.initializerList = { current.baselineCtor.name + u"(" + parent.name
diff --git a/tools/qmltc/qmltccompilerpieces.h b/tools/qmltc/qmltccompilerpieces.h
index cbee19485d..140a30745d 100644
--- a/tools/qmltc/qmltccompilerpieces.h
+++ b/tools/qmltc/qmltccompilerpieces.h
@@ -251,15 +251,15 @@ inline decltype(auto) QmltcCodeGenerator::generate_initCode(QmltcType &current,
current.init.body << u"if (canFinalize) {"_s;
current.init.body << QStringLiteral(" %1(creator, /* finalize */ true);")
.arg(current.beginClass.name);
- current.init.body << QStringLiteral(" %1(creator, engine, /* finalize */ true);")
+ current.init.body << QStringLiteral(" %1(creator, engine);")
.arg(current.endInit.name);
- current.init.body << QStringLiteral(" %1(creator, engine, /* finalize */ true);")
+ current.init.body << QStringLiteral(" %1(creator, engine);")
.arg(current.setComplexBindings.name);
current.init.body << QStringLiteral(" %1(creator, /* finalize */ true);")
.arg(current.completeComponent.name);
current.init.body << QStringLiteral(" %1(creator, /* finalize */ true);")
.arg(current.finalizeComponent.name);
- current.init.body << QStringLiteral(" %1(creator, /* finalize */ true);")
+ current.init.body << QStringLiteral(" %1(creator);")
.arg(current.handleOnCompleted.name);
current.init.body << u"}"_s;
}
@@ -340,8 +340,12 @@ inline void QmltcCodeGenerator::generate_qmltcInstructionCallCode(
function->body << u"{"_s;
function->body << u"QQmltcObjectCreationHelper subCreator(creator, %1);"_s.arg(
creationOffset);
- function->body << u"%1::%2(&subCreator, %3);"_s.arg(base->internalName(), function->name,
- baseInstructionArgs);
+ if (!baseInstructionArgs.isEmpty()) {
+ function->body << u"%1::%2(&subCreator, %3);"_s.arg(
+ base->internalName(), function->name, baseInstructionArgs);
+ } else {
+ function->body << u"%1::%2(&subCreator);"_s.arg(base->internalName(), function->name);
+ }
function->body << u"}"_s;
}
@@ -375,15 +379,10 @@ inline void QmltcCodeGenerator::generate_endInitCode(QmltcType &current,
// QML_endInit()'s parameters:
// * QQmltcObjectCreationHelper* creator
// * QQmlEngine* engine
- // * bool canFinalize [optional, when document root]
- const bool isDocumentRoot = type == visitor->result();
current.endInit.body << u"Q_UNUSED(creator);"_s;
current.endInit.body << u"Q_UNUSED(engine);"_s;
- if (isDocumentRoot)
- current.endInit.body << u"Q_UNUSED(canFinalize);"_s;
- generate_qmltcInstructionCallCode(&current.endInit, type, u"engine, /* finalize */ false"_s,
- u"creator, engine"_s);
+ generate_qmltcInstructionCallCode(&current.endInit, type, u"engine"_s, u"creator, engine"_s);
if (visitor->hasDeferredBindings(type)) {
current.endInit.body << u"{ // defer bindings"_s;
@@ -416,15 +415,11 @@ QmltcCodeGenerator::generate_setComplexBindingsCode(QmltcType &current,
// QML_setComplexBindings()'s parameters:
// * QQmltcObjectCreationHelper* creator
// * QQmlEngine* engine
- // * bool canFinalize [optional, when document root]
- const bool isDocumentRoot = type == visitor->result();
current.setComplexBindings.body << u"Q_UNUSED(creator);"_s;
current.setComplexBindings.body << u"Q_UNUSED(engine);"_s;
- if (isDocumentRoot)
- current.setComplexBindings.body << u"Q_UNUSED(canFinalize);"_s;
- generate_qmltcInstructionCallCode(&current.setComplexBindings, type,
- u"engine, /* finalize */ false"_s, u"creator, engine"_s);
+ generate_qmltcInstructionCallCode(&current.setComplexBindings, type, u"engine"_s,
+ u"creator, engine"_s);
}
/*!
@@ -553,14 +548,9 @@ QmltcCodeGenerator::generate_handleOnCompletedCode(QmltcType &current,
// QML_handleOnCompleted()'s parameters:
// * QQmltcObjectCreationHelper* creator
- // * bool canFinalize [optional, when document root]
- const bool isDocumentRoot = type == visitor->result();
current.handleOnCompleted.body << u"Q_UNUSED(creator);"_s;
- if (isDocumentRoot)
- current.handleOnCompleted.body << u"Q_UNUSED(canFinalize);"_s;
- generate_qmltcInstructionCallCode(&current.handleOnCompleted, type, u"/* finalize */ false"_s,
- u"creator"_s);
+ generate_qmltcInstructionCallCode(&current.handleOnCompleted, type, QString(), u"creator"_s);
}
/*!
diff --git a/tools/qmltc/qmltcvisitor.cpp b/tools/qmltc/qmltcvisitor.cpp
index 8b7f0fdb45..7f6ad4715c 100644
--- a/tools/qmltc/qmltcvisitor.cpp
+++ b/tools/qmltc/qmltcvisitor.cpp
@@ -697,7 +697,7 @@ void QmltcVisitor::checkForNamingCollisionsWithCpp(const QQmlJSScope::ConstPtr &
const auto enumKeys = e.keys();
for (const auto &key : enumKeys)
- validate(key, u"Enumeration '%1' key"_qs.arg(e.name()));
+ validate(key, u"Enumeration '%1' key"_s.arg(e.name()));
}
const auto properties = type->ownProperties();