diff options
Diffstat (limited to 'src/qml/jsruntime/qv4jscall.cpp')
-rw-r--r-- | src/qml/jsruntime/qv4jscall.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/qml/jsruntime/qv4jscall.cpp b/src/qml/jsruntime/qv4jscall.cpp new file mode 100644 index 0000000000..513ae59145 --- /dev/null +++ b/src/qml/jsruntime/qv4jscall.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +#include "qv4jscall_p.h" + +#include <QtQml/qqmlinfo.h> + +#include <private/qqmlengine_p.h> +#include <private/qv4qobjectwrapper_p.h> + +QT_BEGIN_NAMESPACE + +/*! \internal + + Sets the arguments of JSCallData from type erased \a args based on type + information provided by \a types + */ +void QV4::populateJSCallArguments(ExecutionEngine *v4, JSCallArguments &jsCall, + int argc, void **args, const QMetaType *types) +{ + for (int ii = 0; ii < argc; ++ii) + jsCall.args[ii] = v4->metaTypeToJS(types[ii], args[ii + 1]); +} + +void QV4::warnAboutCoercionToVoid( + ExecutionEngine *engine, const Value &value, CoercionProblem problem) +{ + auto log = qCritical().nospace().noquote(); + if (const CppStackFrame *frame = engine->currentStackFrame) + log << frame->source() << ':' << frame->lineNumber() << ": "; + log << value.toQStringNoThrow() + << " should be coerced to void because"; + switch (problem) { + case InsufficientAnnotation: + log << " the function called is insufficiently annotated."; + break; + case InvalidListType: + log << " the target type, a list of unknown elements, cannot be resolved."; + break; + } + + log << " The original value is retained. This will change in a future version of Qt."; +} + + +QT_END_NAMESPACE |