QV4::Function: Reduce nFormals to 16 bits

This saves some space due to better alignment.

We cannot have more bits in the compilation unit anyway. If we were to
get a signal with more formal parameters than that, we just produce an
error now.

Change-Id: I02c329590b2d18337eca7441529b5cd4e19349f7
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Ulf Hermann 2022-09-23 13:30:05 +02:00
parent ac0468f929
commit b101be9be6
2 changed files with 8 additions and 4 deletions

View File

@ -78,8 +78,8 @@ public:
// first nArguments names in internalClass are the actual arguments
Heap::InternalClass *internalClass;
uint nFormals;
int interpreterCallCount = 0;
quint16 nFormals;
bool isEval = false;
bool detectedInjectedParameters = false;

View File

@ -743,13 +743,17 @@ QString QQmlPropertyCache::signalParameterStringForJS(QV4::ExecutionEngine *engi
const QSet<QString> &illegalNames = engine->illegalNames();
QString parameters;
for (int i = 0; i < parameterNameList.count(); ++i) {
const qsizetype count = parameterNameList.count();
if (count > std::numeric_limits<quint16>::max())
*errorString = QCoreApplication::translate("QQmlRewrite", "Signal has an excessive number of parameters: %1").arg(count);
for (qsizetype i = 0; i < count; ++i) {
if (i > 0)
parameters += QLatin1Char(',');
const QByteArray &param = parameterNameList.at(i);
if (param.isEmpty())
if (param.isEmpty()) {
unnamedParameter = true;
else if (unnamedParameter) {
} else if (unnamedParameter) {
if (errorString)
*errorString = QCoreApplication::translate("QQmlRewrite", "Signal uses unnamed parameter followed by named parameter.");
return QString();