| 1 | // Copyright (C) 2021 The Qt Company Ltd. |
|---|---|
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 | |
| 4 | #include "qv4jscall_p.h" |
| 5 | |
| 6 | #include <QtQml/qqmlinfo.h> |
| 7 | |
| 8 | #include <private/qqmlengine_p.h> |
| 9 | #include <private/qv4qobjectwrapper_p.h> |
| 10 | |
| 11 | QT_BEGIN_NAMESPACE |
| 12 | |
| 13 | /*! \internal |
| 14 | |
| 15 | Sets the arguments of JSCallData from type erased \a args based on type |
| 16 | information provided by \a types |
| 17 | */ |
| 18 | void QV4::populateJSCallArguments(ExecutionEngine *v4, JSCallArguments &jsCall, |
| 19 | int argc, void **args, const QMetaType *types) |
| 20 | { |
| 21 | for (int ii = 0; ii < argc; ++ii) |
| 22 | jsCall.args[ii] = v4->metaTypeToJS(type: types[ii], data: args[ii + 1]); |
| 23 | } |
| 24 | |
| 25 | void QV4::warnAboutCoercionToVoid( |
| 26 | ExecutionEngine *engine, const Value &value, CoercionProblem problem) |
| 27 | { |
| 28 | auto log = qCritical().nospace().noquote(); |
| 29 | if (const CppStackFrame *frame = engine->currentStackFrame) |
| 30 | log << frame->source() << ':' << frame->lineNumber() << ": "; |
| 31 | log << value.toQStringNoThrow() |
| 32 | << " should be coerced to void because"; |
| 33 | switch (problem) { |
| 34 | case InsufficientAnnotation: |
| 35 | log << " the function called is insufficiently annotated."; |
| 36 | break; |
| 37 | case InvalidListType: |
| 38 | log << " the target type, a list of unknown elements, cannot be resolved."; |
| 39 | break; |
| 40 | } |
| 41 | |
| 42 | log << " The original value is retained. This will change in a future version of Qt."; |
| 43 | } |
| 44 | |
| 45 | |
| 46 | QT_END_NAMESPACE |
| 47 |
